@@ -32,7 +32,6 @@ use crate::error::{Error, Result, Rv};
32
32
33
33
use log:: error;
34
34
use std:: fmt;
35
- use std:: mem;
36
35
use std:: path:: Path ;
37
36
use std:: ptr;
38
37
use std:: sync:: Arc ;
@@ -135,18 +134,17 @@ impl Pkcs11 {
135
134
unsafe fn _new ( pkcs11_lib : cryptoki_sys:: Pkcs11 ) -> Result < Self > {
136
135
/* First try the 3.0 API to get default interface. It might have some more functions than
137
136
* the 2.4 API */
138
- let mut interface = mem :: MaybeUninit :: uninit ( ) ;
137
+ let mut interface: * mut cryptoki_sys :: CK_INTERFACE = ptr :: null_mut ( ) ;
139
138
if pkcs11_lib. C_GetInterface . is_ok ( ) {
140
139
Rv :: from ( pkcs11_lib. C_GetInterface (
141
140
ptr:: null_mut ( ) ,
142
141
ptr:: null_mut ( ) ,
143
- interface. as_mut_ptr ( ) ,
142
+ & mut interface,
144
143
0 ,
145
144
) )
146
145
. into_result ( Function :: GetInterface ) ?;
147
- if !interface. as_ptr ( ) . is_null ( ) {
148
- let ifce_ptr: * mut cryptoki_sys:: CK_INTERFACE = * interface. as_ptr ( ) ;
149
- let ifce: cryptoki_sys:: CK_INTERFACE = * ifce_ptr;
146
+ if !interface. is_null ( ) {
147
+ let ifce: cryptoki_sys:: CK_INTERFACE = * interface;
150
148
151
149
let list_ptr: * mut cryptoki_sys:: CK_FUNCTION_LIST =
152
150
ifce. pFunctionList as * mut cryptoki_sys:: CK_FUNCTION_LIST ;
@@ -166,13 +164,10 @@ impl Pkcs11 {
166
164
}
167
165
}
168
166
169
- let mut list = mem:: MaybeUninit :: uninit ( ) ;
170
-
171
- Rv :: from ( pkcs11_lib. C_GetFunctionList ( list. as_mut_ptr ( ) ) )
167
+ let mut list_ptr: * mut cryptoki_sys:: CK_FUNCTION_LIST = ptr:: null_mut ( ) ;
168
+ Rv :: from ( pkcs11_lib. C_GetFunctionList ( & mut list_ptr) )
172
169
. into_result ( Function :: GetFunctionList ) ?;
173
170
174
- let list_ptr = * list. as_ptr ( ) ;
175
-
176
171
Ok ( Pkcs11 {
177
172
impl_ : Arc :: new ( Pkcs11Impl {
178
173
_pkcs11_lib : pkcs11_lib,
0 commit comments