diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-05-19 18:16:21 +0200 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-05-21 10:03:07 +1000 |
commit | 8a709c5e4b5a6b91ebf5001a94ed80ab20f05472 (patch) | |
tree | 6f1f4ffe54c0b10bcba79e2e231598f1bb6b711b /crypto/pem/pem_pkey.c | |
parent | 2ed0a45a65b0df10648a4c11d365e2e1ebb1e697 (diff) |
pem_read_bio_key_legacy: Do not obscure real error if there is one
Fixes #15170
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15355)
Diffstat (limited to 'crypto/pem/pem_pkey.c')
-rw-r--r-- | crypto/pem/pem_pkey.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c index 3f0a9e4fef..adbf8bcfe7 100644 --- a/crypto/pem/pem_pkey.c +++ b/crypto/pem/pem_pkey.c @@ -171,7 +171,8 @@ static EVP_PKEY *pem_read_bio_key_legacy(BIO *bp, EVP_PKEY **x, } p8err: - if (ret == NULL) + if (ret == NULL && ERR_peek_last_error() == 0) + /* ensure some error is reported but do not hide the real one */ ERR_raise(ERR_LIB_PEM, ERR_R_ASN1_LIB); err: OPENSSL_secure_free(nm); |