cron2 has uploaded a new patch set (#3) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1732?usp=email )
The following approvals got outdated and were removed: Code-Review+2 by cron2 Change subject: Make get_random return int64 instead of long ...................................................................... Make get_random return int64 instead of long This avoids having get_ranomd being different on 32bit/Windows vs 64 bit Unix platform. Also adjust platform_create_temp_file to create the same files on all platforms. Change-Id: Ifefb3ad204c0c16cb4952dd6e8661fdc9136b125 Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1732 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg37322.html Signed-off-by: Gert Doering <[email protected]> --- M src/openvpn/crypto.c M src/openvpn/crypto.h M src/openvpn/platform.c 3 files changed, 13 insertions(+), 7 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/1732/3 diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 7954e8a..3d79fe5 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -1731,11 +1731,12 @@ ASSERT(rand_bytes(output, len)); } -/* an analogue to the random() function, but use prng_bytes */ -long int +/* an analogue to the random() function, but use prng_bytes and + * also int64_t instead of long to avoid LLP64 vs LP64 */ +int64_t get_random(void) { - long int l; + int64_t l; prng_bytes((unsigned char *)&l, sizeof(l)); if (l < 0) { diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index fbca2a0..ee5b50f 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -603,8 +603,13 @@ */ void prng_bytes(uint8_t *output, int len); -/* an analogue to the random() function, but use prng_bytes */ -long int get_random(void); +/** + * an analogue to the random() function, but use prng_bytes and + * also int64_t instead of long to avoid LLP64 vs LP64 + * + * @return Returns a random positive 63 bit integer + */ +int64_t get_random(void); /** Print a cipher list entry */ void print_cipher(const char *cipher); diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c index 9fa9363..85b6408 100644 --- a/src/openvpn/platform.c +++ b/src/openvpn/platform.c @@ -543,7 +543,7 @@ const char *retfname = NULL; unsigned int attempts = 0; char fname[256] = { 0 }; - const char *fname_fmt = PACKAGE "_%.*s_%08lx%08lx.tmp"; + const char *fname_fmt = PACKAGE "_%.*s_%08" PRIx64 "%08" PRIx64 ".tmp"; const int max_prefix_len = sizeof(fname) - (sizeof(PACKAGE) + 7 + (2 * 8)); while (attempts < 6) @@ -551,7 +551,7 @@ ++attempts; if (!checked_snprintf(fname, sizeof(fname), fname_fmt, max_prefix_len, prefix, - (unsigned long)get_random(), (unsigned long)get_random())) + get_random(), get_random())) { msg(M_WARN, "ERROR: temporary filename too long"); return NULL; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1732?usp=email To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: Ifefb3ad204c0c16cb4952dd6e8661fdc9136b125 Gerrit-Change-Number: 1732 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos <[email protected]> Gerrit-Reviewer: cron2 <[email protected]> Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________ Openvpn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openvpn-devel
