From 194ad159045e04dd14db6bbe2943ad08ca98da01 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 17 Dec 2015 09:45:02 +0100 Subject: [PATCH] Explicitly call abort() if gettimeofday() doesn't succeed. --- .../randombytes/salsa20/randombytes_salsa20_random.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 0319375f..6da6b21b 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #ifndef _MSC_VER # include @@ -86,9 +87,10 @@ sodium_hrtime(void) #else { struct timeval tv; - int ret = gettimeofday(&tv, NULL); - (void)ret; - assert(ret == 0); + + if (gettimeofday(&tv, NULL) != 0) { + abort(); + } ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec; } #endif