Skip to content

Commit 9b6e4d7

Browse files
committedDec 8, 2021
Fix SIGSEGV upon pkcs11.open_session_no_callbac
parallaxsecond#72 Signed-off-by: Hanson Char <[email protected]>
1 parent 1eb4b10 commit 9b6e4d7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎cryptoki-sys/src/bindings/x86_64-unknown-linux-gnu.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -2891,6 +2891,7 @@ pub type CK_DES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut ck_des_cbc_encrypt_data_param
28912891
pub type CK_AES_CBC_ENCRYPT_DATA_PARAMS = ck_aes_cbc_encrypt_data_params;
28922892
pub type CK_AES_CBC_ENCRYPT_DATA_PARAMS_PTR = *mut ck_aes_cbc_encrypt_data_params;
28932893
extern crate libloading;
2894+
use libloading::os::unix::RTLD_NOW;
28942895
pub struct Pkcs11 {
28952896
__library: ::libloading::Library,
28962897
pub C_GetFunctionList: Result<
@@ -2903,7 +2904,10 @@ impl Pkcs11 {
29032904
where
29042905
P: AsRef<::std::ffi::OsStr>,
29052906
{
2906-
let library = ::libloading::Library::new(path)?;
2907+
// https://github.com/parallaxsecond/rust-cryptoki/issues/72
2908+
let RTLD_NODELETE = 0x1000;
2909+
let os_lib = libloading::os::unix::Library::open(Some(path), RTLD_NOW | RTLD_NODELETE)?;
2910+
let library = libloading::Library::from(os_lib);
29072911
Self::from_library(library)
29082912
}
29092913
pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>

0 commit comments

Comments
 (0)
Please sign in to comment.