File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -75,12 +75,22 @@ impl Pkcs11Impl {
7575 FunctionList :: V3_0 ( l) => l,
7676 }
7777 }
78+ }
79+
80+ /// Main PKCS11 context. Should usually be unique per application.
81+ #[ derive( Debug ) ]
82+ pub struct Pkcs11 {
83+ pub ( crate ) impl_ : Pkcs11Impl ,
84+ initialized : RwLock < bool > ,
85+ }
7886
87+ impl Pkcs11 {
7988 // Private finalize call
8089 #[ inline( always) ]
81- fn finalize ( & self ) -> Result < ( ) > {
90+ fn finalize_ref ( & self ) -> Result < ( ) > {
8291 unsafe {
8392 Rv :: from ( self
93+ . impl_
8494 . get_function_list ( )
8595 . C_Finalize
8696 . ok_or ( Error :: NullFunctionPointer ) ?(
@@ -91,21 +101,14 @@ impl Pkcs11Impl {
91101 }
92102}
93103
94- impl Drop for Pkcs11Impl {
104+ impl Drop for Pkcs11 {
95105 fn drop ( & mut self ) {
96- if let Err ( e) = self . finalize ( ) {
106+ if let Err ( e) = self . finalize_ref ( ) {
97107 error ! ( "Failed to finalize: {}" , e) ;
98108 }
99109 }
100110}
101111
102- /// Main PKCS11 context. Should usually be unique per application.
103- #[ derive( Debug ) ]
104- pub struct Pkcs11 {
105- pub ( crate ) impl_ : Pkcs11Impl ,
106- initialized : RwLock < bool > ,
107- }
108-
109112impl Pkcs11 {
110113 /// Instantiate a new context from the path of a PKCS11 dynamic library implementation.
111114 pub fn new < P > ( filename : P ) -> Result < Self >
You can’t perform that action at this time.
0 commit comments