Expose EVP_MD_type()
This gives us the ability to get the Nid from a MessageDigest.
This commit is contained in:
parent
a335c1b2f5
commit
d9cb5433b1
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue