Coverage Report

Created: 2025-12-12 07:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/openssl-sys-0.9.98/src/crypto.rs
Line
Count
Source
1
use super::*;
2
use libc::*;
3
4
extern "C" {
5
    #[deprecated(note = "use CRYPTO_set_locking_callback__fixed_rust instead")]
6
    #[cfg(not(ossl110))]
7
    pub fn CRYPTO_set_locking_callback(
8
        func: unsafe extern "C" fn(mode: c_int, n: c_int, file: *const c_char, line: c_int),
9
    );
10
11
    #[deprecated(note = "use CRYPTO_set_id_callback__fixed_rust instead")]
12
    #[cfg(not(ossl110))]
13
    pub fn CRYPTO_set_id_callback(func: unsafe extern "C" fn() -> c_ulong);
14
}
15
16
cfg_if! {
17
    if #[cfg(ossl110)] {
18
        type CRYPTO_EX_new_ret = ();
19
        type CRYPTO_EX_dup_from = *const CRYPTO_EX_DATA;
20
    } else {
21
        type CRYPTO_EX_new_ret = c_int;
22
        type CRYPTO_EX_dup_from = *mut CRYPTO_EX_DATA;
23
    }
24
}
25
26
cfg_if! {
27
    if #[cfg(ossl300)] {
28
        type CRYPTO_EX_dup_from_d = *mut *mut c_void;
29
    } else {
30
        type CRYPTO_EX_dup_from_d = *mut c_void;
31
    }
32
}
33
34
// FIXME should be options
35
pub type CRYPTO_EX_new = unsafe extern "C" fn(
36
    parent: *mut c_void,
37
    ptr: *mut c_void,
38
    ad: *mut CRYPTO_EX_DATA,
39
    idx: c_int,
40
    argl: c_long,
41
    argp: *mut c_void,
42
) -> CRYPTO_EX_new_ret;
43
pub type CRYPTO_EX_dup = unsafe extern "C" fn(
44
    to: *mut CRYPTO_EX_DATA,
45
    from: CRYPTO_EX_dup_from,
46
    from_d: CRYPTO_EX_dup_from_d,
47
    idx: c_int,
48
    argl: c_long,
49
    argp: *mut c_void,
50
) -> c_int;
51
pub type CRYPTO_EX_free = unsafe extern "C" fn(
52
    parent: *mut c_void,
53
    ptr: *mut c_void,
54
    ad: *mut CRYPTO_EX_DATA,
55
    idx: c_int,
56
    argl: c_long,
57
    argp: *mut c_void,
58
);
59
60
#[cfg(ossl110)]
61
#[inline]
62
#[track_caller]
63
0
pub unsafe fn OPENSSL_malloc(num: usize) -> *mut c_void {
64
0
    CRYPTO_malloc(
65
0
        num,
66
0
        concat!(file!(), "\0").as_ptr() as *const _,
67
0
        line!() as _,
68
    )
69
0
}
70
71
#[cfg(not(ossl110))]
72
#[inline]
73
#[track_caller]
74
pub unsafe fn OPENSSL_malloc(num: c_int) -> *mut c_void {
75
    CRYPTO_malloc(
76
        num,
77
        concat!(file!(), "\0").as_ptr() as *const _,
78
        line!() as _,
79
    )
80
}
81
82
#[cfg(ossl110)]
83
#[inline]
84
#[track_caller]
85
0
pub unsafe fn OPENSSL_free(addr: *mut c_void) {
86
0
    CRYPTO_free(
87
0
        addr,
88
0
        concat!(file!(), "\0").as_ptr() as *const _,
89
0
        line!() as _,
90
    )
91
0
}
92
93
#[cfg(not(ossl110))]
94
#[inline]
95
pub unsafe fn OPENSSL_free(addr: *mut c_void) {
96
    CRYPTO_free(addr)
97
}
98
99
#[cfg(not(ossl110))]
100
pub const CRYPTO_LOCK_X509: c_int = 3;
101
#[cfg(not(ossl110))]
102
pub const CRYPTO_LOCK_EVP_PKEY: c_int = 10;
103
#[cfg(not(ossl110))]
104
pub const CRYPTO_LOCK_SSL_CTX: c_int = 12;
105
#[cfg(not(ossl110))]
106
pub const CRYPTO_LOCK_SSL_SESSION: c_int = 14;
107
108
cfg_if! {
109
    if #[cfg(any(ossl110, libressl381))] {
110
        pub const CRYPTO_EX_INDEX_SSL: c_int = 0;
111
        pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 1;
112
    } else if #[cfg(libressl)] {
113
        pub const CRYPTO_EX_INDEX_SSL: c_int = 1;
114
        pub const CRYPTO_EX_INDEX_SSL_CTX: c_int = 2;
115
    }
116
}
117
118
cfg_if! {
119
    if #[cfg(any(ossl110, libressl271))] {
120
        pub const OPENSSL_VERSION: c_int = 0;
121
        pub const OPENSSL_CFLAGS: c_int = 1;
122
        pub const OPENSSL_BUILT_ON: c_int = 2;
123
        pub const OPENSSL_PLATFORM: c_int = 3;
124
        pub const OPENSSL_DIR: c_int = 4;
125
    } else {
126
        pub const SSLEAY_VERSION: c_int = 0;
127
        pub const SSLEAY_CFLAGS: c_int = 2;
128
        pub const SSLEAY_BUILT_ON: c_int = 3;
129
        pub const SSLEAY_PLATFORM: c_int = 4;
130
        pub const SSLEAY_DIR: c_int = 5;
131
    }
132
}
133
134
pub const CRYPTO_LOCK: c_int = 1;