aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pkcs11.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/pkcs11.c b/pkcs11.c
index 2cf704f..318055e 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -3501,6 +3501,39 @@ CK_RV C_GetMechanismInfo(CK_SLOT_ID slotID,
return CKR_OK;
}
+CK_RV C_GetSessionInfo(CK_SESSION_HANDLE hSession,
+ CK_SESSION_INFO_PTR pInfo)
+{
+ ENTER_PUBLIC_FUNCTION(C_GetSessionInfo);
+
+ p11_session_t *session;
+ CK_RV rv = CKR_OK;
+
+ mutex_lock_or_return_failure(p11_global_mutex);
+
+ if (pInfo == NULL)
+ lose(CKR_ARGUMENTS_BAD);
+
+ if ((session = p11_session_find(hSession)) == NULL)
+ lose(CKR_SESSION_HANDLE_INVALID);
+
+ pInfo->slotID = P11_ONE_AND_ONLY_SLOT;
+ pInfo->state = session->state;
+ pInfo->flags = CKF_SERIAL_SESSION;
+ pInfo->ulDeviceError = 0;
+
+ switch (session->state) {
+ case CKS_RW_PUBLIC_SESSION:
+ case CKS_RW_SO_FUNCTIONS:
+ case CKS_RW_USER_FUNCTIONS:
+ pInfo->flags |= CKF_RW_SESSION;
+ default:
+ break;
+ }
+
+ fail:
+ mutex_unlock_return_with_rv(rv, p11_global_mutex);
+}
@@ -3575,13 +3608,6 @@ CK_RV C_SetPIN(CK_SESSION_HANDLE hSession,
return CKR_FUNCTION_NOT_SUPPORTED;
}
-CK_RV C_GetSessionInfo(CK_SESSION_HANDLE hSession,
- CK_SESSION_INFO_PTR pInfo)
-{
- ENTER_PUBLIC_FUNCTION(C_GetSessionInfo);
- return CKR_FUNCTION_NOT_SUPPORTED;
-}
-
CK_RV C_GetOperationState(CK_SESSION_HANDLE hSession,
CK_BYTE_PTR pOperationState,
CK_ULONG_PTR pulOperationStateLen)