diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2020-11-26 08:35:26 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-03-04 08:54:09 +0100 |
commit | 39a61e69b88252dca8aa7d61146b0b2397d1710c (patch) | |
tree | 7e5137a219778990498fd3c1aa20610ce82c9e07 /providers | |
parent | e3a2ba75474eebffe14b4bab1a34a1c2012a3888 (diff) |
OSSL_STORE: restore diagnostics on decrypt error; provide password hints
Fixes #13493
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13525)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/encode_decode/decode_der2key.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/providers/implementations/encode_decode/decode_der2key.c b/providers/implementations/encode_decode/decode_der2key.c index 09601fc335..c8a467fb5b 100644 --- a/providers/implementations/encode_decode/decode_der2key.c +++ b/providers/implementations/encode_decode/decode_der2key.c @@ -260,6 +260,7 @@ static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, EVP_PKEY *pkey = NULL; void *key = NULL; int orig_selection = selection; + int dec_err; int ok = 0; /* @@ -319,8 +320,13 @@ static int der2key_decode(void *vctx, OSSL_CORE_BIO *cin, int selection, der = new_der; der_len = new_der_len; } - RESET_ERR_MARK(); + /* decryption errors are fatal and should be reported */ + dec_err = ERR_peek_last_error(); + if (ERR_GET_LIB(dec_err) == ERR_LIB_PROV + && ERR_GET_REASON(dec_err) == PROV_R_BAD_DECRYPT) + goto end; + RESET_ERR_MARK(); if ((selection & OSSL_KEYMGMT_SELECT_PRIVATE_KEY) != 0) { derp = der; pkey = evp_privatekey_from_binary(ctx->desc->evp_type, NULL, |