mirror of
https://abf.rosa.ru/djam/libressl.git
synced 2025-02-23 08:02:54 +00:00
49 lines
1.4 KiB
Diff
49 lines
1.4 KiB
Diff
From 9793963c8430257904121816af0125b7607582c7 Mon Sep 17 00:00:00 2001
|
|
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
|
|
Date: Tue, 31 Mar 2020 21:22:19 +0300
|
|
Subject: [PATCH 75/87] evp: fix EVP_MD_CTX_copy_ex for CMAC contexts
|
|
|
|
EVP_MD_CTX created for EVP_PKEY_CMAC will not have ctx->digest even when
|
|
fully initialized. Support copying of such contexts.
|
|
|
|
Sponsored by ROSA Linux
|
|
|
|
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
|
|
---
|
|
src/lib/libcrypto/evp/digest.c | 6 +++---
|
|
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
|
|
diff --git a/src/lib/libcrypto/evp/digest.c b/src/lib/libcrypto/evp/digest.c
|
|
index 4cd3565c6..15192a813 100644
|
|
--- a/src/lib/libcrypto/evp/digest.c
|
|
+++ b/src/lib/libcrypto/evp/digest.c
|
|
@@ -260,7 +260,7 @@ EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
|
{
|
|
unsigned char *tmp_buf;
|
|
|
|
- if ((in == NULL) || (in->digest == NULL)) {
|
|
+ if (in == NULL) {
|
|
EVPerror(EVP_R_INPUT_NOT_INITIALIZED);
|
|
return 0;
|
|
}
|
|
@@ -280,7 +280,7 @@ EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
|
EVP_MD_CTX_cleanup(out);
|
|
memcpy(out, in, sizeof *out);
|
|
|
|
- if (in->md_data && out->digest->ctx_size) {
|
|
+ if (in->md_data && out->digest && out->digest->ctx_size) {
|
|
if (tmp_buf) {
|
|
out->md_data = tmp_buf;
|
|
} else {
|
|
@@ -303,7 +303,7 @@ EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
|
|
}
|
|
}
|
|
|
|
- if (out->digest->copy)
|
|
+ if (out->digest && out->digest->copy)
|
|
return out->digest->copy(out, in);
|
|
|
|
return 1;
|
|
--
|
|
2.17.1
|
|
|