| 1 | use super::super::*; |
| 2 | use libc::*; |
| 3 | |
| 4 | stack!(stack_st_void); |
| 5 | |
| 6 | cfg_if! { |
| 7 | if #[cfg(any(ossl110, libressl271))] { |
| 8 | extern "C" { |
| 9 | pub fn OpenSSL_version_num() -> c_ulong; |
| 10 | pub fn OpenSSL_version(key: c_int) -> *const c_char; |
| 11 | } |
| 12 | } else { |
| 13 | extern "C" { |
| 14 | pub fn SSLeay() -> c_ulong; |
| 15 | pub fn SSLeay_version(key: c_int) -> *const c_char; |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | unsafeextern "C" { |
| 21 | #[cfg (any(ossl110, libressl))] |
| 22 | pub unsafefn CRYPTO_get_ex_new_index( |
| 23 | class_index: c_int, |
| 24 | argl: c_long, |
| 25 | argp: *mut c_void, |
| 26 | new_func: Option<CRYPTO_EX_new>, |
| 27 | dup_func: Option<CRYPTO_EX_dup>, |
| 28 | free_func: Option<CRYPTO_EX_free>, |
| 29 | ) -> c_int; |
| 30 | |
| 31 | #[cfg (not(ossl110))] |
| 32 | pub fn CRYPTO_num_locks() -> c_int; |
| 33 | } |
| 34 | |
| 35 | #[allow (clashing_extern_declarations)] |
| 36 | unsafeextern "C" { |
| 37 | #[cfg (not(ossl110))] |
| 38 | #[link_name = "CRYPTO_set_locking_callback" ] |
| 39 | pub fn CRYPTO_set_locking_callback__fixed_rust( |
| 40 | func: Option<unsafe extern "C" fn(mode: c_int, n: c_int, file: *const c_char, line: c_int)>, |
| 41 | ); |
| 42 | |
| 43 | #[cfg (not(ossl110))] |
| 44 | #[link_name = "CRYPTO_set_id_callback" ] |
| 45 | pub fn CRYPTO_set_id_callback__fixed_rust(func: Option<unsafe extern "C" fn() -> c_ulong>); |
| 46 | } |
| 47 | |
| 48 | unsafeextern "C" { |
| 49 | #[cfg (not(ossl110))] |
| 50 | pub fn CRYPTO_add_lock( |
| 51 | pointer: *mut c_int, |
| 52 | amount: c_int, |
| 53 | type_: c_int, |
| 54 | file: *const c_char, |
| 55 | line: c_int, |
| 56 | ) -> c_int; |
| 57 | } |
| 58 | |
| 59 | cfg_if! { |
| 60 | if #[cfg(any(ossl110, libressl390))] { |
| 61 | extern "C" { |
| 62 | pub fn CRYPTO_malloc(num: size_t, file: *const c_char, line: c_int) -> *mut c_void; |
| 63 | pub fn CRYPTO_free(buf: *mut c_void, file: *const c_char, line: c_int); |
| 64 | } |
| 65 | } else { |
| 66 | extern "C" { |
| 67 | pub fn CRYPTO_malloc(num: c_int, file: *const c_char, line: c_int) -> *mut c_void; |
| 68 | pub fn CRYPTO_free(buf: *mut c_void); |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | unsafeextern "C" { |
| 74 | #[cfg (all(ossl101, not(ossl300)))] |
| 75 | pub fn FIPS_mode() -> c_int; |
| 76 | #[cfg (all(ossl101, not(ossl300)))] |
| 77 | pub fn FIPS_mode_set(onoff: c_int) -> c_int; |
| 78 | |
| 79 | pub unsafefn CRYPTO_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int; |
| 80 | |
| 81 | #[cfg (ossl300)] |
| 82 | pub unsafefn OSSL_LIB_CTX_new() -> *mut OSSL_LIB_CTX; |
| 83 | #[cfg (ossl300)] |
| 84 | pub unsafefn OSSL_LIB_CTX_free(libcts: *mut OSSL_LIB_CTX); |
| 85 | } |
| 86 | |