diff options
| author | Steven Fackler <[email protected]> | 2016-10-18 21:11:23 -0700 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2016-10-18 21:13:13 -0700 |
| commit | c4459c37d98b3a56723e6698852698fb2f354d47 (patch) | |
| tree | 9e1e7e1187effd4bdadd7a32c9e3c634c31ccfd8 /openssl/src/crypto/util.rs | |
| parent | Don't ignore errors in NPN/ALPN logic (diff) | |
| download | rust-openssl-c4459c37d98b3a56723e6698852698fb2f354d47.tar.xz rust-openssl-c4459c37d98b3a56723e6698852698fb2f354d47.zip | |
Callback cleanup
Diffstat (limited to 'openssl/src/crypto/util.rs')
| -rw-r--r-- | openssl/src/crypto/util.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/openssl/src/crypto/util.rs b/openssl/src/crypto/util.rs index c11285f8..07099b7c 100644 --- a/openssl/src/crypto/util.rs +++ b/openssl/src/crypto/util.rs @@ -36,16 +36,16 @@ impl<F> Drop for CallbackState<F> { /// Password callback function, passed to private key loading functions. /// /// `cb_state` is expected to be a pointer to a `CallbackState`. -pub extern "C" fn invoke_passwd_cb<F>(buf: *mut c_char, - size: c_int, - _rwflag: c_int, - cb_state: *mut c_void) - -> c_int - where F: FnOnce(&mut [c_char]) -> usize { +pub unsafe extern fn invoke_passwd_cb<F>(buf: *mut c_char, + size: c_int, + _rwflag: c_int, + cb_state: *mut c_void) + -> c_int + where F: FnOnce(&mut [c_char]) -> usize { let result = panic::catch_unwind(|| { // build a `i8` slice to pass to the user callback - let pass_slice = unsafe { slice::from_raw_parts_mut(buf, size as usize) }; - let callback = unsafe { &mut *(cb_state as *mut CallbackState<F>) }; + let pass_slice = slice::from_raw_parts_mut(buf, size as usize); + let callback = &mut *(cb_state as *mut CallbackState<F>); callback.cb.take().unwrap()(pass_slice) }); |