From patchwork Wed Mar 4 16:44:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4798 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7001:a68f:b0:83c:d90d:321 with SMTP id wf15csp340294mab; Wed, 4 Mar 2026 08:45:33 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCW7dBRK5ZYJ0t/l07ElXjh40wMbzedvZ+2a63m1zrURNoFQe9w8d7UuNw8MtTELZG5wZxm89+3rdeg=@openvpn.net X-Received: by 2002:a05:6870:c103:b0:409:5e6d:2716 with SMTP id 586e51a60fabf-416ab58cc95mr1294547fac.5.1772642732883; Wed, 04 Mar 2026 08:45:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1772642732; cv=none; d=google.com; s=arc-20240605; b=dPEI+A0UZbGLcdJo3Ryl6MJxgWYeLnQ4vNLZq4upwDjdZWqbuHKUni+8C6BA20xAjU MsaL18jRpFA3jiPzALnYqsrEdiolMygkwwthVxu1p7nAmPJPt13TTtqbuM8iUoFrUlh1 tFMTWIHel3q8UKMwZbG4FyyqVL7+s0IjJviaCPy2T+51rMlY/0CGYKEkpw0XA29BCSwb 3wWVwXNQjm7pWrBAB1CCYN5e/KjDiymB/mlNJeSnhyWVivl1lQQBESIRbXv//bI1JaOk w0JWnH33kWwASnEQR3cMnEh0oZ/0xHzBZCreKtBCgOJv0foxpqeaJCVUwLtnMwQ7fzk8 dueQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=TZiYpYSEJe02nqET4haLOi8gkLVjWNUO3SIhMb54QjM=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=irK7Xii99uEo2MpQFkdy84ZtnB1+X48aY3Hl/dQUk1OknnSxeitTfZxmgpOtmcGjmv i2rhJJLQuMClOeuBxe/J3f4RlBxJ45OC/Ieq5Npk8V938iwbSDCX74diAetbVnGqREjw po88y6zr4sZxZljtyPzvGccdOUQR2u96LAa9EOx3NR+Z+1TgyxTz95N9piQZ8KYFTr2u GIOCjz/c+43OPHG5kd1PXb34eLh6PyvIdHzqNODfb/1OfUssdXHp1ASFouVFZcvD1WgU sXR1EkSifxymbF49lu04FEB3y7mKjPl0u2V0IIQoupBcZ7niU1LKROnYdRl62dX6OYD3 ixXg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=QHlLYtbR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=k7ScrsvS; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="lbK7eyu/"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-4160cfb211dsi14029143fac.99.2026.03.04.08.45.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Mar 2026 08:45:32 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=QHlLYtbR; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=k7ScrsvS; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b="lbK7eyu/"; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TZiYpYSEJe02nqET4haLOi8gkLVjWNUO3SIhMb54QjM=; b=QHlLYtbRJb1boHsMOQl45sAiIf EmibYtjSSFTFw3oq63uMjdb/orZDLG2QyVVB2AYQEv/dtD9o9GnRwsR6gyGGlAGYg823hFz2IiQtY t/Bz+PtogulUIIWuImY6mr9PYZ9ngMT8YNTSDnOCcb6MQxQ82Zf+Rogt2R47eKsjPPtA=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vxpLm-0001lN-MF; Wed, 04 Mar 2026 16:45:30 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vxpLj-0001ko-3O for openvpn-devel@lists.sourceforge.net; Wed, 04 Mar 2026 16:45:27 +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:References: In-Reply-To:Message-ID:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A9pk2t7DTmVW6GFpm2DdOYhzNX98ZePWz4hgOAynEDs=; b=k7ScrsvScQJim94DiqkpYV57LJ bGHadn5zPoHuPOPfEHz/yckt/WzqoOqAj3ABqrDrGTuD96XJzQxEbiCO2sdVOVlUj9wnDBqenT+qT Y0OFQJVemaGH2z3qMYjkZkJlmw8hGm3lkSBGAnZ6INIaeXNHnNaVJe/4DEGXPXFWWYPw=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=A9pk2t7DTmVW6GFpm2DdOYhzNX98ZePWz4hgOAynEDs=; b=lbK7eyu/hxmpn8MZLU14BBpeaq wrHCLTV0qmI5xKsGTKF6ICccN5bgSFT+238GJ9LchTw9lL22lPvexqEL7NKojYsaSxzL9XpFlKRUv 1JCNo9cKC6JeAVJ6iFj0XWQhTtapjkA8a5y3byGHmG0c9JtXW3zFOF6+Du6QBD8+PuWc=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1vxpLW-0003HR-Mw for openvpn-devel@lists.sourceforge.net; Wed, 04 Mar 2026 16:45:15 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 624Gj21Q015464 for ; Wed, 4 Mar 2026 17:45:02 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 624Gj2et015463 for openvpn-devel@lists.sourceforge.net; Wed, 4 Mar 2026 17:45:02 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Wed, 4 Mar 2026 17:44:55 +0100 Message-ID: <20260304164502.15449-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-2.hosts.colo.sdot.me", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From: Frank Lichtenheld parse_hexdigest is a function that is used in exactly one place (not counting tests). So change the types in a way that they match what the caller actually wants (DWORD) and so we do not have any unne [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1vxpLW-0003HR-Mw Subject: [Openvpn-devel] [PATCH v5] cryptoapi: Change signature of parse_hexstring to match code 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1855509721909221540?= X-GMAIL-MSGID: =?utf-8?q?1858750626357214500?= From: Frank Lichtenheld parse_hexdigest is a function that is used in exactly one place (not counting tests). So change the types in a way that they match what the caller actually wants (DWORD) and so we do not have any unnecessary conversions. Change-Id: I525a5b1b9b6f173cdf12341aefc44d58f0d43aed Signed-off-by: Frank Lichtenheld Acked-by: Antonio Quartulli Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1492 This mail reflects revision 5 of this Change. Acked-by according to Gerrit (reflected above): Antonio Quartulli diff --git a/src/openvpn/cryptoapi.c b/src/openvpn/cryptoapi.c index b74320d..e17936a 100644 --- a/src/openvpn/cryptoapi.c +++ b/src/openvpn/cryptoapi.c @@ -61,7 +61,7 @@ return 0; } -#else /* HAVE_XKEY_PROVIDER */ +#else /* HAVE_XKEY_PROVIDER */ static XKEY_EXTERNAL_SIGN_fn xkey_cng_sign; @@ -145,11 +145,6 @@ free(cd); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-compare" -#endif - /** * Parse a hex string with optional embedded spaces into * a byte array. @@ -158,10 +153,10 @@ * @param capacity capacity of the byte array arr * @returns the number of bytes parsed or 0 on error */ -int -parse_hexstring(const char *p, unsigned char *arr, size_t capacity) +static DWORD +parse_hexstring(const char *p, unsigned char *arr, DWORD capacity) { - int i = 0; + DWORD i = 0; for (; *p && i < capacity; p += 2) { /* skip spaces */ @@ -182,10 +177,6 @@ return i; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - static void * decode_object(struct gc_arena *gc, LPCSTR struct_type, const CRYPT_OBJID_BLOB *val, DWORD flags, DWORD *cb) diff --git a/tests/unit_tests/openvpn/test_cryptoapi.c b/tests/unit_tests/openvpn/test_cryptoapi.c index ce527d7..59a356d 100644 --- a/tests/unit_tests/openvpn/test_cryptoapi.c +++ b/tests/unit_tests/openvpn/test_cryptoapi.c @@ -469,7 +469,7 @@ for (size_t i = 0; i < _countof(valid_str); i++) { - int len = parse_hexstring(valid_str[i], hash, _countof(hash)); + DWORD len = parse_hexstring(valid_str[i], hash, _countof(hash)); assert_int_equal(len, sizeof(test_hash)); assert_memory_equal(hash, test_hash, sizeof(test_hash)); memset(hash, 0, _countof(hash)); @@ -477,7 +477,7 @@ for (size_t i = 0; i < _countof(invalid_str); i++) { - int len = parse_hexstring(invalid_str[i], hash, _countof(hash)); + DWORD len = parse_hexstring(invalid_str[i], hash, _countof(hash)); assert_int_equal(len, 0); } }