diff options
| author | Steven Fackler <[email protected]> | 2016-10-18 21:45:53 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-10-18 21:45:53 -0700 |
| commit | 591c03e78a68ea9792c3f8e820123fdc5ce612b2 (patch) | |
| tree | 9e1e7e1187effd4bdadd7a32c9e3c634c31ccfd8 /openssl/src/crypto | |
| parent | Merge pull request #478 from sfackler/feature-overhaul (diff) | |
| parent | Callback cleanup (diff) | |
| download | rust-openssl-591c03e78a68ea9792c3f8e820123fdc5ce612b2.tar.xz rust-openssl-591c03e78a68ea9792c3f8e820123fdc5ce612b2.zip | |
Merge pull request #481 from sfackler/pn-errors
Check for errors in NPN and ALPN logic
Diffstat (limited to 'openssl/src/crypto')
| -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) }); |