diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-05-20 03:18:32 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-05-30 20:38:19 +0100 |
commit | 7dd6de9fddf41db98647925b9fbbc162370b385b (patch) | |
tree | e72b0cac7e51cd49067046270f85c2e1ff1bbda0 /crypto/asn1/a_sign.c | |
parent | f723c98e2d6d932e4cb95b3ac0e398bdbe61ee98 (diff) |
Allow NULL md for custom signing methods
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3503)
Diffstat (limited to 'crypto/asn1/a_sign.c')
-rw-r--r-- | crypto/asn1/a_sign.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/asn1/a_sign.c b/crypto/asn1/a_sign.c index 4e93b5a768..5683cbbe83 100644 --- a/crypto/asn1/a_sign.c +++ b/crypto/asn1/a_sign.c @@ -147,7 +147,7 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, type = EVP_MD_CTX_md(ctx); pkey = EVP_PKEY_CTX_get0_pkey(EVP_MD_CTX_pkey_ctx(ctx)); - if (type == NULL || pkey == NULL) { + if (pkey == NULL) { ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ASN1_R_CONTEXT_NOT_INITIALISED); goto err; } @@ -172,10 +172,15 @@ int ASN1_item_sign_ctx(const ASN1_ITEM *it, ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ERR_R_EVP_LIB); if (rv <= 1) goto err; - } else + } else { rv = 2; + } if (rv == 2) { + if (type == NULL) { + ASN1err(ASN1_F_ASN1_ITEM_SIGN_CTX, ASN1_R_CONTEXT_NOT_INITIALISED); + goto err; + } if (!OBJ_find_sigid_by_algs(&signid, EVP_MD_nid(type), pkey->ameth->pkey_id)) { |