diff options
author | djm <> | 2005-04-29 05:37:34 +0000 |
---|---|---|
committer | djm <> | 2005-04-29 05:37:34 +0000 |
commit | a95585a25ab25668b931a78b7543f707a3354db8 (patch) | |
tree | f9e9febf7ac0c8f5d6df761fe70fd613aac06203 /src/lib/libssl/s3_srvr.c | |
parent | 58c08aa241f168c84ce7cc3052454ea59a44eada (diff) | |
download | openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.gz openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.bz2 openbsd-a95585a25ab25668b931a78b7543f707a3354db8.zip |
import of openssl-0.9.7g; tested on platforms from alpha to zaurus, ok deraadt@
Diffstat (limited to 'src/lib/libssl/s3_srvr.c')
-rw-r--r-- | src/lib/libssl/s3_srvr.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/libssl/s3_srvr.c b/src/lib/libssl/s3_srvr.c index deb3cffabe..c4a1a71523 100644 --- a/src/lib/libssl/s3_srvr.c +++ b/src/lib/libssl/s3_srvr.c | |||
@@ -125,6 +125,7 @@ | |||
125 | #include <openssl/krb5_asn.h> | 125 | #include <openssl/krb5_asn.h> |
126 | #endif | 126 | #endif |
127 | #include <openssl/md5.h> | 127 | #include <openssl/md5.h> |
128 | #include <openssl/fips.h> | ||
128 | 129 | ||
129 | static SSL_METHOD *ssl3_get_server_method(int ver); | 130 | static SSL_METHOD *ssl3_get_server_method(int ver); |
130 | static int ssl3_get_client_hello(SSL *s); | 131 | static int ssl3_get_client_hello(SSL *s); |
@@ -955,7 +956,8 @@ static int ssl3_send_server_hello(SSL *s) | |||
955 | p=s->s3->server_random; | 956 | p=s->s3->server_random; |
956 | Time=time(NULL); /* Time */ | 957 | Time=time(NULL); /* Time */ |
957 | l2n(Time,p); | 958 | l2n(Time,p); |
958 | RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-sizeof(Time)); | 959 | if(RAND_pseudo_bytes(p,SSL3_RANDOM_SIZE-4) <= 0) |
960 | return -1; | ||
959 | /* Do the message type and length last */ | 961 | /* Do the message type and length last */ |
960 | d=p= &(buf[4]); | 962 | d=p= &(buf[4]); |
961 | 963 | ||
@@ -1211,6 +1213,8 @@ static int ssl3_send_server_key_exchange(SSL *s) | |||
1211 | j=0; | 1213 | j=0; |
1212 | for (num=2; num > 0; num--) | 1214 | for (num=2; num > 0; num--) |
1213 | { | 1215 | { |
1216 | EVP_MD_CTX_set_flags(&md_ctx, | ||
1217 | EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); | ||
1214 | EVP_DigestInit_ex(&md_ctx,(num == 2) | 1218 | EVP_DigestInit_ex(&md_ctx,(num == 2) |
1215 | ?s->ctx->md5:s->ctx->sha1, NULL); | 1219 | ?s->ctx->md5:s->ctx->sha1, NULL); |
1216 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); | 1220 | EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); |
@@ -1491,7 +1495,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1491 | i = SSL_MAX_MASTER_KEY_LENGTH; | 1495 | i = SSL_MAX_MASTER_KEY_LENGTH; |
1492 | p[0] = s->client_version >> 8; | 1496 | p[0] = s->client_version >> 8; |
1493 | p[1] = s->client_version & 0xff; | 1497 | p[1] = s->client_version & 0xff; |
1494 | RAND_pseudo_bytes(p+2, i-2); /* should be RAND_bytes, but we cannot work around a failure */ | 1498 | if(RAND_pseudo_bytes(p+2, i-2) <= 0) /* should be RAND_bytes, but we cannot work around a failure */ |
1499 | goto err; | ||
1495 | } | 1500 | } |
1496 | 1501 | ||
1497 | s->session->master_key_length= | 1502 | s->session->master_key_length= |
@@ -1589,7 +1594,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1589 | n2s(p,i); | 1594 | n2s(p,i); |
1590 | enc_ticket.length = i; | 1595 | enc_ticket.length = i; |
1591 | 1596 | ||
1592 | if (n < enc_ticket.length + 6) | 1597 | if (n < (long)enc_ticket.length + 6) |
1593 | { | 1598 | { |
1594 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1599 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1595 | SSL_R_DATA_LENGTH_TOO_LONG); | 1600 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1602,7 +1607,7 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1602 | n2s(p,i); | 1607 | n2s(p,i); |
1603 | authenticator.length = i; | 1608 | authenticator.length = i; |
1604 | 1609 | ||
1605 | if (n < enc_ticket.length + authenticator.length + 6) | 1610 | if (n < (long)(enc_ticket.length + authenticator.length + 6)) |
1606 | { | 1611 | { |
1607 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1612 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1608 | SSL_R_DATA_LENGTH_TOO_LONG); | 1613 | SSL_R_DATA_LENGTH_TOO_LONG); |
@@ -1627,8 +1632,8 @@ static int ssl3_get_client_key_exchange(SSL *s) | |||
1627 | goto err; | 1632 | goto err; |
1628 | } | 1633 | } |
1629 | 1634 | ||
1630 | if (n != enc_ticket.length + authenticator.length + | 1635 | if (n != (long)(enc_ticket.length + authenticator.length + |
1631 | enc_pms.length + 6) | 1636 | enc_pms.length + 6)) |
1632 | { | 1637 | { |
1633 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, | 1638 | SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE, |
1634 | SSL_R_DATA_LENGTH_TOO_LONG); | 1639 | SSL_R_DATA_LENGTH_TOO_LONG); |