From 79127a733e8489dfecc0596d03531bebb481a95c Mon Sep 17 00:00:00 2001 From: krishna Date: Thu, 10 Jul 2008 14:32:30 -0700 Subject: 6705398 kernel_get_operationstate() returns CKR_FUNCTION_NOT_SUPPORTED when no operation is active --- .../lib/pkcs11/pkcs11_kernel/common/kernelSession.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'usr/src') diff --git a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSession.c b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSession.c index 956187606c..67967bb223 100644 --- a/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSession.c +++ b/usr/src/lib/pkcs11/pkcs11_kernel/common/kernelSession.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -225,12 +225,21 @@ kernel_get_operationstate(kernel_session_t *session_p, CK_STATE ses_state, CK_BYTE_PTR dst; digest_buf_t *bufp; - /* - * We return CKR_FUNCTION_NOT_SUPPORTED because some clients - * check for this code and work around the lack of this routine. - */ if (!(session_p->digest.flags & CRYPTO_EMULATE)) { - return (CKR_FUNCTION_NOT_SUPPORTED); + /* + * Return CKR_OPERATION_NOT_INITIALIZED if the slot + * is capable of C_GetOperationState(). Return + * CKR_FUNCTION_NOT_SUPPORTED otherwise. + * + * We return these codes because some clients + * check the return code to determine if C_GetOperationState() + * is supported. + */ + if (slot_table[session_p->ses_slotid]->sl_flags & + CRYPTO_LIMITED_HASH_SUPPORT) + return (CKR_OPERATION_NOT_INITIALIZED); + else + return (CKR_FUNCTION_NOT_SUPPORTED); } /* -- cgit v1.2.3