aboutsummaryrefslogtreecommitdiff
path: root/pkcs11.c
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2015-07-17 23:48:55 +0200
committerRob Austein <sra@hactrn.net>2015-07-17 23:48:55 +0200
commit60a46afc01b73e763251370642cf61b15ba067d0 (patch)
tree8d3ab5a7250c16ac88b2cdeb054a1a41d1fe4474 /pkcs11.c
parent4786afd48cc19533b4232bca2519ec6ad2853e5c (diff)
Add C_GetSessionInfo().
Diffstat (limited to 'pkcs11.c')
-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)