diff options
Diffstat (limited to 'lib/vtls')
-rw-r--r-- | lib/vtls/openssl.c | 14 |
1 files changed, 8 insertions, 6 deletions
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()); |