From patchwork Tue Jan 27 22:12:16 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 4737 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:8468:b0:80a:3855:ce6a with SMTP id u8csp2344632max; Tue, 27 Jan 2026 14:12:45 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWquNVSnh8XhR7ubvAvhrzzhYWavP9uUP6SkYs+exXbbzg4iYsa0gcW6NieRBNnXMfmPvDkrpjKrbY=@openvpn.net X-Received: by 2002:a05:6870:c048:10b0:409:57ae:54e4 with SMTP id 586e51a60fabf-40957ae5b8cmr715265fac.9.1769551965594; Tue, 27 Jan 2026 14:12:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769551965; cv=none; d=google.com; s=arc-20240605; b=BK1n++MR6nif9GekZsHXd3YadqOZR8ehgK2TETmWrMGSlSP/0F/yWjR1dHxEaaV12c yHHLtP8jPY7It8N99Y4jaEftcsejRLEStSLdLCkfbSs3sudq4ePoSN4a71C6zDtU8Md6 V7/FrIkKP8ZB5GTOOITQMT649y7pbXU5yRGDFVz/kysWMJFhz2HAThc/k7djLh0ifxqD 9vd8bGQYj5qr3vY4wNoVt6W/nISySIEbPzxFwyc3k7+KT+KbdnVRfxNnM2WpTS8VYIcG LK2EdvbL1lYrR+5gA+l6BBzR2H6XOCrXxqdeGWEvLa1AFbnsJTYWB5fWKrgTtE6j0oJQ F7iA== 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=8Ym7yxUiA7Zr0ZCEkLZOs4eIRvZZO4vfLZXatumvL7c=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ZOw6bJ1CktErFt5qedtKnh+mTRIpT+HYi1Bz4C1RbRY7+NaDyQyUoooxfxEpCz1gB7 uCeBBiJy6ip3KefkX4/c9pUZCRMVlh8razo496VF0wl2zv86jYl9dURJt4RJate6/KTk uKIQnOx5Z6xNSbuc8XOo3P4wx3lTEWN0aQFvC+oIh7t5mcSQ0y2rkI+DkkCGx5LkUDEu 7E6W+d3bEG5Y0EYAdAzxcG4ceSQDERolXbTJGixRCoM2v+1e15jIKVIbQQHAL5upVsyL ig+evOypJ9/4oYmGoD40AfpvqbBhXbkTDS5vOO/8AdC4jeKeipZgsRa6Ixq8MU0+NXV+ mYOw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=WMQMI41f; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=W0cRTOJo; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mqsq1mKO; 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-4095714d361si825861fac.23.2026.01.27.14.12.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 27 Jan 2026 14:12:45 -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=WMQMI41f; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=W0cRTOJo; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=mqsq1mKO; 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=8Ym7yxUiA7Zr0ZCEkLZOs4eIRvZZO4vfLZXatumvL7c=; b=WMQMI41fGBkiF/cPZFWYfY9yrt kxQAn++2e59lqpYgqTTn9S0+yms0Djqb6jauyNlo1LYUcqkYwp2ZZr/FFaRuC/3imY3uvonIlfLOW WJ/OFNgQ4ll7PcDsQCT3qh2znfb4RzTKNqg/Q81Dw8L9fapcw2OjFmOxzx2PRvQmorvE=; Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1vkrIg-0001UE-AS; Tue, 27 Jan 2026 22:12:42 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1vkrIe-0001U7-Qe for openvpn-devel@lists.sourceforge.net; Tue, 27 Jan 2026 22:12:40 +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=tNu+fJFshrRcn3H8BHomJVzotzPvVGMowAScejMW0Qs=; b=W0cRTOJowpIctEm6Q4feBGFAQm Bx72Kqp2I79LVK8VkHivVhjns3o0em4HaB6WMvcCjPja2XFmV1meG0KUD0GzSwRQF22idOsgcq2eH 5i9TpNbXKGwXUFxKB2cbuPEfGKfJxLPEgazl0ICULSHOY3Q5AdSudGMr5OvKtFzYk8VM=; 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=tNu+fJFshrRcn3H8BHomJVzotzPvVGMowAScejMW0Qs=; b=mqsq1mKO97qcUreipI8jWogtqG vuWnlHOdPzthRmwMB6jN+xh+1s+6W65U8tTzSttdXhSZUREdpBsd0QmHRWaWQYIfsc5iK5KhOCnqb mEEjNNA3CuPcBROVaGNQM4qw5zmRLfPKXxSfIWRozVpbCi2QrHin1ONCPpcnp9Z1T4co=; Received: from [193.149.48.134] (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 1vkrIY-0005I9-92 for openvpn-devel@lists.sourceforge.net; Tue, 27 Jan 2026 22:12:38 +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 60RMCM26029504 for ; Tue, 27 Jan 2026 23:12:22 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.1/8.18.1/Submit) id 60RMCMn9029503 for openvpn-devel@lists.sourceforge.net; Tue, 27 Jan 2026 23:12:22 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Tue, 27 Jan 2026 23:12:16 +0100 Message-ID: <20260127221222.29488-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.51.2 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: 1vkrIY-0005I9-92 Subject: [Openvpn-devel] [PATCH v1] 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?1855509721909221540?= 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 1 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); } }