diff --git a/openssl/src/hash.rs b/openssl/src/hash.rs index 01d7097b0..f2f2698f3 100644 --- a/openssl/src/hash.rs +++ b/openssl/src/hash.rs @@ -70,6 +70,7 @@ impl MessageDigest { /// /// [`EVP_get_digestbynid`]: https://www.openssl.org/docs/manmaster/crypto/EVP_DigestInit.html pub fn from_nid(type_: Nid) -> Option { + ffi::init(); unsafe { let ptr = ffi::EVP_get_digestbynid(type_.as_raw()); if ptr.is_null() { diff --git a/openssl/src/md.rs b/openssl/src/md.rs index 08e4aacf3..a9df31140 100644 --- a/openssl/src/md.rs +++ b/openssl/src/md.rs @@ -80,6 +80,7 @@ impl Md { /// Returns the `Md` corresponding to an [`Nid`]. #[corresponds(EVP_get_digestbynid)] pub fn from_nid(type_: Nid) -> Option<&'static MdRef> { + ffi::init(); unsafe { let ptr = ffi::EVP_get_digestbynid(type_.as_raw()); if ptr.is_null() { @@ -100,6 +101,7 @@ impl Md { algorithm: &str, properties: Option<&str>, ) -> Result { + ffi::init(); let algorithm = CString::new(algorithm).unwrap(); let properties = properties.map(|s| CString::new(s).unwrap());