Skip to content

Commit 9de3794

Browse files
committed
Initialize OpenSSL in MD constructors
1 parent c38bc2f commit 9de3794

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

openssl/src/hash.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ impl MessageDigest {
7070
///
7171
/// [`EVP_get_digestbynid`]: https://www.openssl.org/docs/manmaster/crypto/EVP_DigestInit.html
7272
pub fn from_nid(type_: Nid) -> Option<MessageDigest> {
73+
ffi::init();
7374
unsafe {
7475
let ptr = ffi::EVP_get_digestbynid(type_.as_raw());
7576
if ptr.is_null() {

openssl/src/md.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ impl Md {
8080
/// Returns the `Md` corresponding to an [`Nid`].
8181
#[corresponds(EVP_get_digestbynid)]
8282
pub fn from_nid(type_: Nid) -> Option<&'static MdRef> {
83+
ffi::init();
8384
unsafe {
8485
let ptr = ffi::EVP_get_digestbynid(type_.as_raw());
8586
if ptr.is_null() {
@@ -100,6 +101,7 @@ impl Md {
100101
algorithm: &str,
101102
properties: Option<&str>,
102103
) -> Result<Self, ErrorStack> {
104+
ffi::init();
103105
let algorithm = CString::new(algorithm).unwrap();
104106
let properties = properties.map(|s| CString::new(s).unwrap());
105107

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy