diff options
author | jkim <jkim@FreeBSD.org> | 2014-06-09 05:50:57 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2014-06-09 05:50:57 +0000 |
commit | 68fed3306b1f39bfb6d5cd97485248dc0c3884f8 (patch) | |
tree | 3b5358dd257bf44bb4ea15442ad4bdb078b6795f /crypto/openssl/ssl/s3_srvr.c | |
parent | e15884d6df140228c1e2db4ca751565a6933e1f5 (diff) | |
parent | d4a5f67323e640990da5aa727b2e6da35d2157f3 (diff) | |
download | FreeBSD-src-68fed3306b1f39bfb6d5cd97485248dc0c3884f8.zip FreeBSD-src-68fed3306b1f39bfb6d5cd97485248dc0c3884f8.tar.gz |
Merge OpenSSL 1.0.1h.
Approved by: so (delphij)
Diffstat (limited to 'crypto/openssl/ssl/s3_srvr.c')
-rw-r--r-- | crypto/openssl/ssl/s3_srvr.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/crypto/openssl/ssl/s3_srvr.c b/crypto/openssl/ssl/s3_srvr.c index 0eb8b28..503bed3 100644 --- a/crypto/openssl/ssl/s3_srvr.c +++ b/crypto/openssl/ssl/s3_srvr.c @@ -2102,6 +2102,11 @@ int ssl3_send_certificate_request(SSL *s) s->init_num=n+4; s->init_off=0; #ifdef NETSCAPE_HANG_BUG + if (!BUF_MEM_grow_clean(buf, s->init_num + 4)) + { + SSLerr(SSL_F_SSL3_SEND_CERTIFICATE_REQUEST,ERR_R_BUF_LIB); + goto err; + } p=(unsigned char *)s->init_buf->data + s->init_num; /* do the header */ @@ -2818,6 +2823,8 @@ int ssl3_get_client_key_exchange(SSL *s) unsigned char premaster_secret[32], *start; size_t outlen=32, inlen; unsigned long alg_a; + int Ttag, Tclass; + long Tlen; /* Get our certificate private key*/ alg_a = s->s3->tmp.new_cipher->algorithm_auth; @@ -2839,26 +2846,15 @@ int ssl3_get_client_key_exchange(SSL *s) ERR_clear_error(); } /* Decrypt session key */ - if ((*p!=( V_ASN1_SEQUENCE| V_ASN1_CONSTRUCTED))) - { - SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED); - goto gerr; - } - if (p[1] == 0x81) - { - start = p+3; - inlen = p[2]; - } - else if (p[1] < 0x80) - { - start = p+2; - inlen = p[1]; - } - else + if (ASN1_get_object((const unsigned char **)&p, &Tlen, &Ttag, &Tclass, n) != V_ASN1_CONSTRUCTED || + Ttag != V_ASN1_SEQUENCE || + Tclass != V_ASN1_UNIVERSAL) { SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_DECRYPTION_FAILED); goto gerr; } + start = p; + inlen = Tlen; if (EVP_PKEY_decrypt(pkey_ctx,premaster_secret,&outlen,start,inlen) <=0) { |