summaryrefslogtreecommitdiff
path: root/usr/src/test/crypto-tests
diff options
context:
space:
mode:
authorJason King <jason.king@joyent.com>2018-10-01 16:46:55 -0500
committerHans Rosenfeld <hans.rosenfeld@joyent.com>2018-11-09 11:32:03 +0100
commiteed3be881cd8e53fe7187245b289da7106712dea (patch)
treee8224aae38858e11f3afaed936d65a9d67323891 /usr/src/test/crypto-tests
parent0c3d39e1b503beb46fe27b646084d5e30ec0aa0a (diff)
downloadillumos-joyent-eed3be881cd8e53fe7187245b289da7106712dea.tar.gz
9948 PKCS#11 key handle uninitialized in crypto tests
Reviewed by: Dan McDonald <danmcd@joyent.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
Diffstat (limited to 'usr/src/test/crypto-tests')
-rw-r--r--usr/src/test/crypto-tests/tests/common/cryptotest_pkcs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr/src/test/crypto-tests/tests/common/cryptotest_pkcs.c b/usr/src/test/crypto-tests/tests/common/cryptotest_pkcs.c
index 20f80507b0..e6964414c1 100644
--- a/usr/src/test/crypto-tests/tests/common/cryptotest_pkcs.c
+++ b/usr/src/test/crypto-tests/tests/common/cryptotest_pkcs.c
@@ -67,6 +67,7 @@ cryptotest_init(cryptotest_t *arg, size_t fg)
op->mechname = arg->mechname;
op->hsession = CK_INVALID_HANDLE;
+ op->keyt = CK_INVALID_HANDLE;
op->fg = fg;
if (op->out == NULL)
@@ -88,7 +89,9 @@ cryptotest_close_session(CK_SESSION_HANDLE hsession)
int
cryptotest_close(crypto_op_t *op)
{
- (void) C_DestroyObject(op->hsession, op->keyt);
+ if (op->keyt != CK_INVALID_HANDLE)
+ (void) C_DestroyObject(op->hsession, op->keyt);
+
if (op->hsession != CK_INVALID_HANDLE)
(void) cryptotest_close_session(op->hsession);
free(op);