We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b1166ae commit ad2f4fdCopy full SHA for ad2f4fd
ossl/src/lib.rs
@@ -264,18 +264,21 @@ impl BigNum {
264
///
265
/// Returns a wrapped `BigNum` or an error if the import fails.
266
pub fn from_bigendian_slice(v: &[u8]) -> Result<BigNum, Error> {
267
- let bn = unsafe {
+ let mut bn = BigNum::new()?;
268
+
269
+ let ret = unsafe {
270
BN_bin2bn(
271
v.as_ptr() as *mut u8,
272
c_int::try_from(v.len())?,
- std::ptr::null_mut(),
273
+ bn.as_mut_ptr(),
274
)
275
};
- if bn.is_null() {
276
+ if ret.is_null() {
277
trace_ossl!("BN_bin2bn()");
278
return Err(Error::new(ErrorKind::NullPtr));
279
}
- Ok(BigNum { bn })
280
281
+ Ok(bn)
282
283
284
/// Calculates the minimum number of bytes needed to represent the `BIGNUM`.
0 commit comments