summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2021-11-12 16:31:35 +0100
committerTomas Mraz <tomas@openssl.org>2021-11-15 09:26:03 +0100
commitcf9a84a12dc4f3b314347e44f5c51b473a504926 (patch)
treecafb60e7cbe10d6f6bd0ab8f284cbcb992907a99 /crypto/evp
parent487934081d87a0d02bbb9afd6bd650d5d1afe8ea (diff)
Add null digest implementation to the default provider
This is necessary to keep compatibility with 1.1.1. Fixes #16660 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17016) (cherry picked from commit bef9b48e5071cdd2b41a4f486d1bcb5e14b2a5c3)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/digest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 1f2910bc69..a269bb8260 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -228,7 +228,10 @@ static int evp_md_init_internal(EVP_MD_CTX *ctx, const EVP_MD *type,
ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);
return 0;
#else
- EVP_MD *provmd = EVP_MD_fetch(NULL, OBJ_nid2sn(type->type), "");
+ /* The NULL digest is a special case */
+ EVP_MD *provmd = EVP_MD_fetch(NULL,
+ type->type != NID_undef ? OBJ_nid2sn(type->type)
+ : "NULL", "");
if (provmd == NULL) {
ERR_raise(ERR_LIB_EVP, EVP_R_INITIALIZATION_ERROR);