diff options
author | Yuri Penkin <yura.penkin@gmail.com> | 2023-05-23 23:32:23 +0300 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2023-06-01 09:50:28 +0200 |
commit | dc4ccc70245be870e2ef2e382d16234673bf28cf (patch) | |
tree | c2ae956317345345c51f160fcc0f2a9443bf468a /crypto/pkcs12/p12_mutl.c | |
parent | d477484d33b7b3572150e21562cf4209c8dd9ef5 (diff) |
Ignore the fetch error when a legacy algorithm is found
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/21035)
(cherry picked from commit cb1f87f59d0b290eca9207ec4ef36d8073e6feec)
Diffstat (limited to 'crypto/pkcs12/p12_mutl.c')
-rw-r--r-- | crypto/pkcs12/p12_mutl.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c index 9497a5ce61..d20b9db9ff 100644 --- a/crypto/pkcs12/p12_mutl.c +++ b/crypto/pkcs12/p12_mutl.c @@ -108,15 +108,20 @@ static int pkcs12_gen_mac(PKCS12 *p12, const char *pass, int passlen, X509_ALGOR_get0(&macoid, NULL, NULL, macalg); if (OBJ_obj2txt(md_name, sizeof(md_name), macoid, 0) < 0) return 0; + + (void)ERR_set_mark(); md = md_fetch = EVP_MD_fetch(p12->authsafes->ctx.libctx, md_name, p12->authsafes->ctx.propq); if (md == NULL) md = EVP_get_digestbynid(OBJ_obj2nid(macoid)); if (md == NULL) { + (void)ERR_clear_last_mark(); ERR_raise(ERR_LIB_PKCS12, PKCS12_R_UNKNOWN_DIGEST_ALGORITHM); return 0; } + (void)ERR_pop_to_mark(); + md_size = EVP_MD_get_size(md); md_nid = EVP_MD_get_type(md); if (md_size < 0) |