From 4dee50b9c80f9b18d2eb9a1c20bd879abb342302 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 28 Jul 2017 15:49:36 +0200 Subject: timeval: struct curltime is a struct timeval replacement ... to make all libcurl internals able to use the same data types for the struct members. The timeval struct differs subtly on several platforms so it makes it cumbersome to use everywhere. Ref: #1652 Closes #1693 --- lib/vtls/openssl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/vtls') diff --git a/lib/vtls/openssl.c b/lib/vtls/openssl.c index a77e4330e..40bb2dde4 100644 --- a/lib/vtls/openssl.c +++ b/lib/vtls/openssl.c @@ -290,16 +290,18 @@ static CURLcode Curl_ossl_seed(struct Curl_easy *data) unsigned char randb[64]; size_t len = sizeof(randb); size_t i, i_max; - for(i = 0, i_max = len / sizeof(struct timeval); i < i_max; ++i) { - struct timeval tv = curlx_tvnow(); + for(i = 0, i_max = len / sizeof(struct curltime); i < i_max; ++i) { + struct curltime tv = curlx_tvnow(); Curl_wait_ms(1); tv.tv_sec *= i + 1; - tv.tv_usec *= i + 2; + tv.tv_usec *= (unsigned int)i + 2; tv.tv_sec ^= ((curlx_tvnow().tv_sec + curlx_tvnow().tv_usec) * (i + 3)) << 8; - tv.tv_usec ^= ((curlx_tvnow().tv_sec + curlx_tvnow().tv_usec) * - (i + 4)) << 16; - memcpy(&randb[i * sizeof(struct timeval)], &tv, sizeof(struct timeval)); + tv.tv_usec ^= (unsigned int) ((curlx_tvnow().tv_sec + + curlx_tvnow().tv_usec) * + (i + 4)) << 16; + memcpy(&randb[i * sizeof(struct curltime)], &tv, + sizeof(struct curltime)); } RAND_add(randb, (int)len, (double)len/2); } while(!rand_enough()); -- cgit v1.2.3