From: Arne Schwabe <[email protected]> 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 <[email protected]> Acked-by: Frank Lichtenheld <[email protected]> Acked-by: Antonio Quartulli <[email protected]> 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 2 of this Change. Acked-by according to Gerrit (reflected above): Frank Lichtenheld <[email protected]> Antonio Quartulli <[email protected]> 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 <stdint.h> #include <cmocka.h> -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))) _______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
