@@ -32,7 +32,6 @@ use crate::error::{Error, Result, Rv};
3232
3333use log:: error;
3434use std:: fmt;
35- use std:: mem;
3635use std:: path:: Path ;
3736use std:: ptr;
3837use std:: sync:: Arc ;
@@ -135,18 +134,17 @@ impl Pkcs11 {
135134 unsafe fn _new ( pkcs11_lib : cryptoki_sys:: Pkcs11 ) -> Result < Self > {
136135 /* First try the 3.0 API to get default interface. It might have some more functions than
137136 * the 2.4 API */
138- let mut interface = mem :: MaybeUninit :: uninit ( ) ;
137+ let mut interface: * mut cryptoki_sys :: CK_INTERFACE = ptr :: null_mut ( ) ;
139138 if pkcs11_lib. C_GetInterface . is_ok ( ) {
140139 Rv :: from ( pkcs11_lib. C_GetInterface (
141140 ptr:: null_mut ( ) ,
142141 ptr:: null_mut ( ) ,
143- interface. as_mut_ptr ( ) ,
142+ & mut interface,
144143 0 ,
145144 ) )
146145 . 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;
150148
151149 let list_ptr: * mut cryptoki_sys:: CK_FUNCTION_LIST =
152150 ifce. pFunctionList as * mut cryptoki_sys:: CK_FUNCTION_LIST ;
@@ -166,13 +164,10 @@ impl Pkcs11 {
166164 }
167165 }
168166
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) )
172169 . into_result ( Function :: GetFunctionList ) ?;
173170
174- let list_ptr = * list. as_ptr ( ) ;
175-
176171 Ok ( Pkcs11 {
177172 impl_ : Arc :: new ( Pkcs11Impl {
178173 _pkcs11_lib : pkcs11_lib,
0 commit comments