From f723a3b05eb960a2c0e4fe5e86c8dde91a425acf Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Mon, 21 Sep 2015 16:40:34 -0400 Subject: Unit tests for init, session, and login functions. --- py11/__init__.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'py11') 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 -- cgit v1.2.3