Loading openssl/src/dsa.rs +1 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,7 @@ mod test { Dsa::private_key_from_pem_callback(key, |password| { password_queried = true; password[..6].copy_from_slice(b"mypass"); 6 Ok(6) }) .unwrap(); Loading openssl/src/macros.rs +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ macro_rules! private_key_from_pem { pub fn private_key_from_pem_callback<F>(pem: &[u8], callback: F) -> Result<$t, ::error::ErrorStack> where F: FnOnce(&mut [u8]) -> usize where F: FnOnce(&mut [u8]) -> Result<usize, ::error::ErrorStack> { unsafe { ffi::init(); Loading openssl/src/rsa.rs +1 −1 Original line number Diff line number Diff line Loading @@ -421,7 +421,7 @@ mod test { Rsa::private_key_from_pem_callback(key, |password| { password_queried = true; password[..6].copy_from_slice(b"mypass"); 6 Ok(6) }) .unwrap(); Loading openssl/src/util.rs +8 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ use std::cell::UnsafeCell; use std::panic::{self, AssertUnwindSafe}; use std::slice; use error::ErrorStack; /// Wraps a user-supplied callback and a slot for panics thrown inside the callback (while FFI /// frames are on the stack). /// Loading Loading @@ -64,7 +66,7 @@ pub unsafe extern fn invoke_passwd_cb<F>(buf: *mut c_char, _rwflag: c_int, cb_state: *mut c_void) -> c_int where F: FnOnce(&mut [u8]) -> usize where F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack> { let callback = &mut *(cb_state as *mut CallbackState<F>); Loading @@ -74,7 +76,11 @@ pub unsafe extern fn invoke_passwd_cb<F>(buf: *mut c_char, })); match result { Ok(len) => len as c_int, Ok(Ok(len)) => len as c_int, Ok(Err(_)) => { // FIXME restore error stack 0 } Err(err) => { callback.panic = Some(err); 0 Loading Loading
openssl/src/dsa.rs +1 −1 Original line number Diff line number Diff line Loading @@ -237,7 +237,7 @@ mod test { Dsa::private_key_from_pem_callback(key, |password| { password_queried = true; password[..6].copy_from_slice(b"mypass"); 6 Ok(6) }) .unwrap(); Loading
openssl/src/macros.rs +1 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,7 @@ macro_rules! private_key_from_pem { pub fn private_key_from_pem_callback<F>(pem: &[u8], callback: F) -> Result<$t, ::error::ErrorStack> where F: FnOnce(&mut [u8]) -> usize where F: FnOnce(&mut [u8]) -> Result<usize, ::error::ErrorStack> { unsafe { ffi::init(); Loading
openssl/src/rsa.rs +1 −1 Original line number Diff line number Diff line Loading @@ -421,7 +421,7 @@ mod test { Rsa::private_key_from_pem_callback(key, |password| { password_queried = true; password[..6].copy_from_slice(b"mypass"); 6 Ok(6) }) .unwrap(); Loading
openssl/src/util.rs +8 −2 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ use std::cell::UnsafeCell; use std::panic::{self, AssertUnwindSafe}; use std::slice; use error::ErrorStack; /// Wraps a user-supplied callback and a slot for panics thrown inside the callback (while FFI /// frames are on the stack). /// Loading Loading @@ -64,7 +66,7 @@ pub unsafe extern fn invoke_passwd_cb<F>(buf: *mut c_char, _rwflag: c_int, cb_state: *mut c_void) -> c_int where F: FnOnce(&mut [u8]) -> usize where F: FnOnce(&mut [u8]) -> Result<usize, ErrorStack> { let callback = &mut *(cb_state as *mut CallbackState<F>); Loading @@ -74,7 +76,11 @@ pub unsafe extern fn invoke_passwd_cb<F>(buf: *mut c_char, })); match result { Ok(len) => len as c_int, Ok(Ok(len)) => len as c_int, Ok(Err(_)) => { // FIXME restore error stack 0 } Err(err) => { callback.panic = Some(err); 0 Loading