summaryrefslogtreecommitdiffstats
path: root/crypto/evp/evp_pbe.c
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-05-29 17:16:22 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-06-01 15:28:18 +1000
commit3c15d677054b952c707aeaf781aec42b86a54ebb (patch)
tree8c5ab3b0a701a67ba464358bf157271b303c74ac /crypto/evp/evp_pbe.c
parent9ff4b7b0c7b445bcc9b98fde9107fa9520d17f04 (diff)
Fix error stack for some fetch calls.
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15532)
Diffstat (limited to 'crypto/evp/evp_pbe.c')
-rw-r--r--crypto/evp/evp_pbe.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/evp/evp_pbe.c b/crypto/evp/evp_pbe.c
index 6347a0635f..129888f2f7 100644
--- a/crypto/evp/evp_pbe.c
+++ b/crypto/evp/evp_pbe.c
@@ -117,28 +117,33 @@ int EVP_PBE_CipherInit_ex(ASN1_OBJECT *pbe_obj, const char *pass, int passlen,
passlen = strlen(pass);
if (cipher_nid != -1) {
+ (void)ERR_set_mark();
cipher = cipher_fetch = EVP_CIPHER_fetch(libctx, OBJ_nid2sn(cipher_nid), propq);
/* Fallback to legacy method */
if (cipher == NULL)
cipher = EVP_get_cipherbynid(cipher_nid);
-
if (cipher == NULL) {
+ (void)ERR_clear_last_mark();
ERR_raise_data(ERR_LIB_EVP, EVP_R_UNKNOWN_CIPHER,
OBJ_nid2sn(cipher_nid));
goto err;
}
+ (void)ERR_pop_to_mark();
}
if (md_nid != -1) {
+ (void)ERR_set_mark();
md = md_fetch = EVP_MD_fetch(libctx, OBJ_nid2sn(md_nid), propq);
/* Fallback to legacy method */
if (md == NULL)
EVP_get_digestbynid(md_nid);
if (md == NULL) {
+ (void)ERR_clear_last_mark();
ERR_raise(ERR_LIB_EVP, EVP_R_UNKNOWN_DIGEST);
goto err;
}
+ (void)ERR_pop_to_mark();
}
/* Try extended keygen with libctx/propq first, fall back to legacy keygen */