summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason King <jason.king@joyent.com>2018-10-01 16:46:55 -0500
committerJason King <jason.king@joyent.com>2018-10-12 10:04:03 -0500
commit789cf136e86bd7243b6ffd90333a23ba74b898e3 (patch)
treeef380ba31124702d25b8702f74c505b55028b34a
parent442caaa4b1a9f5a199a4b98f5c94c928e42890db (diff)
downloadillumos-joyent-789cf136e86bd7243b6ffd90333a23ba74b898e3.tar.gz
OS-7274 PKCS#11 key handle uninitialized in crypto tests
Reviewed by: Dan McDonald <danmcd@joyent.com> Approved by: John Levon <john.levon@joyent.com>
-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 e28d00e759..eed7454382 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, crypto_func_group_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);