aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-04 09:28:31 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-04 09:28:31 -0800
commit51107451ca10c6b8206fcabfa695928d0d8ca9d3 (patch)
tree5d4a9823742d23df7130b02298156df50981d43f
parent56b3f7f77c588a6d0520a6b7457d9f03115f31ba (diff)
downloadopenssl_tpm2_engine-51107451ca10c6b8206fcabfa695928d0d8ca9d3.tar.gz
e_tpm2: fix spurious error on successful operation
When the engine successfully performs an operation with an older key, we still end up with an apparent error (which can be displayed to the user) about a failed load. This comes from the initial failed attempt to load the new key format and can be fixed by clearing all openssl errors if the old key format load succeeds. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--e_tpm2.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/e_tpm2.c b/e_tpm2.c
index 84af5e5..532db0e 100644
--- a/e_tpm2.c
+++ b/e_tpm2.c
@@ -373,6 +373,8 @@ static int tpm2_engine_load_key_core(ENGINE *e, EVP_PKEY **ppkey,
BIO_seek(bf, 0);
tssl = PEM_read_bio_TSSLOADABLE(bf, NULL, NULL, NULL);
if (tssl) {
+ /* have error from failed TSSPRIVKEY load */
+ ERR_clear_error();
type = tssl->type;
empty_auth = tssl->emptyAuth;
parent = tssl->parent;