Print this page
9643 PKCS#11 tests should not use CRYPTO_INVALID_SESSION
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Dan McDonald <danmcd@joyent.com>

@@ -9,14 +9,16 @@
  * http://www.illumos.org/license/CDDL.
  */
 
 /*
  * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2018, Joyent, Inc.
  */
 
 #include <stdio.h>
 #include <cryptoutil.h>
+#include <security/cryptoki.h>
 
 #include "cryptotest.h"
 
 struct crypto_op {
         CK_BYTE_PTR in;

@@ -62,11 +64,11 @@
         op->paramlen = arg->plen;
         op->updatelen = arg->updatelen;
 
         op->mechname = arg->mechname;
 
-        op->hsession = CRYPTO_INVALID_SESSION;
+        op->hsession = CK_INVALID_HANDLE;
         op->fg = fg;
 
         if (op->out == NULL)
                 op->outlen = op->inlen;
         return (op);

@@ -85,11 +87,11 @@
 
 int
 cryptotest_close(crypto_op_t *op)
 {
         (void) C_DestroyObject(op->hsession, op->keyt);
-        if (op->hsession != CRYPTO_INVALID_SESSION)
+        if (op->hsession != CK_INVALID_HANDLE)
                 (void) cryptotest_close_session(op->hsession);
         free(op);
         return (C_Finalize(NULL));
 }