Commit d9cb5433 authored by Nathaniel McCallum's avatar Nathaniel McCallum
Browse files

Expose EVP_MD_type()

This gives us the ability to get the Nid from a MessageDigest.
parent a335c1b2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ pub unsafe fn EVP_get_digestbynid(type_: c_int) -> *const EVP_MD {

extern "C" {
    pub fn EVP_MD_size(md: *const EVP_MD) -> c_int;
    pub fn EVP_MD_type(md: *const EVP_MD) -> c_int;

    #[cfg(any(ossl110, libressl273))]
    pub fn EVP_CIPHER_key_length(cipher: *const EVP_CIPHER) -> c_int;
+5 −0
Original line number Diff line number Diff line
@@ -106,6 +106,11 @@ impl MessageDigest {
    pub fn size(&self) -> usize {
        unsafe { ffi::EVP_MD_size(self.0) as usize }
    }

    /// The name of the digest
    pub fn type_(&self) -> Nid {
        Nid::from_raw(unsafe { ffi::EVP_MD_type(self.0) })
    }
}

unsafe impl Sync for MessageDigest {}