Remove link_name usage
This commit is contained in:
parent
98e71596fb
commit
ae282a78e2
|
|
@ -466,11 +466,7 @@ extern {
|
|||
pub fn EVP_DigestFinal(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int;
|
||||
pub fn EVP_DigestFinal_ex(ctx: *mut EVP_MD_CTX, res: *mut u8, n: *mut u32) -> c_int;
|
||||
|
||||
#[cfg_attr(any(ossl101, ossl102), link_name = "EVP_MD_CTX_create")]
|
||||
pub fn EVP_MD_CTX_new() -> *mut EVP_MD_CTX;
|
||||
pub fn EVP_MD_CTX_copy_ex(dst: *mut EVP_MD_CTX, src: *const EVP_MD_CTX) -> c_int;
|
||||
#[cfg_attr(any(ossl101, ossl102), link_name = "EVP_MD_CTX_destroy")]
|
||||
pub fn EVP_MD_CTX_free(ctx: *mut EVP_MD_CTX);
|
||||
|
||||
pub fn EVP_PKEY_new() -> *mut EVP_PKEY;
|
||||
pub fn EVP_PKEY_free(k: *mut EVP_PKEY);
|
||||
|
|
|
|||
|
|
@ -559,6 +559,8 @@ extern {
|
|||
type_: c_int,
|
||||
file: *const c_char,
|
||||
line: c_int) -> c_int;
|
||||
pub fn EVP_MD_CTX_create() -> *mut EVP_MD_CTX;
|
||||
pub fn EVP_MD_CTX_destroy(ctx: *mut EVP_MD_CTX);
|
||||
|
||||
pub fn sk_free(st: *mut _STACK);
|
||||
pub fn sk_pop_free(st: *mut _STACK, free: Option<unsafe extern "C" fn (*mut c_void)>);
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ extern {
|
|||
pub fn X509_up_ref(x: *mut X509) -> c_int;
|
||||
pub fn SSL_CTX_up_ref(x: *mut SSL_CTX) -> c_int;
|
||||
pub fn X509_get0_extensions(req: *const ::X509) -> *const stack_st_X509_EXTENSION;
|
||||
pub fn EVP_MD_CTX_new() -> *mut EVP_MD_CTX;
|
||||
pub fn EVP_MD_CTX_free(ctx: *mut EVP_MD_CTX);
|
||||
|
||||
pub fn OpenSSL_version_num() -> c_ulong;
|
||||
pub fn OpenSSL_version(key: c_int) -> *const c_char;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@ use std::io;
|
|||
use std::ptr;
|
||||
use ffi;
|
||||
|
||||
#[cfg(ossl110)]
|
||||
use ffi::{EVP_MD_CTX_new, EVP_MD_CTX_free};
|
||||
#[cfg(any(ossl101, ossl102))]
|
||||
use ffi::{EVP_MD_CTX_create as EVP_MD_CTX_new, EVP_MD_CTX_destroy as EVP_MD_CTX_free};
|
||||
|
||||
use HashTypeInternals;
|
||||
use error::ErrorStack;
|
||||
use nid::Nid;
|
||||
|
|
@ -100,7 +105,7 @@ impl Hasher {
|
|||
pub fn new(ty: Type) -> Result<Hasher, ErrorStack> {
|
||||
ffi::init();
|
||||
|
||||
let ctx = unsafe { try_ssl_null!(ffi::EVP_MD_CTX_new()) };
|
||||
let ctx = unsafe { try_ssl_null!(EVP_MD_CTX_new()) };
|
||||
let md = ty.evp_md();
|
||||
|
||||
let mut h = Hasher {
|
||||
|
|
@ -172,7 +177,7 @@ impl Write for Hasher {
|
|||
impl Clone for Hasher {
|
||||
fn clone(&self) -> Hasher {
|
||||
let ctx = unsafe {
|
||||
let ctx = ffi::EVP_MD_CTX_new();
|
||||
let ctx = EVP_MD_CTX_new();
|
||||
assert!(!ctx.is_null());
|
||||
let r = ffi::EVP_MD_CTX_copy_ex(ctx, self.ctx);
|
||||
assert_eq!(r, 1);
|
||||
|
|
@ -193,7 +198,7 @@ impl Drop for Hasher {
|
|||
if self.state != Finalized {
|
||||
drop(self.finish());
|
||||
}
|
||||
ffi::EVP_MD_CTX_free(self.ctx);
|
||||
EVP_MD_CTX_free(self.ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue