From patchwork Tue Apr 27 22:10:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 1779 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.31.255.6]) by backend30.mail.ord1d.rsapps.net with LMTP id gBvZA8IYiWCyAwAAIUCqbw (envelope-from ) for ; Wed, 28 Apr 2021 04:11:46 -0400 Received: from proxy2.mail.iad3b.rsapps.net ([172.31.255.6]) by director9.mail.ord1d.rsapps.net with LMTP id QP6uA8IYiWBoTwAAalYnBA (envelope-from ) for ; Wed, 28 Apr 2021 04:11:46 -0400 Received: from smtp26.gate.iad3b ([172.31.255.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.iad3b.rsapps.net with LMTPS id aFfZOcEYiWD/UgAAvAZTew (envelope-from ) for ; Wed, 28 Apr 2021 04:11:45 -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: smtp26.gate.iad3b.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: 5f06857c-a7f9-11eb-b4bb-5254001088d3-1-1 Received: from [216.105.38.7] ([216.105.38.7:48148] helo=lists.sourceforge.net) by smtp26.gate.iad3b.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 1C/B5-32385-1C819806; Wed, 28 Apr 2021 04:11:45 -0400 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.92.3) (envelope-from ) id 1lbfHY-0000R6-7H; Wed, 28 Apr 2021 08:10:52 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.3) (envelope-from ) id 1lbfHW-0000Qr-CX for openvpn-devel@lists.sourceforge.net; Wed, 28 Apr 2021 08:10:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version :Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: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=V6TMGZ0Wkuex3TPru5kIssGrzswpAFevtWJ11jTc3Hs=; b=D3L1UB8jTZReVnEyfTjMOM1WRO 6PMZAUCT5sU02lGa4Ry8yTVSOsA0bmkWpXiHV0eoJXULIWU2Aazrn8CXZMGjOJ5zZjXUNpkjlmgoF RIJ0eOzoiKRkgAyhT28NL0K4HOpDA/GnX9AtyYnsA7q53mdyMe8yihbqQc+2e58ngGyk=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To: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=V6TMGZ0Wkuex3TPru5kIssGrzswpAFevtWJ11jTc3Hs=; b=e 38x3BDIMaATnYqdXLYB+OO8blNd0n1U9/v45wbhsUrbtmJe3P+8G+03Z0x1blhzt3BcpUQ0609Ew7 trvtx02++D2dxnNh7x8nMPV6cEldmBpDT7YQdAsCEMZwxtstZxUhch4uTxPIWjkdoHUPPGyENn2dz kjZJ5SGBBV79i8zE=; 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.92.2) id 1lbfHR-0039QI-Da for openvpn-devel@lists.sourceforge.net; Wed, 28 Apr 2021 08:10:50 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Wed, 28 Apr 2021 10:10:54 +0200 Message-Id: <20210428081054.29081-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 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: openvpn.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1lbfHR-0039QI-Da Subject: [Openvpn-devel] [PATCH] crypto: respect ECB argument type from prototype 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 From: Antonio Quartulli Crypto backends are implementing the cipher_des_encrypt_ecb() function without fully respecting the type of the argumentis as described in the function prototype. All ECB arguments (key, input block and output block) are expected to be 8 bytes long, for this reason the prototype specifies the arguments as 3 arrays of 8 bytes in size. Convert the implementations to also explicitly mention the size of the array they expect to receive in input. Fixes these warnings: crypto_openssl.c:866:39: warning: argument 2 of type ‘unsigned char *’ declared as a pointer [-Warray-parameter=] 866 | unsigned char *src, | ~~~~~~~~~~~~~~~^~~ In file included from crypto.h:125, from crypto_openssl.c:42: crypto_backend.h:202:43: note: previously declared as an array ‘unsigned char[8]’ 202 | unsigned char src[DES_KEY_LENGTH], | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ crypto_openssl.c:867:39: warning: argument 3 of type ‘unsigned char *’ declared as a pointer [-Warray-parameter=] 867 | unsigned char *dst) | ~~~~~~~~~~~~~~~^~~ In file included from crypto.h:125, from crypto_openssl.c:42: crypto_backend.h:203:43: note: previously declared as an array ‘unsigned char[8]’ 203 | unsigned char dst[DES_KEY_LENGTH]); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ Signed-off-by: Antonio Quartulli Acked-By: Arne Schwabe --- src/openvpn/crypto_mbedtls.c | 4 ++-- src/openvpn/crypto_openssl.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c index f960d0ae..836e80ac 100644 --- a/src/openvpn/crypto_mbedtls.c +++ b/src/openvpn/crypto_mbedtls.c @@ -768,8 +768,8 @@ cipher_ctx_final_check_tag(mbedtls_cipher_context_t *ctx, uint8_t *dst, void cipher_des_encrypt_ecb(const unsigned char key[DES_KEY_LENGTH], - unsigned char *src, - unsigned char *dst) + unsigned char src[DES_KEY_LENGTH], + unsigned char dst[DES_KEY_LENGTH]) { mbedtls_des_context ctx; diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c index f8b36bf8..af7311ec 100644 --- a/src/openvpn/crypto_openssl.c +++ b/src/openvpn/crypto_openssl.c @@ -863,8 +863,8 @@ cipher_ctx_final_check_tag(EVP_CIPHER_CTX *ctx, uint8_t *dst, int *dst_len, void cipher_des_encrypt_ecb(const unsigned char key[DES_KEY_LENGTH], - unsigned char *src, - unsigned char *dst) + unsigned char src[DES_KEY_LENGTH], + unsigned char dst[DES_KEY_LENGTH]) { DES_key_schedule sched;