summaryrefslogtreecommitdiff
path: root/src/lib/libssl/s23_clnt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/s23_clnt.c')
-rw-r--r--src/lib/libssl/s23_clnt.c29
1 files changed, 4 insertions, 25 deletions
diff --git a/src/lib/libssl/s23_clnt.c b/src/lib/libssl/s23_clnt.c
index 2b93c639dd..47673e740a 100644
--- a/src/lib/libssl/s23_clnt.c
+++ b/src/lib/libssl/s23_clnt.c
@@ -269,35 +269,12 @@ static int ssl23_no_ssl2_ciphers(SSL *s)
269 return 1; 269 return 1;
270 } 270 }
271 271
272/* Fill a ClientRandom or ServerRandom field of length len. Returns <= 0
273 * on failure, 1 on success. */
274int ssl_fill_hello_random(SSL *s, int server, unsigned char *result, int len)
275 {
276 int send_time = 0;
277
278 if (len < 4)
279 return 0;
280 if (server)
281 send_time = (s->mode & SSL_MODE_SEND_SERVERHELLO_TIME) != 0;
282 else
283 send_time = (s->mode & SSL_MODE_SEND_CLIENTHELLO_TIME) != 0;
284 if (send_time)
285 {
286 unsigned long Time = (unsigned long)time(NULL);
287 unsigned char *p = result;
288 l2n(Time, p);
289 return RAND_pseudo_bytes(p, len-4);
290 }
291 else
292 return RAND_pseudo_bytes(result, len);
293 }
294
295static int ssl23_client_hello(SSL *s) 272static int ssl23_client_hello(SSL *s)
296 { 273 {
297 unsigned char *buf; 274 unsigned char *buf;
298 unsigned char *p,*d; 275 unsigned char *p,*d;
299 int i,ch_len; 276 int i,ch_len;
300 unsigned long l; 277 unsigned long Time,l;
301 int ssl2_compat; 278 int ssl2_compat;
302 int version = 0, version_major, version_minor; 279 int version = 0, version_major, version_minor;
303#ifndef OPENSSL_NO_COMP 280#ifndef OPENSSL_NO_COMP
@@ -378,7 +355,9 @@ static int ssl23_client_hello(SSL *s)
378#endif 355#endif
379 356
380 p=s->s3->client_random; 357 p=s->s3->client_random;
381 if (ssl_fill_hello_random(s, 0, p, SSL3_RANDOM_SIZE) <= 0) 358 Time=(unsigned long)time(NULL); /* Time */
359 l2n(Time,p);
360 if (RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0)
382 return -1; 361 return -1;
383 362
384 if (version == TLS1_2_VERSION) 363 if (version == TLS1_2_VERSION)