From patchwork Wed Oct 31 05:01:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 584 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.27.255.58]) by backend30.mail.ord1d.rsapps.net with LMTP id uCxUOi/S2VvhLAAAIUCqbw for ; Wed, 31 Oct 2018 12:02:56 -0400 Received: from proxy2.mail.iad3a.rsapps.net ([172.27.255.58]) by director10.mail.ord1d.rsapps.net with LMTP id OLWtNy/S2VuuDgAApN4f7A ; Wed, 31 Oct 2018 12:02:56 -0400 Received: from smtp50.gate.iad3a ([172.27.255.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.iad3a.rsapps.net with LMTP id sIJuMS/S2VttBgAABcWvHw ; Wed, 31 Oct 2018 12:02:55 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp50.gate.iad3a.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 6d428c80-dd26-11e8-8890-525400c2fb51-1-1 Received: from [216.105.38.7] ([216.105.38.7:57676] helo=lists.sourceforge.net) by smtp50.gate.iad3a.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 5A/90-12248-F22D9DB5; Wed, 31 Oct 2018 12:02:55 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1gHswN-0008HF-SQ; Wed, 31 Oct 2018 16:01:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1gHswN-0008H7-7y for openvpn-devel@lists.sourceforge.net; Wed, 31 Oct 2018 16:01:55 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=wSTID6VHK7sflxOtt8t8QuaW9Zxk16oYnVpnMCHAK8k=; b=j8BA8gRfglUyLXLEsrDMAuNfLg nmMfnVJH2wSsNNuBPbjETUUy3+KKQ2cf37pOO/L+wsSivhnpFce5LuCsbDpuP5ElZAMC9uxLxB2kw Bj8n3+E6pfPySJKYMW4Mot2ty4dUEieR2LX1qT3iVlndhLfZY0ZKzb2uBIUujOozcJO4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=wSTID6VHK7sflxOtt8t8QuaW9Zxk16oYnVpnMCHAK8k=; b=Q Zx+NoIt+/IcNYdJne+pRQ65sWPMr9+ucIhkV/v5+91CF3g+AQEbUDsEvJbhw1lp1gjNKOXoKJEqIO zTW+iXx+j3om/jvJWk0YrarFw1MM5+wo24DSfBrdadNKYKUjqREscOjPf/7seFeCtkXUsYUAV83MM kZyju1IEeAVZ4B0M=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1gHswK-008H7M-VZ for openvpn-devel@lists.sourceforge.net; Wed, 31 Oct 2018 16:01:55 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Thu, 1 Nov 2018 00:01:24 +0800 Message-Id: <20181031160124.26972-1-a@unstable.cc> MIME-Version: 1.0 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [5.148.176.60 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record X-Headers-End: 1gHswK-008H7M-VZ Subject: [Openvpn-devel] [PATCH] tls-crypt: properly cast time_t to uint64_t X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox The exact type of time_t is platform dependent and therefore can't be assumed to be uint64_t all the time. For example, on 32bit platforms, where time_t is defined as long (32bit), the compiler will generate the following warning, due to the arithmetic used in the macro: tls_crypt.c:745:29: warning: shift count >= width of type [-Wshift-count-overflow] Force time_t to be parsed as uint64_t. Reported-by: Arne Schwabe Signed-off-by: Antonio Quartulli --- src/openvpn/tls_crypt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c index d70d0a66..c3ed2b93 100644 --- a/src/openvpn/tls_crypt.c +++ b/src/openvpn/tls_crypt.c @@ -742,7 +742,7 @@ tls_crypt_v2_write_client_key_file(const char *filename, } else { - int64_t timestamp = htonll(now); + int64_t timestamp = htonll((uint64_t)now); ASSERT(buf_write(&metadata, &TLS_CRYPT_METADATA_TYPE_TIMESTAMP, 1)); ASSERT(buf_write(&metadata, ×tamp, sizeof(timestamp))); }