aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-12 14:23:46 -0800
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2019-01-12 14:23:46 -0800
commit95dea1d7efea2a3eee473158c824275f9e07915e (patch)
tree245cb009ebfd759624f83df3385559dca3685511
parent51107451ca10c6b8206fcabfa695928d0d8ca9d3 (diff)
downloadopenssl_tpm2_engine-95dea1d7efea2a3eee473158c824275f9e07915e.tar.gz
e_tpm2: fix intermittent segfault with importable keys
The written parameter on the import unmarshal isn't set meaning it contains a bogus value. Occasionally this value causes a segfault, so fix by setting the value to 0. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--e_tpm2.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/e_tpm2.c b/e_tpm2.c
index 532db0e..167c3bf 100644
--- a/e_tpm2.c
+++ b/e_tpm2.c
@@ -517,6 +517,7 @@ static int tpm2_engine_load_key_core(ENGINE *e, EVP_PKEY **ppkey,
}
buf = priv_2b.t.buffer;
size = sizeof(priv_2b.t.buffer);
+ written = 0;
TSS_TPM2B_PRIVATE_Marshal(&iout.outPrivate, &written,
&buf, &size);
app_data->priv = OPENSSL_malloc(written);