diff options
author | Nils Larsch <nils@openssl.org> | 2005-04-29 20:10:06 +0000 |
---|---|---|
committer | Nils Larsch <nils@openssl.org> | 2005-04-29 20:10:06 +0000 |
commit | 7c7667b86b481c7516d147cd50ece203d3eb58ab (patch) | |
tree | 8deb77933dbb0e2839b3270bfee9a7a3b3571cf1 /ssl/s2_srvr.c | |
parent | 38be5db93ba435df8d2fbb1caee608ff2266de24 (diff) |
check return value of RAND_pseudo_bytes; backport from the stable branch
Diffstat (limited to 'ssl/s2_srvr.c')
-rw-r--r-- | ssl/s2_srvr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/ssl/s2_srvr.c b/ssl/s2_srvr.c index 6c43f72078..7cc160b1ad 100644 --- a/ssl/s2_srvr.c +++ b/ssl/s2_srvr.c @@ -498,7 +498,8 @@ static int get_client_master_key(SSL *s) i=ek; else i=EVP_CIPHER_key_length(c); - RAND_pseudo_bytes(p,i); + if (RAND_pseudo_bytes(p,i) <= 0) + return 0; } #else if (i < 0) @@ -804,7 +805,8 @@ static int server_hello(SSL *s) /* make and send conn_id */ s2n(SSL2_CONNECTION_ID_LENGTH,p); /* add conn_id length */ s->s2->conn_id_length=SSL2_CONNECTION_ID_LENGTH; - RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length); + if (RAND_pseudo_bytes(s->s2->conn_id,(int)s->s2->conn_id_length) <= 0) + return -1; memcpy(d,s->s2->conn_id,SSL2_CONNECTION_ID_LENGTH); d+=SSL2_CONNECTION_ID_LENGTH; @@ -950,7 +952,8 @@ static int request_certificate(SSL *s) p=(unsigned char *)s->init_buf->data; *(p++)=SSL2_MT_REQUEST_CERTIFICATE; *(p++)=SSL2_AT_MD5_WITH_RSA_ENCRYPTION; - RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); + if (RAND_pseudo_bytes(ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH) <= 0) + return -1; memcpy(p,ccd,SSL2_MIN_CERT_CHALLENGE_LENGTH); s->state=SSL2_ST_SEND_REQUEST_CERTIFICATE_B; |