1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
use libc::{c_char, c_int, c_uchar, c_uint, c_ulong, c_void, size_t};
pub type SSL_CTX_keylog_cb_func =
Option<unsafe extern "C" fn(ssl: *const ::SSL, line: *const c_char)>;
pub type SSL_custom_ext_add_cb_ex = Option<
unsafe extern "C" fn(
ssl: *mut ::SSL,
ext_type: c_uint,
context: c_uint,
out: *mut *const c_uchar,
outlen: *mut size_t,
x: *mut ::X509,
chainidx: size_t,
al: *mut c_int,
add_arg: *mut c_void,
) -> c_int,
>;
pub type SSL_custom_ext_free_cb_ex = Option<
unsafe extern "C" fn(
ssl: *mut ::SSL,
ext_type: c_uint,
context: c_uint,
out: *mut *const c_uchar,
add_arg: *mut c_void,
),
>;
pub type SSL_custom_ext_parse_cb_ex = Option<
unsafe extern "C" fn(
ssl: *mut ::SSL,
ext_type: c_uint,
context: c_uint,
input: *const c_uchar,
inlen: size_t,
x: *mut ::X509,
chainidx: size_t,
al: *mut c_int,
parse_arg: *mut c_void,
) -> c_int,
>;
pub const SSL_COOKIE_LENGTH: c_int = 4096;
pub const SSL_OP_ENABLE_MIDDLEBOX_COMPAT: c_ulong = 0x00100000;
pub const SSL_OP_NO_TLSv1_3: c_ulong = 0x20000000;
pub const TLS1_3_VERSION: c_int = 0x304;
pub const SSL_EXT_TLS_ONLY: c_uint = 0x0001;
pub const SSL_EXT_DTLS_ONLY: c_uint = 0x0002;
pub const SSL_EXT_TLS_IMPLEMENTATION_ONLY: c_uint = 0x0004;
pub const SSL_EXT_SSL3_ALLOWED: c_uint = 0x0008;
pub const SSL_EXT_TLS1_2_AND_BELOW_ONLY: c_uint = 0x0010;
pub const SSL_EXT_TLS1_3_ONLY: c_uint = 0x0020;
pub const SSL_EXT_IGNORE_ON_RESUMPTION: c_uint = 0x0040;
pub const SSL_EXT_CLIENT_HELLO: c_uint = 0x0080;
pub const SSL_EXT_TLS1_2_SERVER_HELLO: c_uint = 0x0100;
pub const SSL_EXT_TLS1_3_SERVER_HELLO: c_uint = 0x0200;
pub const SSL_EXT_TLS1_3_ENCRYPTED_EXTENSIONS: c_uint = 0x0400;
pub const SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST: c_uint = 0x0800;
pub const SSL_EXT_TLS1_3_CERTIFICATE: c_uint = 0x1000;
pub const SSL_EXT_TLS1_3_NEW_SESSION_TICKET: c_uint = 0x2000;
pub const SSL_EXT_TLS1_3_CERTIFICATE_REQUEST: c_uint = 0x4000;
pub const SSL_READ_EARLY_DATA_ERROR: c_int = 0;
pub const SSL_READ_EARLY_DATA_SUCCESS: c_int = 1;
pub const SSL_READ_EARLY_DATA_FINISH: c_int = 2;
extern "C" {
pub fn SSL_CTX_set_keylog_callback(ctx: *mut ::SSL_CTX, cb: SSL_CTX_keylog_cb_func);
pub fn SSL_CTX_add_custom_ext(
ctx: *mut ::SSL_CTX,
ext_type: c_uint,
context: c_uint,
add_cb: SSL_custom_ext_add_cb_ex,
free_cb: SSL_custom_ext_free_cb_ex,
add_arg: *mut c_void,
parse_cb: SSL_custom_ext_parse_cb_ex,
parse_arg: *mut c_void,
) -> c_int;
pub fn SSL_CIPHER_get_handshake_digest(cipher: *const ::SSL_CIPHER) -> *const ::EVP_MD;
pub fn SSL_CTX_set_stateless_cookie_generate_cb(
s: *mut ::SSL_CTX,
cb: Option<
unsafe extern "C" fn(ssl: *mut ::SSL, cookie: *mut c_uchar, cookie_len: *mut size_t)
-> c_int,
>,
);
pub fn SSL_CTX_set_stateless_cookie_verify_cb(
s: *mut ::SSL_CTX,
cb: Option<
unsafe extern "C" fn(ssl: *mut ::SSL, cookie: *const c_uchar, cookie_len: size_t)
-> c_int,
>,
);
pub fn SSL_CTX_set_max_early_data(ctx: *mut ::SSL_CTX, max_early_data: u32) -> c_int;
pub fn SSL_CTX_get_max_early_data(ctx: *const ::SSL_CTX) -> u32;
pub fn SSL_CTX_set_ciphersuites(ctx: *mut ::SSL_CTX, str: *const c_char) -> c_int;
pub fn SSL_set_max_early_data(ctx: *mut ::SSL, max_early_data: u32) -> c_int;
pub fn SSL_get_max_early_data(ctx: *const ::SSL) -> u32;
pub fn SSL_stateless(s: *mut ::SSL) -> c_int;
pub fn SSL_export_keying_material_early(
s: *mut ::SSL,
out: *mut c_uchar,
olen: size_t,
label: *const c_char,
llen: size_t,
context: *const c_uchar,
contextlen: size_t,
) -> c_int;
pub fn SSL_write_early_data(
s: *mut ::SSL,
buf: *const c_void,
num: size_t,
written: *mut size_t,
) -> c_int;
pub fn SSL_read_early_data(
s: *mut ::SSL,
buf: *mut c_void,
num: size_t,
readbytes: *mut size_t,
) -> c_int;
pub fn SSL_set_ciphersuites(ssl: *mut ::SSL, str: *const c_char) -> c_int;
pub fn SSL_SESSION_set_max_early_data(ctx: *mut ::SSL_SESSION, max_early_data: u32) -> c_int;
pub fn SSL_SESSION_get_max_early_data(ctx: *const ::SSL_SESSION) -> u32;
}