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,22 ****
--- 9,24 ----
* 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,72 ****
op->paramlen = arg->plen;
op->updatelen = arg->updatelen;
op->mechname = arg->mechname;
! op->hsession = CRYPTO_INVALID_SESSION;
op->fg = fg;
if (op->out == NULL)
op->outlen = op->inlen;
return (op);
--- 64,74 ----
op->paramlen = arg->plen;
op->updatelen = arg->updatelen;
op->mechname = arg->mechname;
! op->hsession = CK_INVALID_HANDLE;
op->fg = fg;
if (op->out == NULL)
op->outlen = op->inlen;
return (op);
*** 85,95 ****
int
cryptotest_close(crypto_op_t *op)
{
(void) C_DestroyObject(op->hsession, op->keyt);
! if (op->hsession != CRYPTO_INVALID_SESSION)
(void) cryptotest_close_session(op->hsession);
free(op);
return (C_Finalize(NULL));
}
--- 87,97 ----
int
cryptotest_close(crypto_op_t *op)
{
(void) C_DestroyObject(op->hsession, op->keyt);
! if (op->hsession != CK_INVALID_HANDLE)
(void) cryptotest_close_session(op->hsession);
free(op);
return (C_Finalize(NULL));
}