diff options
| author | jsing <> | 2014-06-10 11:40:22 +0000 |
|---|---|---|
| committer | jsing <> | 2014-06-10 11:40:22 +0000 |
| commit | b8df1e4e560c0a6617381608d5cdc2cb018ec631 (patch) | |
| tree | 530cd52603b6af5c3e22b15811390dd5b480011f | |
| parent | d4b2cc6d6b91fce1c1cd2743e4a702d429fae542 (diff) | |
| download | openbsd-b8df1e4e560c0a6617381608d5cdc2cb018ec631.tar.gz openbsd-b8df1e4e560c0a6617381608d5cdc2cb018ec631.tar.bz2 openbsd-b8df1e4e560c0a6617381608d5cdc2cb018ec631.zip | |
Avoid potential NULL pointer function calls in n_ssl3_mac() by checking
the return value of EVP_MD_CTX_copy_ex(). If the copy fails early then
EVP_DigestUpdate() will invoke md_ctx.update(), which will be a NULL
function pointer.
Analysis and patch from David Ramos.
ok deraadt@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libssl/src/ssl/s3_enc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libssl/src/ssl/s3_enc.c b/src/lib/libssl/src/ssl/s3_enc.c index f4ac5222f3..13ba633f49 100644 --- a/src/lib/libssl/src/ssl/s3_enc.c +++ b/src/lib/libssl/src/ssl/s3_enc.c | |||
| @@ -762,7 +762,8 @@ n_ssl3_mac(SSL *ssl, unsigned char *md, int send) | |||
| 762 | /* Chop the digest off the end :-) */ | 762 | /* Chop the digest off the end :-) */ |
| 763 | EVP_MD_CTX_init(&md_ctx); | 763 | EVP_MD_CTX_init(&md_ctx); |
| 764 | 764 | ||
| 765 | EVP_MD_CTX_copy_ex(&md_ctx, hash); | 765 | if (!EVP_MD_CTX_copy_ex(&md_ctx, hash)) |
| 766 | return (-1); | ||
| 766 | EVP_DigestUpdate(&md_ctx, mac_sec, md_size); | 767 | EVP_DigestUpdate(&md_ctx, mac_sec, md_size); |
| 767 | EVP_DigestUpdate(&md_ctx, ssl3_pad_1, npad); | 768 | EVP_DigestUpdate(&md_ctx, ssl3_pad_1, npad); |
| 768 | EVP_DigestUpdate(&md_ctx, seq, 8); | 769 | EVP_DigestUpdate(&md_ctx, seq, 8); |
| @@ -774,7 +775,8 @@ n_ssl3_mac(SSL *ssl, unsigned char *md, int send) | |||
| 774 | EVP_DigestUpdate(&md_ctx, rec->input, rec->length); | 775 | EVP_DigestUpdate(&md_ctx, rec->input, rec->length); |
| 775 | EVP_DigestFinal_ex(&md_ctx, md, NULL); | 776 | EVP_DigestFinal_ex(&md_ctx, md, NULL); |
| 776 | 777 | ||
| 777 | EVP_MD_CTX_copy_ex(&md_ctx, hash); | 778 | if (!EVP_MD_CTX_copy_ex(&md_ctx, hash)) |
| 779 | return (-1); | ||
| 778 | EVP_DigestUpdate(&md_ctx, mac_sec, md_size); | 780 | EVP_DigestUpdate(&md_ctx, mac_sec, md_size); |
| 779 | EVP_DigestUpdate(&md_ctx, ssl3_pad_2, npad); | 781 | EVP_DigestUpdate(&md_ctx, ssl3_pad_2, npad); |
| 780 | EVP_DigestUpdate(&md_ctx, md, md_size); | 782 | EVP_DigestUpdate(&md_ctx, md, md_size); |
