diff options
author | Rob Austein <sra@hactrn.net> | 2015-07-17 23:48:55 +0200 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2015-07-17 23:48:55 +0200 |
commit | 60a46afc01b73e763251370642cf61b15ba067d0 (patch) | |
tree | 8d3ab5a7250c16ac88b2cdeb054a1a41d1fe4474 | |
parent | 4786afd48cc19533b4232bca2519ec6ad2853e5c (diff) |
Add C_GetSessionInfo().
-rw-r--r-- | pkcs11.c | 40 |
1 files changed, 33 insertions, 7 deletions
@@ -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) |