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 {
75
75
FunctionList :: V3_0 ( l) => l,
76
76
}
77
77
}
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
+ }
78
86
87
+ impl Pkcs11 {
79
88
// Private finalize call
80
89
#[ inline( always) ]
81
- fn finalize ( & self ) -> Result < ( ) > {
90
+ fn finalize_ref ( & self ) -> Result < ( ) > {
82
91
unsafe {
83
92
Rv :: from ( self
93
+ . impl_
84
94
. get_function_list ( )
85
95
. C_Finalize
86
96
. ok_or ( Error :: NullFunctionPointer ) ?(
@@ -91,21 +101,14 @@ impl Pkcs11Impl {
91
101
}
92
102
}
93
103
94
- impl Drop for Pkcs11Impl {
104
+ impl Drop for Pkcs11 {
95
105
fn drop ( & mut self ) {
96
- if let Err ( e) = self . finalize ( ) {
106
+ if let Err ( e) = self . finalize_ref ( ) {
97
107
error ! ( "Failed to finalize: {}" , e) ;
98
108
}
99
109
}
100
110
}
101
111
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
-
109
112
impl Pkcs11 {
110
113
/// Instantiate a new context from the path of a PKCS11 dynamic library implementation.
111
114
pub fn new < P > ( filename : P ) -> Result < Self >
You can’t perform that action at this time.
0 commit comments