From patchwork Wed Aug 5 13:47:19 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 5201 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7000:77c3:b0:87d:ab56:3700 with SMTP id r3csp6335685mau; Wed, 5 Aug 2026 06:47:36 -0700 (PDT) X-Forwarded-Encrypted: i=2; AHgh+RovmT03p3wXtz7ldRnlndRYv193/DDb5R+GC/p5Ojaenkg9lj48898VbCejCWbiA1jmMQORMFfHvuI=@openvpn.net X-Received: by 2002:a05:6820:4c86:b0:6a1:5b63:2ae2 with SMTP id 006d021491bc7-6ae9702def9mr3617000eaf.29.1785937656050; Wed, 05 Aug 2026 06:47:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1785937656; cv=none; d=google.com; s=arc-20260327; b=f6WCDYfvhJKrtnAiMNynLkRhHNNBDKUYXkbbyKluN5xfTj3wRaCI06BTWqSBrGMhhn CJS73LOoB74yU1HQiaQ6GPmeU56v6Eo9x1jDSfqhKqgqx6bUSJV38jkYBm38Mc3fV3SI FRqmN/CfPVgeV0i4Ur4qZwLxaJ8I/4X6PKONenR5doXn7snERQH3hjTpwykI66mfyr/I 5R41+/LBgcp/UuLgBNOHN0miUtOa+VTe5bgc2shPItauAurvUWSKld5S66X6L3aG2RKM zyfih5w3jwgvwoz28wqSI+stbBXdILmmstitNNzTSjjQrBs8n2xntzGzSRAMBcF0pkns xk5Q== 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:dkim-signature; bh=pN052cMjn0DJCVluFTGIPulRHeA9ZRewCOLyN/8/VA4=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=jcFUrLdXymQeveUFr2UeW8N9vBafyyWVRAey9K8welan/dGpXyejiBZb+wH4coO2KM GHdE0STQ/uJt4FLLoCOaG0sRAYTBaaVPtmJR62+V/dLvxNKM2naWrMvxFMzlyoakNcLI XjLeem2IN3urweodF+KF91/881x3BhjhAyvyH3aZOoEabLdMM73rCUNGL0RbQ+XS6mDR yFiFpY6X7GLKPS1kXkRD0inAIidLKoDaDppO35tbxhM0w++l1Q6LAX8VKNL8mansVgIc Qagwd+utkgLquaLTL5ohnuA8NdcyLF9qKd1t/q1kDycmuQzU+ayvy1T/7Q03N3jP3cUS LvkQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=DUX5WeZW; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jnxll1ks; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gWrEIScK; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=tL1jOcyJ; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 006d021491bc7-6ae94099d4dsi3004769eaf.65.2026.08.05.06.47.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Aug 2026 06:47:36 -0700 (PDT) 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=DUX5WeZW; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=jnxll1ks; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=gWrEIScK; dkim=neutral (body hash did not verify) header.i=@lichtenheld.com header.s=MBO0001 header.b=tL1jOcyJ; 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 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=pN052cMjn0DJCVluFTGIPulRHeA9ZRewCOLyN/8/VA4=; b=DUX5WeZW1zzZNQCbiLB6f05/Zu 8NihQrh2lhqBTP+g6e0gXukcDT2KLsgIoLNOZOoYRaXhnM97LsZhjVDatSuCjfJFoe2dgPoWP1oIy rzSTnnMy2MeE0eSvim92IsHQRrU/RdL1PVVIDRQwOFcOs5laVT8Ass+MoGG+sG0R/Tbo=; 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 1wrbxz-0000kn-Rk; Wed, 05 Aug 2026 13:47:32 +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 1wrbxz-0000kd-6w for openvpn-devel@lists.sourceforge.net; Wed, 05 Aug 2026 13:47:31 +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: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=VotXnl+W0hc+eVLG2+k+HW60V49jekOnnhQVfaR1mlc=; b=jnxll1ksJjANwkVefUHNSn+xoN iAbqzcWDcLpV1cLjh6WTwdB55ZvGmQ3jhsPDtVngyCU5tFH068aC0I5SxnuCUNCDBfL0hhVIx2CCi Obh7df0gyDRwqbejbXDZ8DnrTkhuK7O4TLbTU7ijje6wq8rNGcOdt+St4y9Axn2anyJE=; 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: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=VotXnl+W0hc+eVLG2+k+HW60V49jekOnnhQVfaR1mlc=; b=gWrEIScKpdED3AgVMSRA9YzXgC 904GqZ56peKd30zNEhnlpQA867a+gvPU65C9PMzdjC7+AGy0s3EJgjL15uvtOkjB+8qe93U8z5kXq olnNlCgCcqGWVpcu428gd3a7Ok+H0MLpn0ICzlgjV84r7L8qvdCNXF3iHho3M0CsHfpE=; Received: from mout-p-202.mailbox.org ([80.241.56.172]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1wrby0-00087H-Pu for openvpn-devel@lists.sourceforge.net; Wed, 05 Aug 2026 13:47:31 +0000 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4hFWtd01NFzMlMZ; Wed, 05 Aug 2026 15:47:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lichtenheld.com; s=MBO0001; t=1785937641; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VotXnl+W0hc+eVLG2+k+HW60V49jekOnnhQVfaR1mlc=; b=tL1jOcyJex4Ygl44CDfe02eA7Pb6VnKOjkvp8uF95Zpz+rnL8u1xN8pWMRjgPfmDVlNP5r AjcpXCrsgwSPN1u0QF1g/GqSq/oZkb0VH+1v8lxyF3Dav4iF2UX6P3WkulIB5+UTFnCUHQ SOz2CAupxQ1nQIPtSPAz4/UB/HkUmZvgn4S4E+p9tb2IZDaws6RqzHygZDorZ5OpOCErR7 mUtVgLVTqVR3ZfwqKra3pYTVQ8hJbACqAIBQ5tHc0UAp7LpG4VMgVH0Teyx6kPqsDOhdsr 84jKV0pCitglRFeVXZ+SlkRu6ngKzTX4zj8k4QtebfVENXcjqxSU5PXwGGTILQ== Authentication-Results: outgoing_mbo_mout; dkim=none; spf=pass (outgoing_mbo_mout: domain of frank@lichtenheld.com designates 2001:67c:2050:b231:465::102 as permitted sender) smtp.mailfrom=frank@lichtenheld.com From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Wed, 5 Aug 2026 15:47:19 +0200 Message-ID: <20260805134719.164126-1-frank@lichtenheld.com> In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 4hFWtd01NFzMlMZ X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.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: Arne Schwabe The get_random in test_misc.c conflicts with the get_random function that OpenVPN defines in crypto.h Also adjust the implementation in mock_get_random.c to match the prototype in crypto.h Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid 0.0 RCVD_IN_MSPIKE_H5 RBL: Excellent reputation (+5) [80.241.56.172 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Headers-End: 1wrby0-00087H-Pu Subject: [Openvpn-devel] [PATCH v1] Remove local get_random in test_misc.c 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: 1872691363407005925 X-GMAIL-MSGID: 1872691363407005925 From: Arne Schwabe The get_random in test_misc.c conflicts with the get_random function that OpenVPN defines in crypto.h Also adjust the implementation in mock_get_random.c to match the prototype in crypto.h Change-Id: I3db70001be7f39cf84d562517647f1a305962b42 Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1834 --- 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/+/1834 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld diff --git a/tests/unit_tests/openvpn/mock_get_random.c b/tests/unit_tests/openvpn/mock_get_random.c index 0840e31..5cb768b 100644 --- a/tests/unit_tests/openvpn/mock_get_random.c +++ b/tests/unit_tests/openvpn/mock_get_random.c @@ -28,7 +28,7 @@ #include #include -unsigned long +int64_t get_random(void) { /* rand() is not very random, but it's C99 and this is just for testing */ diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvpn/test_misc.c index 501286c..8da7abe 100644 --- a/tests/unit_tests/openvpn/test_misc.c +++ b/tests/unit_tests/openvpn/test_misc.c @@ -38,6 +38,7 @@ #include "test_common.h" #include "list.h" #include "mock_msg.h" +#include "crypto.h" #ifdef _WIN32 #include "win32-util.h" #endif @@ -141,13 +142,6 @@ return strcmp((const char *)key1, (const char *)key2) == 0; } -static uint32_t -get_random(void) -{ - /* rand() is not very random, but it's C99 and this is just for testing */ - return (uint32_t)rand(); -} - static struct hash_element * hash_lookup_by_value(struct hash *hash, void *value) { @@ -263,7 +257,7 @@ { struct hash_iterator hi; struct hash_element *he; - inc = (get_random() % 3) + 1; + inc = ((uint32_t)get_random() % 3) + 1; hash_iterator_init_range(hash, &hi, base, base + inc); while ((he = hash_iterator_next(&hi)))