variant_ssl_sys/handwritten/
crypto.rs1use super::super::*;
2use libc::*;
3
4stack!(stack_st_void);
5
6cfg_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
20extern "C" {
21 #[cfg(any(ossl110, libressl))]
22 pub fn CRYPTO_get_ex_new_index(
23 class_index: c_int,
24 argl: c_long,
25 argp: *mut c_void,
26 new_func: CRYPTO_EX_new,
27 dup_func: CRYPTO_EX_dup,
28 free_func: 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)]
36extern "C" {
37 #[cfg(not(ossl110))]
38 pub fn CRYPTO_set_locking_callback(
39 func: Option<unsafe extern "C" fn(mode: c_int, n: c_int, file: *const c_char, line: c_int)>,
40 );
41
42 #[cfg(not(ossl110))]
43 pub fn CRYPTO_set_id_callback(func: Option<unsafe extern "C" fn() -> c_ulong>);
44}
45
46extern "C" {
47 #[cfg(not(ossl110))]
48 pub fn CRYPTO_add_lock(
49 pointer: *mut c_int,
50 amount: c_int,
51 type_: c_int,
52 file: *const c_char,
53 line: c_int,
54 ) -> c_int;
55}
56
57cfg_if! {
58 if #[cfg(any(ossl110, libressl390))] {
59 extern "C" {
60 pub fn CRYPTO_malloc(num: size_t, file: *const c_char, line: c_int) -> *mut c_void;
61 pub fn CRYPTO_free(buf: *mut c_void, file: *const c_char, line: c_int);
62 }
63 } else {
64 extern "C" {
65 pub fn CRYPTO_malloc(num: c_int, file: *const c_char, line: c_int) -> *mut c_void;
66 pub fn CRYPTO_free(buf: *mut c_void);
67 }
68 }
69}
70
71extern "C" {
72 #[cfg(all(ossl101, not(ossl300)))]
73 pub fn FIPS_mode() -> c_int;
74 #[cfg(all(ossl101, not(ossl300)))]
75 pub fn FIPS_mode_set(onoff: c_int) -> c_int;
76
77 pub fn CRYPTO_memcmp(a: *const c_void, b: *const c_void, len: size_t) -> c_int;
78
79 #[cfg(ossl300)]
80 pub fn OSSL_LIB_CTX_new() -> *mut OSSL_LIB_CTX;
81 #[cfg(ossl300)]
82 pub fn OSSL_LIB_CTX_free(libcts: *mut OSSL_LIB_CTX);
83}