Commit 12384056 authored by Daniel Albert's avatar Daniel Albert
Browse files

Make the BigNum generation from a native pointer unsafe

parent 578fac7e
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -102,11 +102,10 @@ 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(..)")
@@ -114,7 +113,6 @@ impl BigNum {
            Ok(BigNum(r))
        }
    }
    }

    pub fn new_from_slice(n: &[u8]) -> Result<BigNum, SslError> {
        BigNum::new().and_then(|v| unsafe {