aboutsummaryrefslogtreecommitdiff
path: root/lib/vtls
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-07-28 15:49:36 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-07-28 15:51:25 +0200
commit4dee50b9c80f9b18d2eb9a1c20bd879abb342302 (patch)
tree7a9c5ddd299e23ad27c7efa6a8759ae3122f31c9 /lib/vtls
parent7551e55d6614cddb039602e08f3d7aa302299617 (diff)
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
Diffstat (limited to 'lib/vtls')
-rw-r--r--lib/vtls/openssl.c14
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());