diff options
| author | Daniel Albert <[email protected]> | 2016-01-09 22:09:38 +0000 |
|---|---|---|
| committer | Daniel Albert <[email protected]> | 2016-01-09 22:09:38 +0000 |
| commit | 123840563703cd1c129a9702761b2028ab6c7210 (patch) | |
| tree | 8e0691364d7cfb43b19a530ad8ef26a6836c17cc /openssl/src | |
| parent | Add public interface to access BigNums from RSA keys (diff) | |
| download | rust-openssl-123840563703cd1c129a9702761b2028ab6c7210.tar.xz rust-openssl-123840563703cd1c129a9702761b2028ab6c7210.zip | |
Make the BigNum generation from a native pointer unsafe
Diffstat (limited to 'openssl/src')
| -rw-r--r-- | openssl/src/bn/mod.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/openssl/src/bn/mod.rs b/openssl/src/bn/mod.rs index cd1229af..ba1121dd 100644 --- a/openssl/src/bn/mod.rs +++ b/openssl/src/bn/mod.rs @@ -102,17 +102,15 @@ impl BigNum { }) } - pub fn new_from_ffi(orig: *mut ffi::BIGNUM) -> Result<BigNum, SslError> { + pub unsafe fn new_from_ffi(orig: *mut ffi::BIGNUM) -> Result<BigNum, SslError> { if orig.is_null() { panic!("Null Pointer was supplied to BigNum::new_from_ffi"); } - unsafe { - let r = ffi::BN_dup(orig); - if r.is_null() { - panic!("Unexpected null pointer from BN_dup(..)") - } else { - Ok(BigNum(r)) - } + let r = ffi::BN_dup(orig); + if r.is_null() { + panic!("Unexpected null pointer from BN_dup(..)") + } else { + Ok(BigNum(r)) } } |