Unverified Commit 3f038cf0 authored by Alex Gaynor's avatar Alex Gaynor Committed by GitHub
Browse files

Merge pull request #1895 from sfackler/alex-patch-1

Expose BigNum::to_vec_padded on libressl and boringssl
parents f7b98c24 0a3cca21
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ extern "C" {
    pub fn BN_clear_free(bn: *mut BIGNUM);
    pub fn BN_bin2bn(s: *const u8, size: c_int, ret: *mut BIGNUM) -> *mut BIGNUM;
    pub fn BN_bn2bin(a: *const BIGNUM, to: *mut u8) -> c_int;
    #[cfg(ossl110)]
    #[cfg(any(ossl110, libressl340))]
    pub fn BN_bn2binpad(a: *const BIGNUM, to: *mut u8, tolen: c_int) -> c_int;
    pub fn BN_sub(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
    pub fn BN_add(r: *mut BIGNUM, a: *const BIGNUM, b: *const BIGNUM) -> c_int;
+1 −1
Original line number Diff line number Diff line
@@ -814,7 +814,7 @@ impl BigNumRef {
    /// assert_eq!(&bn_vec, &[0, 0, 0x45, 0x43]);
    /// ```
    #[corresponds(BN_bn2binpad)]
    #[cfg(ossl110)]
    #[cfg(any(ossl110, libressl340, boringssl))]
    pub fn to_vec_padded(&self, pad_to: i32) -> Result<Vec<u8>, ErrorStack> {
        let mut v = Vec::with_capacity(pad_to as usize);
        unsafe {