From patchwork Mon Nov 16 14:57:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5715 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:9292:b0:11a:f58a:e788 with SMTP id dc18csp1324250lab; Mon, 16 Nov 2026 06:57:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErHzuJqZc2Kr2VmczH+AHtMQEFE3tNwNaEzfZgfkfYMr4pxjYQg9QIT0BhKVcfymm+pnbN5XpRd9Ebg=@openvpn.net X-Received: by 2002:a05:7022:258f:b0:1b0:430d:d81c with SMTP id a92af1059eb24-1b503112636mr12387642c88.25.1794841077355; Mon, 16 Nov 2026 06:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794841077; cv=none; d=google.com; s=arc-20260327; b=s0y8PppkGZbX4iCePo2Xlu5xiRo7PpRggXAyDBRFGJ02Ha+9aeJVQZ4OzqKODoFnw8 xecA7p+fga7qgMVK2ERCrYvYaq5euaEdj/IDhBZQVpLAiNDSo+SydJ/CkdCpo5h40n9B HdPvSYFnAHrdnmOqMnfCZGNmv7Trcz/nf/1A+OywIG/1CPczjQC03TSykp0YvZwZOwsg p6EqJFrdIOtzQ2Dqkq8x+29QBE2RUebDYXUahsosYpwRqxSSm65U96anjv4JvmBHqi4q DaYL00XCrPLN7QAz8+1AGWha7bsgQvwukniUmMlAsRc82cjRXq6DjTjqIjhiLx7s5tcu 4MQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; 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=SUXMS/jtqqoRGeFmF72C8HmUz9r5mVtCBldDzC3/0KE=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=ZLhU4JiGhDOGM3zyAtXuC6F5PROMdjWRkTLSJ+0lx/+vc/ZgGASiQxx5f2bJTbh7mc 8FLm0ZaoBggKWy6jrY/ND4DwlGgV7b6Ag5vaW2dQtr6HYWQlExvkxgLhse3+DPFKH2dh RlHfhoa/acdA5ByGG2zblu1IlWy2VaS+pOgE769K3k3/21R5waJQJOCkgr7gX/ktCTPj w3UtYiUo1lP2NgkEwYZEmGOklHw1oLfTS/8bU7kein4tXzTBXFfLr8KdgAczTenW5N8h yp6QE+dpa15Zk9XuJzw8V1fifvRxCa7iTRJ/kqJ6Sl/S1cvoMaIch5y7HmpvWEsgWuCM cCFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b="Pi/p1U9L"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=bpgo2V90; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=D3Fzb3mO; 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 a92af1059eb24-1b5031e7e43si41753613c88.10.2026.11.16.06.57.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2026 06:57:57 -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="Pi/p1U9L"; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=bpgo2V90; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=D3Fzb3mO; 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-Unsubscribe-Post: List-Owner; bh=SUXMS/jtqqoRGeFmF72C8HmUz9r5mVtCBldDzC3/0KE=; b=Pi/p1U9LRQ9vJm zzuJ5koJw3cGR6FZm9uXpV1GBiFvOGzqN971qFI2EjkRQ/PORq8efQMnQUF8J1zidWzpAB0DUXg99 GJBmdu3bnpl7L/SzhEcinaQfMcyWc6KOF31Vp/wqyPAh7n3I7HrLWmE8fvKCNDmXFHbFzs5TSX2+6 nnY=; 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.100.1) (envelope-from ) id 1xSy9b-000000005Zp-2F1y; Mon, 16 Nov 2026 14:57:55 +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.100.1) (envelope-from ) id 1xSy9a-000000005Zj-1LU8 for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 14:57:54 +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-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ck2dUoPcKK2PQd+LWiBbjtUMtr9yFX7q2MT/yBh2LS0=; b=bpgo2V905YMvDgsUPyKt97Rh3m 0x1SFXvC1aQD2dh6A0HZLTFyVx4UOQGOvwhHJb9LQJwCEoXvY3rWg/VSPV9Ugi3QW8/3b8b/ROFhK xJa0qBKUMCM+6WE579OMZMrT73DCsfbwnSSL1NJWFlfYmjrvPpz7cpaFbEYzs12h1gtM=; 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-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Ck2dUoPcKK2PQd+LWiBbjtUMtr9yFX7q2MT/yBh2LS0=; b=D3Fzb3mOd5w/SZ6X/UJXVj40pz 8TqP4WTslE+twhIwFgc6+GT5BlpsMUWQ4ec1fFNh0Tzfl75eRxx+wiGjzA3cbfANtAURhLpzkV75t 9q0SrNWy9j67MECxQZK914CPsqR8CcRtza6y126PCYiMpaCPA4PI4QAHnDkRVEsW62IY=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xSy9Y-000000006ic-2ket for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 14:57:54 +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 6AGEvjVC008312 for ; Mon, 16 Nov 2026 15:57:45 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AGEvjv4008311 for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 15:57:45 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 16 Nov 2026 15:57:36 +0100 Message-ID: <20261116145745.8299-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.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 ALLOC_ARRAY already wants size_t. Change-Id: If79d4356b5da82c2844cd9e8c59a0fc41aeff3c0 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/o [...] 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: 1xSy9Y-000000006ic-2ket Subject: [Openvpn-devel] [PATCH v2] ssl_util: Switch get_num_elements to size_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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: 1882027277563823501 X-GMAIL-MSGID: 1882027277563823501 From: Frank Lichtenheld ALLOC_ARRAY already wants size_t. Change-Id: If79d4356b5da82c2844cd9e8c59a0fc41aeff3c0 Signed-off-by: Frank Lichtenheld Acked-by: Razvan Cojocaru Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2199 --- 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/+/2199 This mail reflects revision 2 of this Change. Acked-by according to Gerrit (reflected above): Razvan Cojocaru diff --git a/src/openvpn/ssl_mbedtls.c b/src/openvpn/ssl_mbedtls.c index 2d29e60..19a2d48 100644 --- a/src/openvpn/ssl_mbedtls.c +++ b/src/openvpn/ssl_mbedtls.c @@ -199,11 +199,6 @@ ciphers); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - void tls_ctx_restrict_ciphers(struct tls_root_ctx *ctx, const char *ciphers) { @@ -217,7 +212,7 @@ ASSERT(NULL != ctx); /* Get number of ciphers */ - int cipher_count = get_num_elements(ciphers, ':'); + size_t cipher_count = get_num_elements(ciphers, ':'); /* Allocate an array for them */ ALLOC_ARRAY_CLEAR(ctx->allowed_ciphers, int, cipher_count + 1) @@ -339,7 +334,7 @@ struct gc_arena gc = gc_new(); /* Get number of groups and allocate an array in ctx */ - int groups_count = get_num_elements(groups, ':'); + size_t groups_count = get_num_elements(groups, ':'); ALLOC_ARRAY_CLEAR(ctx->groups, uint16_t, groups_count + 1) /* Parse allowed ciphers, getting IDs */ @@ -1188,10 +1183,6 @@ return 1; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif - /* ************************************** * * Information functions diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index 7622d88..30ef383 100644 --- a/src/openvpn/ssl_openssl.c +++ b/src/openvpn/ssl_openssl.c @@ -518,11 +518,6 @@ { ASSERT(ctx); #if OPENSSL_VERSION_NUMBER < 0x30000000L && !defined(ENABLE_CRYPTO_WOLFSSL) -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsign-conversion" -#endif - struct gc_arena gc = gc_new(); /* This method could be as easy as * SSL_CTX_set1_groups_list(ctx->ctx, groups) @@ -533,7 +528,7 @@ * Also note that the code is wrong in the presence of OpenSSL3 providers. */ - int groups_count = get_num_elements(groups, ':'); + size_t groups_count = get_num_elements(groups, ':'); int *glist; /* Allocate an array for them */ @@ -569,9 +564,6 @@ } gc_free(&gc); -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif #else /* if OPENSSL_VERSION_NUMBER < 0x30000000L */ if (!SSL_CTX_set1_groups_list(ctx->ctx, groups)) { diff --git a/src/openvpn/ssl_util.c b/src/openvpn/ssl_util.c index 337faed..6c17fe5 100644 --- a/src/openvpn/ssl_util.c +++ b/src/openvpn/ssl_util.c @@ -359,14 +359,14 @@ return NULL; } -int +size_t get_num_elements(const char *string, char delimiter) { const size_t string_len = strlen(string); ASSERT(0 != string_len); - int element_count = 1; + size_t element_count = 1; /* Get number of ciphers */ for (size_t i = 0; i < string_len; i++) { diff --git a/src/openvpn/ssl_util.h b/src/openvpn/ssl_util.h index 6f9f65b..db5e17c 100644 --- a/src/openvpn/ssl_util.h +++ b/src/openvpn/ssl_util.h @@ -125,6 +125,6 @@ * @param delimiter the delimiter to count, typically ':' * @return occrrences of delimiter + 1 */ -int get_num_elements(const char *string, char delimiter); +size_t get_num_elements(const char *string, char delimiter); #endif /* ifndef SSL_UTIL_H_ */