[Openvpn-devel,v1] Make test_misc compile with -Werror again.

Message ID 20260806111323.32150-1-gert@greenie.muc.de
State New
Headers
Series [Openvpn-devel,v1] Make test_misc compile with -Werror again. |

Commit Message

Gert Doering Aug. 6, 2026, 11:13 a.m. UTC
  From: Arne Schwabe <arne@rfc2549.org>

Commit 5978a46e3 (master)/3402f9aa0 (release/2.7) removed the
local prototype/function get_random in test_misc and use the
global prototype in crypto.h.

This made get_random return uint64_t instead of uint32_t.
Adjust the calls in test_list accordingly.

On master the general hash rewrite/cleanup completely
removes the iv argument from hash_init and therefore
only 2.7 requires this patch.

Change-Id: I1a6a0ca8beba3214b21047755246ceeb30141c2a
Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1839
---

This change was reviewed on Gerrit and approved by at least one
developer. I request to merge it to release/2.7.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1839
This mail reflects revision 1 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Gert Doering <gert@greenie.muc.de>
  

Comments

Gert Doering Aug. 6, 2026, noon UTC | #1
Thanks for quickly repairing this.  It is good to have the get_random()
fix in 2.7 (because not having it would bite us in the future), but of
course it must not fail -Werror...

Verified *and* stared-at-code ;-)

Your patch has been applied to the release/2.7 branch.

commit 6f6d02e72343e04c0b473d8dd7a762498ef37d84 (release/2.7)
Author: Arne Schwabe
Date:   Thu Aug 6 13:13:17 2026 +0200

     Make test_misc compile with -Werror again.

     Signed-off-by: Arne Schwabe <arne-openvpn@rfc2549.org>
     Acked-by: Gert Doering <gert@greenie.muc.de>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1839
     Message-Id: <20260806111323.32150-1-gert@greenie.muc.de>
     URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg38167.html
     Signed-off-by: Gert Doering <gert@greenie.muc.de>


--
kind regards,

Gert Doering
  

Patch

diff --git a/tests/unit_tests/openvpn/test_misc.c b/tests/unit_tests/openvpn/test_misc.c
index b9e2db0..a9c3845 100644
--- a/tests/unit_tests/openvpn/test_misc.c
+++ b/tests/unit_tests/openvpn/test_misc.c
@@ -170,8 +170,8 @@ 
      */
 
     struct gc_arena gc = gc_new();
-    struct hash *hash = hash_init(10000, get_random(), word_hash_function, word_compare_function);
-    struct hash *nhash = hash_init(256, get_random(), word_hash_function, word_compare_function);
+    struct hash *hash = hash_init(10000, (uint32_t)get_random(), word_hash_function, word_compare_function);
+    struct hash *nhash = hash_init(256, (uint32_t)get_random(), word_hash_function, word_compare_function);
 
     printf("hash_init n_buckets=%u mask=0x%08x\n", hash->n_buckets, hash->mask);