diff options
| author | jsing <> | 2014-06-10 14:46:11 +0000 |
|---|---|---|
| committer | jsing <> | 2014-06-10 14:46:11 +0000 |
| commit | 80d2e651a1bd88a612cf68fb255201ef8f854c46 (patch) | |
| tree | 3fcf6413d6fbf19e0db5edc02dec724b6db1f476 /src/lib/libssl/t1_enc.c | |
| parent | ffd82070bf98c0a547b663e6bb65795c86d44d08 (diff) | |
| download | openbsd-80d2e651a1bd88a612cf68fb255201ef8f854c46.tar.gz openbsd-80d2e651a1bd88a612cf68fb255201ef8f854c46.tar.bz2 openbsd-80d2e651a1bd88a612cf68fb255201ef8f854c46.zip | |
In tls1_cert_verify_mac(), check the return value of EVP_MD_CTX_copy_ex()
to avoid a possible NULL function call on ctx.final(). None of the callers
currently check the return value of calls to cert_verify_mac(), however
the function already returns 0 in another case and the MAC comparison will
later fail.
Issue reported by David Ramos.
Diffstat (limited to 'src/lib/libssl/t1_enc.c')
| -rw-r--r-- | src/lib/libssl/t1_enc.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libssl/t1_enc.c b/src/lib/libssl/t1_enc.c index 6dcb2c849f..922d44ad4e 100644 --- a/src/lib/libssl/t1_enc.c +++ b/src/lib/libssl/t1_enc.c | |||
| @@ -819,8 +819,8 @@ tls1_enc(SSL *s, int send) | |||
| 819 | int | 819 | int |
| 820 | tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out) | 820 | tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out) |
| 821 | { | 821 | { |
| 822 | unsigned int ret; | ||
| 823 | EVP_MD_CTX ctx, *d = NULL; | 822 | EVP_MD_CTX ctx, *d = NULL; |
| 823 | unsigned int ret; | ||
| 824 | int i; | 824 | int i; |
| 825 | 825 | ||
| 826 | if (s->s3->handshake_buffer) | 826 | if (s->s3->handshake_buffer) |
| @@ -834,15 +834,17 @@ tls1_cert_verify_mac(SSL *s, int md_nid, unsigned char *out) | |||
| 834 | break; | 834 | break; |
| 835 | } | 835 | } |
| 836 | } | 836 | } |
| 837 | if (!d) { | 837 | if (d == NULL) { |
| 838 | SSLerr(SSL_F_TLS1_CERT_VERIFY_MAC, SSL_R_NO_REQUIRED_DIGEST); | 838 | SSLerr(SSL_F_TLS1_CERT_VERIFY_MAC, SSL_R_NO_REQUIRED_DIGEST); |
| 839 | return 0; | 839 | return 0; |
| 840 | } | 840 | } |
| 841 | 841 | ||
| 842 | EVP_MD_CTX_init(&ctx); | 842 | EVP_MD_CTX_init(&ctx); |
| 843 | EVP_MD_CTX_copy_ex(&ctx, d); | 843 | if (!EVP_MD_CTX_copy_ex(&ctx, d)) |
| 844 | return 0; | ||
| 844 | EVP_DigestFinal_ex(&ctx, out, &ret); | 845 | EVP_DigestFinal_ex(&ctx, out, &ret); |
| 845 | EVP_MD_CTX_cleanup(&ctx); | 846 | EVP_MD_CTX_cleanup(&ctx); |
| 847 | |||
| 846 | return ((int)ret); | 848 | return ((int)ret); |
| 847 | } | 849 | } |
| 848 | 850 | ||
