Cleanup.
[openssl.git] / ssl / d1_clnt.c
index 1b518d981ea0a2671e65ff51574ce0282f45eba0..492d6dfbeeb1bc13f77a158c7185b00c75bbd971 100644 (file)
@@ -329,7 +329,6 @@ int dtls1_connect(SSL *s)
                        if (ret <= 0) goto end;
                        else
                                {
-                               dtls1_stop_timer(s);
                                if (s->hit)
                                        {
 #ifndef OPENSSL_NO_SCTP
@@ -440,6 +439,7 @@ int dtls1_connect(SSL *s)
                case SSL3_ST_CR_SRVR_DONE_B:
                        ret=ssl3_get_server_done(s);
                        if (ret <= 0) goto end;
+                       dtls1_stop_timer(s);
                        if (s->s3->tmp.cert_req)
                                s->s3->tmp.next_state=SSL3_ST_CW_CERT_A;
                        else
@@ -773,7 +773,7 @@ int dtls1_client_hello(SSL *s)
        unsigned char *buf;
        unsigned char *p,*d;
        unsigned int i,j;
-       unsigned long Time,l;
+       unsigned long l;
        SSL_COMP *comp;
 
        buf=(unsigned char *)s->init_buf->data;
@@ -798,13 +798,10 @@ int dtls1_client_hello(SSL *s)
 
                /* if client_random is initialized, reuse it, we are
                 * required to use same upon reply to HelloVerify */
-               for (i=0;p[i]=='\0' && i<sizeof(s->s3->client_random);i++) ;
+               for (i=0;p[i]=='\0' && i<sizeof(s->s3->client_random);i++)
+                       ;
                if (i==sizeof(s->s3->client_random))
-                       {
-                       Time=(unsigned long)time(NULL); /* Time */
-                       l2n(Time,p);
-                       RAND_pseudo_bytes(p,sizeof(s->s3->client_random)-4);
-                       }
+                       ssl_fill_hello_random(s,0,p,sizeof(s->s3->client_random));
 
                /* Do the message type and length last */
                d=p= &(buf[DTLS1_HM_HEADER_LENGTH]);