diff options
Diffstat (limited to 'p11-kit')
-rw-r--r-- | p11-kit/util.c | 5 | ||||
-rw-r--r-- | p11-kit/virtual-fixed.h | 3 | ||||
-rw-r--r-- | p11-kit/virtual.c | 27 |
3 files changed, 5 insertions, 30 deletions
diff --git a/p11-kit/util.c b/p11-kit/util.c index e51223e..325d669 100644 --- a/p11-kit/util.c +++ b/p11-kit/util.c @@ -45,7 +45,6 @@ #include "p11-kit.h" #include "private.h" #include "proxy.h" -#include "virtual-fixed.h" #include <assert.h> #include <stdarg.h> @@ -252,7 +251,6 @@ void _p11_kit_init (void) { p11_library_init_once (); - p11_virtual_fixed_init (); } #ifdef __GNUC__ @@ -262,7 +260,6 @@ void _p11_kit_fini (void) { p11_proxy_module_cleanup (); - p11_virtual_fixed_uninit (); p11_library_uninit (); } @@ -280,14 +277,12 @@ DllMain (HINSTANCE instance, switch (reason) { case DLL_PROCESS_ATTACH: p11_library_init (); - p11_virtual_fixed_init (); break; case DLL_THREAD_DETACH: p11_library_thread_cleanup (); break; case DLL_PROCESS_DETACH: p11_proxy_module_cleanup (); - p11_virtual_fixed_uninit (); p11_library_uninit (); break; default: diff --git a/p11-kit/virtual-fixed.h b/p11-kit/virtual-fixed.h index cc3b2c0..1357522 100644 --- a/p11-kit/virtual-fixed.h +++ b/p11-kit/virtual-fixed.h @@ -1138,7 +1138,4 @@ fixed ## fixed_index ## _C_GetFunctionList (CK_FUNCTION_LIST_PTR_PTR list) \ fixed ## fixed_index ## _C_WaitForSlotEvent \ } -void p11_virtual_fixed_init (void); -void p11_virtual_fixed_uninit (void); - #endif /* __P11_VIRTUAL_FIXED_H__ */ diff --git a/p11-kit/virtual.c b/p11-kit/virtual.c index b066b4b..a2853bb 100644 --- a/p11-kit/virtual.c +++ b/p11-kit/virtual.c @@ -88,7 +88,6 @@ typedef struct { int fixed_index; } Wrapper; -static p11_mutex_t fixed_mutex; static CK_FUNCTION_LIST *fixed_closures[P11_VIRTUAL_MAX_FIXED]; static Wrapper *create_fixed_wrapper (p11_virtual *virt, @@ -101,23 +100,6 @@ static void p11_virtual_unwrap_fixed (CK_FUNCTION_LIST_PTR module); -void -p11_virtual_fixed_init (void) -{ - p11_lock (); - p11_mutex_init (&fixed_mutex); - memset (fixed_closures, 0, sizeof (fixed_closures)); - p11_unlock (); -} - -void -p11_virtual_fixed_uninit (void) -{ - p11_lock (); - p11_mutex_uninit (&fixed_mutex); - p11_unlock (); -} - static CK_RV short_C_GetFunctionStatus (CK_SESSION_HANDLE handle) { @@ -2860,6 +2842,7 @@ p11_virtual_wrap (p11_virtual *virt, wrapper->destroyer = destroyer; wrapper->bound.version.major = CRYPTOKI_VERSION_MAJOR; wrapper->bound.version.minor = CRYPTOKI_VERSION_MINOR; + wrapper->fixed_index = -1; if (!init_wrapper_funcs (wrapper)) return p11_virtual_wrap_fixed (virt, destroyer); @@ -3266,7 +3249,7 @@ p11_virtual_wrap_fixed (p11_virtual *virt, CK_FUNCTION_LIST *result = NULL; size_t i; - p11_mutex_lock (&fixed_mutex); + p11_mutex_lock (&p11_virtual_mutex); for (i = 0; i < P11_VIRTUAL_MAX_FIXED; i++) { if (fixed_closures[i] == NULL) { Wrapper *wrapper; @@ -3276,7 +3259,7 @@ p11_virtual_wrap_fixed (p11_virtual *virt, break; } } - p11_mutex_unlock (&fixed_mutex); + p11_mutex_unlock (&p11_virtual_mutex); return result; } @@ -3286,14 +3269,14 @@ p11_virtual_unwrap_fixed (CK_FUNCTION_LIST_PTR module) { size_t i; - p11_mutex_lock (&fixed_mutex); + p11_mutex_lock (&p11_virtual_mutex); for (i = 0; i < P11_VIRTUAL_MAX_FIXED; i++) { if (fixed_closures[i] == module) { fixed_closures[i] = NULL; break; } } - p11_mutex_unlock (&fixed_mutex); + p11_mutex_unlock (&p11_virtual_mutex); } static bool |