diff options
Diffstat (limited to 'py11')
-rw-r--r-- | py11/__init__.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/py11/__init__.py b/py11/__init__.py index d800ab7..ec51d19 100644 --- a/py11/__init__.py +++ b/py11/__init__.py @@ -83,10 +83,10 @@ class PKCS11 (object): self._C_Initialize_args = None self.so.C_Initialize(None) else: - create_mutex = cast(None, CK_CREATEMUTEX) if create_mutex is None else CK_CREATEMUTEX(create_mutex) - destroy_mutex = cast(None, CK_DESTROYMUTEX) if destroy_mutex is None else CK_DESTROYMUTEX(destroy_mutex) - lock_mutex = cast(None, CK_LOCKMUTEX) if lock_mutex is None else CK_LOCKMUTEX(lock_mutex) - unlock_mutex = cast(None, CK_UNLOCKMUTEX) if unlock_mutex is None else CK_UNLOCKMUTEX(unlock_mutex) + create_mutex = CK_CREATEMUTEX() if create_mutex is None else CK_CREATEMUTEX(create_mutex) + destroy_mutex = CK_DESTROYMUTEX() if destroy_mutex is None else CK_DESTROYMUTEX(destroy_mutex) + lock_mutex = CK_LOCKMUTEX() if lock_mutex is None else CK_LOCKMUTEX(lock_mutex) + unlock_mutex = CK_UNLOCKMUTEX() if unlock_mutex is None else CK_UNLOCKMUTEX(unlock_mutex) self._C_Initialize_args = CK_C_INITIALIZE_ARGS(create_mutex, destroy_mutex, lock_mutex, unlock_mutex, flags, None) self.so.C_Initialize(cast(byref(self._C_Initialize_args), CK_VOID_PTR)) @@ -105,7 +105,8 @@ class PKCS11 (object): self.so.C_GetTokenInfo(slot_id, byref(token_info)) return token_info - def C_OpenSession(self, slot, flags = CKF_SERIAL_SESSION | CKF_RW_SESSION, application = None, notify = CK_NOTIFY()): + def C_OpenSession(self, slot, flags = CKF_RW_SESSION, application = None, notify = CK_NOTIFY()): + flags |= CKF_SERIAL_SESSION handle = CK_SESSION_HANDLE() self.so.C_OpenSession(slot, flags, application, notify, byref(handle)) return handle.value |