• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use super::super::*;
2 use libc::*;
3 
4 pub enum SSL_METHOD {}
5 pub enum SSL_CIPHER {}
6 cfg_if! {
7     if #[cfg(any(ossl110, libressl280))] {
8         pub enum SSL_SESSION {}
9     } else if #[cfg(libressl251)] {
10         #[repr(C)]
11         pub struct SSL_SESSION {
12             ssl_version: c_int,
13             pub master_key_length: c_int,
14             pub master_key: [c_uchar; 48],
15             session_id_length: c_uint,
16             session_id: [c_uchar; SSL_MAX_SSL_SESSION_ID_LENGTH as usize],
17             sid_ctx_length: c_uint,
18             sid_ctx: [c_uchar; SSL_MAX_SID_CTX_LENGTH as usize],
19             peer: *mut X509,
20             verify_result: c_long,
21             timeout: c_long,
22             time: time_t,
23             pub references: c_int,
24             cipher: *const SSL_CIPHER,
25             cipher_id: c_long,
26             ciphers: *mut stack_st_SSL_CIPHER,
27             tlsext_hostname: *mut c_char,
28             tlsext_tick: *mut c_uchar,
29             tlsext_ticklen: size_t,
30             tlsext_tick_lifetime_int: c_long,
31             internal: *mut c_void,
32         }
33     } else if #[cfg(libressl)] {
34         #[repr(C)]
35         pub struct SSL_SESSION {
36             ssl_version: c_int,
37             pub master_key_length: c_int,
38             pub master_key: [c_uchar; 48],
39             session_id_length: c_uint,
40             session_id: [c_uchar; SSL_MAX_SSL_SESSION_ID_LENGTH as usize],
41             sid_ctx_length: c_uint,
42             sid_ctx: [c_uchar; SSL_MAX_SID_CTX_LENGTH as usize],
43             not_resumable: c_int,
44             sess_cert: *mut c_void,
45             peer: *mut X509,
46             verify_result: c_long,
47             timeout: c_long,
48             time: time_t,
49             pub references: c_int,
50             cipher: *const c_void,
51             cipher_id: c_ulong,
52             ciphers: *mut c_void,
53             ex_data: CRYPTO_EX_DATA,
54             prev: *mut c_void,
55             next: *mut c_void,
56             tlsext_hostname: *mut c_char,
57             tlsext_ecpointformatlist_length: size_t,
58             tlsext_ecpointformatlist: *mut u8,
59             tlsext_ellipticcurvelist_length: size_t,
60             tlsext_ellipticcurvelist: *mut u16,
61             tlsext_tick: *mut c_uchar,
62             tlsext_ticklen: size_t,
63             tlsext_tick_lifetime_hint: c_long,
64         }
65     } else {
66         #[repr(C)]
67         pub struct SSL_SESSION {
68             ssl_version: c_int,
69             key_arg_length: c_uint,
70             key_arg: [c_uchar; SSL_MAX_KEY_ARG_LENGTH as usize],
71             pub master_key_length: c_int,
72             pub master_key: [c_uchar; 48],
73             session_id_length: c_uint,
74             session_id: [c_uchar; SSL_MAX_SSL_SESSION_ID_LENGTH as usize],
75             sid_ctx_length: c_uint,
76             sid_ctx: [c_uchar; SSL_MAX_SID_CTX_LENGTH as usize],
77             #[cfg(not(osslconf = "OPENSSL_NO_KRB5"))]
78             krb5_client_princ_len: c_uint,
79             #[cfg(not(osslconf = "OPENSSL_NO_KRB5"))]
80             krb5_client_princ: [c_uchar; SSL_MAX_KRB5_PRINCIPAL_LENGTH as usize],
81             #[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
82             psk_identity_hint: *mut c_char,
83             #[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
84             psk_identity: *mut c_char,
85             not_resumable: c_int,
86             sess_cert: *mut c_void,
87             peer: *mut X509,
88             verify_result: c_long,
89             pub references: c_int,
90             timeout: c_long,
91             time: c_long,
92             compress_meth: c_uint,
93             cipher: *const c_void,
94             cipher_id: c_ulong,
95             ciphers: *mut c_void,
96             ex_data: CRYPTO_EX_DATA,
97             prev: *mut c_void,
98             next: *mut c_void,
99             #[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
100             tlsext_hostname: *mut c_char,
101             #[cfg(all(
102                 not(osslconf = "OPENSSL_NO_TLSEXT"),
103                 not(osslconf = "OPENSSL_NO_EC")
104             ))]
105             tlsext_ecpointformatlist_length: size_t,
106             #[cfg(all(
107                 not(osslconf = "OPENSSL_NO_TLSEXT"),
108                 not(osslconf = "OPENSSL_NO_EC")
109             ))]
110             tlsext_ecpointformatlist: *mut c_uchar,
111             #[cfg(all(
112                 not(osslconf = "OPENSSL_NO_TLSEXT"),
113                 not(osslconf = "OPENSSL_NO_EC")
114             ))]
115             tlsext_ellipticcurvelist_length: size_t,
116             #[cfg(all(
117                 not(osslconf = "OPENSSL_NO_TLSEXT"),
118                 not(osslconf = "OPENSSL_NO_EC")
119             ))]
120             tlsext_ellipticcurvelist: *mut c_uchar,
121             #[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
122             tlsext_tick: *mut c_uchar,
123             #[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
124             tlsext_ticklen: size_t,
125             #[cfg(not(osslconf = "OPENSSL_NO_TLSEXT"))]
126             tlsext_tick_lifetime_hint: c_long,
127             #[cfg(not(osslconf = "OPENSSL_NO_SRP"))]
128             srp_username: *mut c_char,
129         }
130     }
131 }
132 
133 stack!(stack_st_SSL_CIPHER);
134 
135 #[repr(C)]
136 pub struct SRTP_PROTECTION_PROFILE {
137     pub name: *const c_char,
138     pub id: c_ulong,
139 }
140 
141 stack!(stack_st_SRTP_PROTECTION_PROFILE);
142 
143 pub type tls_session_ticket_ext_cb_fn =
144     Option<unsafe extern "C" fn(*mut SSL, *const c_uchar, c_int, *mut c_void) -> c_int>;
145 pub type tls_session_secret_cb_fn = Option<
146     unsafe extern "C" fn(
147         *mut SSL,
148         *mut c_void,
149         *mut c_int,
150         *mut stack_st_SSL_CIPHER,
151         *mut *mut SSL_CIPHER,
152         *mut c_void,
153     ) -> c_int,
154 >;
155 
156 #[cfg(ossl111)]
157 pub type SSL_custom_ext_add_cb_ex = Option<
158     unsafe extern "C" fn(
159         ssl: *mut SSL,
160         ext_type: c_uint,
161         context: c_uint,
162         out: *mut *const c_uchar,
163         outlen: *mut size_t,
164         x: *mut X509,
165         chainidx: size_t,
166         al: *mut c_int,
167         add_arg: *mut c_void,
168     ) -> c_int,
169 >;
170 
171 #[cfg(ossl111)]
172 pub type SSL_custom_ext_free_cb_ex = Option<
173     unsafe extern "C" fn(
174         ssl: *mut SSL,
175         ext_type: c_uint,
176         context: c_uint,
177         out: *const c_uchar,
178         add_arg: *mut c_void,
179     ),
180 >;
181 
182 #[cfg(ossl111)]
183 pub type SSL_custom_ext_parse_cb_ex = Option<
184     unsafe extern "C" fn(
185         ssl: *mut SSL,
186         ext_type: c_uint,
187         context: c_uint,
188         input: *const c_uchar,
189         inlen: size_t,
190         x: *mut X509,
191         chainidx: size_t,
192         al: *mut c_int,
193         parse_arg: *mut c_void,
194     ) -> c_int,
195 >;
196 
197 cfg_if! {
198     if #[cfg(ossl300)] {
199         extern "C" {
200             pub fn SSL_CTX_get_options(ctx: *const SSL_CTX) -> u64;
201             pub fn SSL_CTX_set_options(ctx: *mut SSL_CTX, op: u64) -> u64;
202             pub fn SSL_CTX_clear_options(ctx: *mut SSL_CTX, op: u64) -> u64;
203         }
204     } else if #[cfg(ossl110)] {
205         extern "C" {
206             pub fn SSL_CTX_get_options(ctx: *const SSL_CTX) -> c_ulong;
207             pub fn SSL_CTX_set_options(ctx: *mut SSL_CTX, op: c_ulong) -> c_ulong;
208             pub fn SSL_CTX_clear_options(ctx: *mut SSL_CTX, op: c_ulong) -> c_ulong;
209         }
210     }
211 }
212 
213 pub type GEN_SESSION_CB =
214     Option<unsafe extern "C" fn(*const SSL, *mut c_uchar, *mut c_uint) -> c_int>;
215 
216 extern "C" {
SSL_CTX_sess_set_new_cb( ctx: *mut SSL_CTX, new_session_cb: Option<unsafe extern "C" fn(*mut SSL, *mut SSL_SESSION) -> c_int>, )217     pub fn SSL_CTX_sess_set_new_cb(
218         ctx: *mut SSL_CTX,
219         new_session_cb: Option<unsafe extern "C" fn(*mut SSL, *mut SSL_SESSION) -> c_int>,
220     );
SSL_CTX_sess_set_remove_cb( ctx: *mut SSL_CTX, remove_session_cb: Option<unsafe extern "C" fn(*mut SSL_CTX, *mut SSL_SESSION)>, )221     pub fn SSL_CTX_sess_set_remove_cb(
222         ctx: *mut SSL_CTX,
223         remove_session_cb: Option<unsafe extern "C" fn(*mut SSL_CTX, *mut SSL_SESSION)>,
224     );
225 }
226 cfg_if! {
227     // const change in passed function pointer signature
228     if #[cfg(any(ossl110, libressl280))] {
229         extern "C" {
230             pub fn SSL_CTX_sess_set_get_cb(
231                 ctx: *mut SSL_CTX,
232                 get_session_cb: Option<
233                     unsafe extern "C" fn(*mut SSL, *const c_uchar, c_int, *mut c_int) -> *mut SSL_SESSION,
234                 >,
235             );
236         }
237     } else {
238         extern "C" {
239             pub fn SSL_CTX_sess_set_get_cb(
240                 ctx: *mut SSL_CTX,
241                 get_session_cb: Option<
242                     unsafe extern "C" fn(*mut SSL, *mut c_uchar, c_int, *mut c_int) -> *mut SSL_SESSION,
243                 >,
244             );
245         }
246     }
247 }
248 extern "C" {
249     // FIXME change to unsafe extern "C" fn
SSL_CTX_set_cookie_generate_cb( s: *mut SSL_CTX, cb: Option< extern "C" fn(ssl: *mut SSL, cookie: *mut c_uchar, cookie_len: *mut c_uint) -> c_int, >, )250     pub fn SSL_CTX_set_cookie_generate_cb(
251         s: *mut SSL_CTX,
252         cb: Option<
253             extern "C" fn(ssl: *mut SSL, cookie: *mut c_uchar, cookie_len: *mut c_uint) -> c_int,
254         >,
255     );
256 }
257 
258 cfg_if! {
259     // const change in passed function pointer signature
260     if #[cfg(any(ossl110, libressl280))] {
261         extern "C" {
262             pub fn SSL_CTX_set_cookie_verify_cb(
263                 s: *mut SSL_CTX,
264                 cb: Option<
265                     extern "C" fn(ssl: *mut SSL, cookie: *const c_uchar, cookie_len: c_uint) -> c_int,
266                 >,
267             );
268         }
269     } else {
270         extern "C" {
271             pub fn SSL_CTX_set_cookie_verify_cb(
272                 s: *mut SSL_CTX,
273                 cb: Option<extern "C" fn(ssl: *mut SSL, cookie: *mut c_uchar, cookie_len: c_uint) -> c_int>,
274             );
275         }
276     }
277 }
278 
279 extern "C" {
280     #[cfg(ossl111)]
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, >, )281     pub fn SSL_CTX_set_stateless_cookie_generate_cb(
282         s: *mut SSL_CTX,
283         cb: Option<
284             unsafe extern "C" fn(
285                 ssl: *mut SSL,
286                 cookie: *mut c_uchar,
287                 cookie_len: *mut size_t,
288             ) -> c_int,
289         >,
290     );
291     #[cfg(ossl111)]
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, >, )292     pub fn SSL_CTX_set_stateless_cookie_verify_cb(
293         s: *mut SSL_CTX,
294         cb: Option<
295             unsafe extern "C" fn(
296                 ssl: *mut SSL,
297                 cookie: *const c_uchar,
298                 cookie_len: size_t,
299             ) -> c_int,
300         >,
301     );
302 
SSL_CTX_set_next_protos_advertised_cb( ssl: *mut SSL_CTX, cb: extern "C" fn( ssl: *mut SSL, out: *mut *const c_uchar, outlen: *mut c_uint, arg: *mut c_void, ) -> c_int, arg: *mut c_void, )303     pub fn SSL_CTX_set_next_protos_advertised_cb(
304         ssl: *mut SSL_CTX,
305         cb: extern "C" fn(
306             ssl: *mut SSL,
307             out: *mut *const c_uchar,
308             outlen: *mut c_uint,
309             arg: *mut c_void,
310         ) -> c_int,
311         arg: *mut c_void,
312     );
SSL_CTX_set_next_proto_select_cb( ssl: *mut SSL_CTX, cb: extern "C" fn( ssl: *mut SSL, out: *mut *mut c_uchar, outlen: *mut c_uchar, inbuf: *const c_uchar, inlen: c_uint, arg: *mut c_void, ) -> c_int, arg: *mut c_void, )313     pub fn SSL_CTX_set_next_proto_select_cb(
314         ssl: *mut SSL_CTX,
315         cb: extern "C" fn(
316             ssl: *mut SSL,
317             out: *mut *mut c_uchar,
318             outlen: *mut c_uchar,
319             inbuf: *const c_uchar,
320             inlen: c_uint,
321             arg: *mut c_void,
322         ) -> c_int,
323         arg: *mut c_void,
324     );
SSL_get0_next_proto_negotiated( s: *const SSL, data: *mut *const c_uchar, len: *mut c_uint, )325     pub fn SSL_get0_next_proto_negotiated(
326         s: *const SSL,
327         data: *mut *const c_uchar,
328         len: *mut c_uint,
329     );
330 
SSL_select_next_proto( out: *mut *mut c_uchar, outlen: *mut c_uchar, inbuf: *const c_uchar, inlen: c_uint, client: *const c_uchar, client_len: c_uint, ) -> c_int331     pub fn SSL_select_next_proto(
332         out: *mut *mut c_uchar,
333         outlen: *mut c_uchar,
334         inbuf: *const c_uchar,
335         inlen: c_uint,
336         client: *const c_uchar,
337         client_len: c_uint,
338     ) -> c_int;
339 }
340 
341 extern "C" {
342     #[cfg(any(ossl102, libressl261))]
SSL_CTX_set_alpn_protos(s: *mut SSL_CTX, data: *const c_uchar, len: c_uint) -> c_int343     pub fn SSL_CTX_set_alpn_protos(s: *mut SSL_CTX, data: *const c_uchar, len: c_uint) -> c_int;
344     #[cfg(any(ossl102, libressl261))]
SSL_set_alpn_protos(s: *mut SSL, data: *const c_uchar, len: c_uint) -> c_int345     pub fn SSL_set_alpn_protos(s: *mut SSL, data: *const c_uchar, len: c_uint) -> c_int;
346     #[cfg(any(ossl102, libressl261))]
347     #[link_name = "SSL_CTX_set_alpn_select_cb"]
SSL_CTX_set_alpn_select_cb__fixed_rust( ssl: *mut SSL_CTX, cb: Option< unsafe extern "C" fn( ssl: *mut SSL, out: *mut *const c_uchar, outlen: *mut c_uchar, inbuf: *const c_uchar, inlen: c_uint, arg: *mut c_void, ) -> c_int, >, arg: *mut c_void, )348     pub fn SSL_CTX_set_alpn_select_cb__fixed_rust(
349         ssl: *mut SSL_CTX,
350         cb: Option<
351             unsafe extern "C" fn(
352                 ssl: *mut SSL,
353                 out: *mut *const c_uchar,
354                 outlen: *mut c_uchar,
355                 inbuf: *const c_uchar,
356                 inlen: c_uint,
357                 arg: *mut c_void,
358             ) -> c_int,
359         >,
360         arg: *mut c_void,
361     );
362     #[cfg(any(ossl102, libressl261))]
SSL_get0_alpn_selected(s: *const SSL, data: *mut *const c_uchar, len: *mut c_uint)363     pub fn SSL_get0_alpn_selected(s: *const SSL, data: *mut *const c_uchar, len: *mut c_uint);
364 }
365 
366 #[cfg(not(osslconf = "OPENSSL_NO_PSK"))]
367 extern "C" {
SSL_CTX_set_psk_client_callback( ssl: *mut SSL_CTX, psk_client_cb: Option< extern "C" fn( *mut SSL, *const c_char, *mut c_char, c_uint, *mut c_uchar, c_uint, ) -> c_uint, >, )368     pub fn SSL_CTX_set_psk_client_callback(
369         ssl: *mut SSL_CTX,
370         psk_client_cb: Option<
371             extern "C" fn(
372                 *mut SSL,
373                 *const c_char,
374                 *mut c_char,
375                 c_uint,
376                 *mut c_uchar,
377                 c_uint,
378             ) -> c_uint,
379         >,
380     );
SSL_CTX_set_psk_server_callback( ssl: *mut SSL_CTX, psk_server_cb: Option< extern "C" fn(*mut SSL, *const c_char, *mut c_uchar, c_uint) -> c_uint, >, )381     pub fn SSL_CTX_set_psk_server_callback(
382         ssl: *mut SSL_CTX,
383         psk_server_cb: Option<
384             extern "C" fn(*mut SSL, *const c_char, *mut c_uchar, c_uint) -> c_uint,
385         >,
386     );
SSL_get_psk_identity_hint(ssl: *const SSL) -> *const c_char387     pub fn SSL_get_psk_identity_hint(ssl: *const SSL) -> *const c_char;
SSL_get_psk_identity(ssl: *const SSL) -> *const c_char388     pub fn SSL_get_psk_identity(ssl: *const SSL) -> *const c_char;
389 }
390 
391 extern "C" {
392     #[cfg(ossl111)]
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_int393     pub fn SSL_CTX_add_custom_ext(
394         ctx: *mut SSL_CTX,
395         ext_type: c_uint,
396         context: c_uint,
397         add_cb: SSL_custom_ext_add_cb_ex,
398         free_cb: SSL_custom_ext_free_cb_ex,
399         add_arg: *mut c_void,
400         parse_cb: SSL_custom_ext_parse_cb_ex,
401         parse_arg: *mut c_void,
402     ) -> c_int;
403 
404     #[cfg(ossl102)]
SSL_extension_supported(ext_type: c_uint) -> c_int405     pub fn SSL_extension_supported(ext_type: c_uint) -> c_int;
406 }
407 
408 #[cfg(ossl111)]
409 pub type SSL_CTX_keylog_cb_func =
410     Option<unsafe extern "C" fn(ssl: *const SSL, line: *const c_char)>;
411 
412 extern "C" {
413     #[cfg(ossl111)]
SSL_CTX_set_keylog_callback(ctx: *mut SSL_CTX, cb: SSL_CTX_keylog_cb_func)414     pub fn SSL_CTX_set_keylog_callback(ctx: *mut SSL_CTX, cb: SSL_CTX_keylog_cb_func);
415 
416     #[cfg(any(ossl111, libressl340))]
SSL_CTX_set_max_early_data(ctx: *mut SSL_CTX, max_early_data: u32) -> c_int417     pub fn SSL_CTX_set_max_early_data(ctx: *mut SSL_CTX, max_early_data: u32) -> c_int;
418     #[cfg(any(ossl111, libressl340))]
SSL_CTX_get_max_early_data(ctx: *const SSL_CTX) -> u32419     pub fn SSL_CTX_get_max_early_data(ctx: *const SSL_CTX) -> u32;
420     #[cfg(any(ossl111, libressl340))]
SSL_set_max_early_data(ctx: *mut SSL, max_early_data: u32) -> c_int421     pub fn SSL_set_max_early_data(ctx: *mut SSL, max_early_data: u32) -> c_int;
422     #[cfg(any(ossl111, libressl340))]
SSL_get_max_early_data(ctx: *const SSL) -> u32423     pub fn SSL_get_max_early_data(ctx: *const SSL) -> u32;
424 
SSL_get_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t425     pub fn SSL_get_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t;
SSL_get_peer_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t426     pub fn SSL_get_peer_finished(s: *const SSL, buf: *mut c_void, count: size_t) -> size_t;
427 
SSL_CTX_get_verify_mode(ctx: *const SSL_CTX) -> c_int428     pub fn SSL_CTX_get_verify_mode(ctx: *const SSL_CTX) -> c_int;
SSL_get_verify_mode(s: *const SSL) -> c_int429     pub fn SSL_get_verify_mode(s: *const SSL) -> c_int;
430 }
431 
432 const_ptr_api! {
433     extern "C" {
434         #[cfg(ossl110)]
435         pub fn SSL_is_init_finished(s: #[const_ptr_if(ossl111)] SSL) -> c_int;
436     }
437 }
438 
439 cfg_if! {
440     if #[cfg(libressl261)] {
441         extern "C" {
442             pub fn SSL_CTX_set_min_proto_version(ctx: *mut SSL_CTX, version: u16) -> c_int;
443             pub fn SSL_CTX_set_max_proto_version(ctx: *mut SSL_CTX, version: u16) -> c_int;
444             pub fn SSL_set_min_proto_version(s: *mut SSL, version: u16) -> c_int;
445             pub fn SSL_set_max_proto_version(s: *mut SSL, version: u16) -> c_int;
446         }
447     }
448 }
449 
450 cfg_if! {
451     if #[cfg(libressl270)] {
452         extern "C" {
453             pub fn SSL_CTX_get_min_proto_version(ctx: *mut SSL_CTX) -> c_int;
454             pub fn SSL_CTX_get_max_proto_version(ctx: *mut SSL_CTX) -> c_int;
455             pub fn SSL_get_min_proto_version(s: *mut SSL) -> c_int;
456             pub fn SSL_get_max_proto_version(s: *mut SSL) -> c_int;
457         }
458     }
459 }
460 
461 extern "C" {
SSL_CTX_set_cipher_list(ssl: *mut SSL_CTX, s: *const c_char) -> c_int462     pub fn SSL_CTX_set_cipher_list(ssl: *mut SSL_CTX, s: *const c_char) -> c_int;
SSL_CTX_new(method: *const SSL_METHOD) -> *mut SSL_CTX463     pub fn SSL_CTX_new(method: *const SSL_METHOD) -> *mut SSL_CTX;
SSL_CTX_free(ctx: *mut SSL_CTX)464     pub fn SSL_CTX_free(ctx: *mut SSL_CTX);
465     #[cfg(any(ossl110, libressl273))]
SSL_CTX_up_ref(x: *mut SSL_CTX) -> c_int466     pub fn SSL_CTX_up_ref(x: *mut SSL_CTX) -> c_int;
SSL_CTX_get_cert_store(ctx: *const SSL_CTX) -> *mut X509_STORE467     pub fn SSL_CTX_get_cert_store(ctx: *const SSL_CTX) -> *mut X509_STORE;
SSL_CTX_set_cert_store(ctx: *mut SSL_CTX, store: *mut X509_STORE)468     pub fn SSL_CTX_set_cert_store(ctx: *mut SSL_CTX, store: *mut X509_STORE);
469 
SSL_get_current_cipher(ssl: *const SSL) -> *const SSL_CIPHER470     pub fn SSL_get_current_cipher(ssl: *const SSL) -> *const SSL_CIPHER;
SSL_CIPHER_get_bits(cipher: *const SSL_CIPHER, alg_bits: *mut c_int) -> c_int471     pub fn SSL_CIPHER_get_bits(cipher: *const SSL_CIPHER, alg_bits: *mut c_int) -> c_int;
472 }
473 const_ptr_api! {
474     extern "C" {
475         pub fn SSL_CIPHER_get_version(cipher: *const SSL_CIPHER) -> #[const_ptr_if(any(ossl110, libressl280))] c_char;
476     }
477 }
478 extern "C" {
479     #[cfg(ossl111)]
SSL_CIPHER_get_handshake_digest(cipher: *const SSL_CIPHER) -> *const EVP_MD480     pub fn SSL_CIPHER_get_handshake_digest(cipher: *const SSL_CIPHER) -> *const EVP_MD;
SSL_CIPHER_get_name(cipher: *const SSL_CIPHER) -> *const c_char481     pub fn SSL_CIPHER_get_name(cipher: *const SSL_CIPHER) -> *const c_char;
482     #[cfg(ossl111)]
SSL_CIPHER_standard_name(cipher: *const SSL_CIPHER) -> *const c_char483     pub fn SSL_CIPHER_standard_name(cipher: *const SSL_CIPHER) -> *const c_char;
484     #[cfg(ossl111)]
OPENSSL_cipher_name(rfc_name: *const c_char) -> *const c_char485     pub fn OPENSSL_cipher_name(rfc_name: *const c_char) -> *const c_char;
486 
SSL_pending(ssl: *const SSL) -> c_int487     pub fn SSL_pending(ssl: *const SSL) -> c_int;
SSL_set_bio(ssl: *mut SSL, rbio: *mut BIO, wbio: *mut BIO)488     pub fn SSL_set_bio(ssl: *mut SSL, rbio: *mut BIO, wbio: *mut BIO);
SSL_get_rbio(ssl: *const SSL) -> *mut BIO489     pub fn SSL_get_rbio(ssl: *const SSL) -> *mut BIO;
SSL_get_wbio(ssl: *const SSL) -> *mut BIO490     pub fn SSL_get_wbio(ssl: *const SSL) -> *mut BIO;
491     #[cfg(any(ossl111, libressl340))]
SSL_CTX_set_ciphersuites(ctx: *mut SSL_CTX, str: *const c_char) -> c_int492     pub fn SSL_CTX_set_ciphersuites(ctx: *mut SSL_CTX, str: *const c_char) -> c_int;
493     #[cfg(any(ossl111, libressl340))]
SSL_set_ciphersuites(ssl: *mut SSL, str: *const c_char) -> c_int494     pub fn SSL_set_ciphersuites(ssl: *mut SSL, str: *const c_char) -> c_int;
SSL_set_cipher_list(ssl: *mut SSL, s: *const c_char) -> c_int495     pub fn SSL_set_cipher_list(ssl: *mut SSL, s: *const c_char) -> c_int;
SSL_set_ssl_method(s: *mut SSL, method: *const SSL_METHOD) -> c_int496     pub fn SSL_set_ssl_method(s: *mut SSL, method: *const SSL_METHOD) -> c_int;
SSL_set_verify( ssl: *mut SSL, mode: c_int, verify_callback: Option<extern "C" fn(c_int, *mut X509_STORE_CTX) -> c_int>, )497     pub fn SSL_set_verify(
498         ssl: *mut SSL,
499         mode: c_int,
500         // FIXME should be unsafe
501         verify_callback: Option<extern "C" fn(c_int, *mut X509_STORE_CTX) -> c_int>,
502     );
SSL_CTX_use_PrivateKey(ctx: *mut SSL_CTX, key: *mut EVP_PKEY) -> c_int503     pub fn SSL_CTX_use_PrivateKey(ctx: *mut SSL_CTX, key: *mut EVP_PKEY) -> c_int;
SSL_CTX_use_certificate(ctx: *mut SSL_CTX, cert: *mut X509) -> c_int504     pub fn SSL_CTX_use_certificate(ctx: *mut SSL_CTX, cert: *mut X509) -> c_int;
505 
SSL_CTX_use_PrivateKey_file( ctx: *mut SSL_CTX, key_file: *const c_char, file_type: c_int, ) -> c_int506     pub fn SSL_CTX_use_PrivateKey_file(
507         ctx: *mut SSL_CTX,
508         key_file: *const c_char,
509         file_type: c_int,
510     ) -> c_int;
SSL_CTX_use_certificate_file( ctx: *mut SSL_CTX, cert_file: *const c_char, file_type: c_int, ) -> c_int511     pub fn SSL_CTX_use_certificate_file(
512         ctx: *mut SSL_CTX,
513         cert_file: *const c_char,
514         file_type: c_int,
515     ) -> c_int;
SSL_CTX_use_certificate_chain_file( ctx: *mut SSL_CTX, cert_chain_file: *const c_char, ) -> c_int516     pub fn SSL_CTX_use_certificate_chain_file(
517         ctx: *mut SSL_CTX,
518         cert_chain_file: *const c_char,
519     ) -> c_int;
SSL_use_PrivateKey_file(ssl: *mut SSL, file: *const c_char, type_: c_int) -> c_int520     pub fn SSL_use_PrivateKey_file(ssl: *mut SSL, file: *const c_char, type_: c_int) -> c_int;
SSL_use_PrivateKey(ssl: *mut SSL, pkey: *mut EVP_PKEY) -> c_int521     pub fn SSL_use_PrivateKey(ssl: *mut SSL, pkey: *mut EVP_PKEY) -> c_int;
SSL_use_certificate(ssl: *mut SSL, x: *mut X509) -> c_int522     pub fn SSL_use_certificate(ssl: *mut SSL, x: *mut X509) -> c_int;
523     #[cfg(any(ossl110, libressl332))]
SSL_use_certificate_chain_file(ssl: *mut SSL, file: *const c_char) -> c_int524     pub fn SSL_use_certificate_chain_file(ssl: *mut SSL, file: *const c_char) -> c_int;
SSL_set_client_CA_list(s: *mut SSL, name_list: *mut stack_st_X509_NAME)525     pub fn SSL_set_client_CA_list(s: *mut SSL, name_list: *mut stack_st_X509_NAME);
SSL_add_client_CA(ssl: *mut SSL, x: *mut X509) -> c_int526     pub fn SSL_add_client_CA(ssl: *mut SSL, x: *mut X509) -> c_int;
SSL_load_client_CA_file(file: *const c_char) -> *mut stack_st_X509_NAME527     pub fn SSL_load_client_CA_file(file: *const c_char) -> *mut stack_st_X509_NAME;
528 
529     #[cfg(not(ossl110))]
SSL_load_error_strings()530     pub fn SSL_load_error_strings();
SSL_state_string(ssl: *const SSL) -> *const c_char531     pub fn SSL_state_string(ssl: *const SSL) -> *const c_char;
SSL_state_string_long(ssl: *const SSL) -> *const c_char532     pub fn SSL_state_string_long(ssl: *const SSL) -> *const c_char;
533 
SSL_SESSION_get_time(s: *const SSL_SESSION) -> c_long534     pub fn SSL_SESSION_get_time(s: *const SSL_SESSION) -> c_long;
SSL_SESSION_get_timeout(s: *const SSL_SESSION) -> c_long535     pub fn SSL_SESSION_get_timeout(s: *const SSL_SESSION) -> c_long;
536     #[cfg(any(ossl110, libressl270))]
SSL_SESSION_get_protocol_version(s: *const SSL_SESSION) -> c_int537     pub fn SSL_SESSION_get_protocol_version(s: *const SSL_SESSION) -> c_int;
538 
539     #[cfg(any(ossl111, libressl340))]
SSL_SESSION_set_max_early_data(ctx: *mut SSL_SESSION, max_early_data: u32) -> c_int540     pub fn SSL_SESSION_set_max_early_data(ctx: *mut SSL_SESSION, max_early_data: u32) -> c_int;
541     #[cfg(any(ossl111, libressl340))]
SSL_SESSION_get_max_early_data(ctx: *const SSL_SESSION) -> u32542     pub fn SSL_SESSION_get_max_early_data(ctx: *const SSL_SESSION) -> u32;
543 
SSL_SESSION_get_id(s: *const SSL_SESSION, len: *mut c_uint) -> *const c_uchar544     pub fn SSL_SESSION_get_id(s: *const SSL_SESSION, len: *mut c_uint) -> *const c_uchar;
545     #[cfg(any(ossl110, libressl273))]
SSL_SESSION_up_ref(ses: *mut SSL_SESSION) -> c_int546     pub fn SSL_SESSION_up_ref(ses: *mut SSL_SESSION) -> c_int;
SSL_SESSION_free(s: *mut SSL_SESSION)547     pub fn SSL_SESSION_free(s: *mut SSL_SESSION);
548 }
549 const_ptr_api! {
550     extern "C" {
551         pub fn i2d_SSL_SESSION(s: #[const_ptr_if(ossl300)] SSL_SESSION, pp: *mut *mut c_uchar) -> c_int;
552     }
553 }
554 extern "C" {
SSL_set_session(ssl: *mut SSL, session: *mut SSL_SESSION) -> c_int555     pub fn SSL_set_session(ssl: *mut SSL, session: *mut SSL_SESSION) -> c_int;
SSL_CTX_add_session(ctx: *mut SSL_CTX, session: *mut SSL_SESSION) -> c_int556     pub fn SSL_CTX_add_session(ctx: *mut SSL_CTX, session: *mut SSL_SESSION) -> c_int;
SSL_CTX_remove_session(ctx: *mut SSL_CTX, session: *mut SSL_SESSION) -> c_int557     pub fn SSL_CTX_remove_session(ctx: *mut SSL_CTX, session: *mut SSL_SESSION) -> c_int;
d2i_SSL_SESSION( a: *mut *mut SSL_SESSION, pp: *mut *const c_uchar, len: c_long, ) -> *mut SSL_SESSION558     pub fn d2i_SSL_SESSION(
559         a: *mut *mut SSL_SESSION,
560         pp: *mut *const c_uchar,
561         len: c_long,
562     ) -> *mut SSL_SESSION;
563 
564     #[cfg(not(ossl300))]
SSL_get_peer_certificate(ssl: *const SSL) -> *mut X509565     pub fn SSL_get_peer_certificate(ssl: *const SSL) -> *mut X509;
566     #[cfg(ossl300)]
SSL_get1_peer_certificate(ssl: *const SSL) -> *mut X509567     pub fn SSL_get1_peer_certificate(ssl: *const SSL) -> *mut X509;
568 
SSL_get_peer_cert_chain(ssl: *const SSL) -> *mut stack_st_X509569     pub fn SSL_get_peer_cert_chain(ssl: *const SSL) -> *mut stack_st_X509;
570 
SSL_CTX_set_verify( ctx: *mut SSL_CTX, mode: c_int, verify_callback: Option<extern "C" fn(c_int, *mut X509_STORE_CTX) -> c_int>, )571     pub fn SSL_CTX_set_verify(
572         ctx: *mut SSL_CTX,
573         mode: c_int,
574         verify_callback: Option<extern "C" fn(c_int, *mut X509_STORE_CTX) -> c_int>,
575     );
SSL_CTX_set_verify_depth(ctx: *mut SSL_CTX, depth: c_int)576     pub fn SSL_CTX_set_verify_depth(ctx: *mut SSL_CTX, depth: c_int);
577 
578     #[cfg(any(ossl111, libressl340))]
SSL_CTX_set_post_handshake_auth(ctx: *mut SSL_CTX, val: c_int)579     pub fn SSL_CTX_set_post_handshake_auth(ctx: *mut SSL_CTX, val: c_int);
580 
SSL_CTX_check_private_key(ctx: *const SSL_CTX) -> c_int581     pub fn SSL_CTX_check_private_key(ctx: *const SSL_CTX) -> c_int;
582 
SSL_CTX_set_session_id_context( ssl: *mut SSL_CTX, sid_ctx: *const c_uchar, sid_ctx_len: c_uint, ) -> c_int583     pub fn SSL_CTX_set_session_id_context(
584         ssl: *mut SSL_CTX,
585         sid_ctx: *const c_uchar,
586         sid_ctx_len: c_uint,
587     ) -> c_int;
588 
SSL_new(ctx: *mut SSL_CTX) -> *mut SSL589     pub fn SSL_new(ctx: *mut SSL_CTX) -> *mut SSL;
590 
591     #[cfg(any(ossl102, libressl261))]
SSL_CTX_get0_param(ctx: *mut SSL_CTX) -> *mut X509_VERIFY_PARAM592     pub fn SSL_CTX_get0_param(ctx: *mut SSL_CTX) -> *mut X509_VERIFY_PARAM;
593 
594     #[cfg(any(ossl102, libressl261))]
SSL_get0_param(ssl: *mut SSL) -> *mut X509_VERIFY_PARAM595     pub fn SSL_get0_param(ssl: *mut SSL) -> *mut X509_VERIFY_PARAM;
596 }
597 
598 #[cfg(ossl111)]
599 pub type SSL_client_hello_cb_fn =
600     Option<unsafe extern "C" fn(s: *mut SSL, al: *mut c_int, arg: *mut c_void) -> c_int>;
601 extern "C" {
602     #[cfg(ossl111)]
SSL_CTX_set_client_hello_cb( c: *mut SSL_CTX, cb: SSL_client_hello_cb_fn, arg: *mut c_void, )603     pub fn SSL_CTX_set_client_hello_cb(
604         c: *mut SSL_CTX,
605         cb: SSL_client_hello_cb_fn,
606         arg: *mut c_void,
607     );
608     #[cfg(ossl111)]
SSL_client_hello_isv2(s: *mut SSL) -> c_int609     pub fn SSL_client_hello_isv2(s: *mut SSL) -> c_int;
610     #[cfg(ossl111)]
SSL_client_hello_get0_legacy_version(s: *mut SSL) -> c_uint611     pub fn SSL_client_hello_get0_legacy_version(s: *mut SSL) -> c_uint;
612     #[cfg(ossl111)]
SSL_client_hello_get0_random(s: *mut SSL, out: *mut *const c_uchar) -> size_t613     pub fn SSL_client_hello_get0_random(s: *mut SSL, out: *mut *const c_uchar) -> size_t;
614     #[cfg(ossl111)]
SSL_client_hello_get0_session_id(s: *mut SSL, out: *mut *const c_uchar) -> size_t615     pub fn SSL_client_hello_get0_session_id(s: *mut SSL, out: *mut *const c_uchar) -> size_t;
616     #[cfg(ossl111)]
SSL_client_hello_get0_ciphers(s: *mut SSL, out: *mut *const c_uchar) -> size_t617     pub fn SSL_client_hello_get0_ciphers(s: *mut SSL, out: *mut *const c_uchar) -> size_t;
618     #[cfg(ossl111)]
SSL_client_hello_get0_compression_methods( s: *mut SSL, out: *mut *const c_uchar, ) -> size_t619     pub fn SSL_client_hello_get0_compression_methods(
620         s: *mut SSL,
621         out: *mut *const c_uchar,
622     ) -> size_t;
623     #[cfg(ossl111)]
SSL_client_hello_get1_extensions_present( s: *mut SSL, out: *mut *mut c_int, outlen: *mut size_t, ) -> c_int624     pub fn SSL_client_hello_get1_extensions_present(
625         s: *mut SSL,
626         out: *mut *mut c_int,
627         outlen: *mut size_t,
628     ) -> c_int;
629     #[cfg(ossl111)]
SSL_client_hello_get0_ext( s: *mut SSL, type_: c_uint, out: *mut *const c_uchar, outlen: *mut size_t, ) -> c_int630     pub fn SSL_client_hello_get0_ext(
631         s: *mut SSL,
632         type_: c_uint,
633         out: *mut *const c_uchar,
634         outlen: *mut size_t,
635     ) -> c_int;
636 
SSL_free(ssl: *mut SSL)637     pub fn SSL_free(ssl: *mut SSL);
SSL_accept(ssl: *mut SSL) -> c_int638     pub fn SSL_accept(ssl: *mut SSL) -> c_int;
639     #[cfg(ossl111)]
SSL_stateless(s: *mut SSL) -> c_int640     pub fn SSL_stateless(s: *mut SSL) -> c_int;
SSL_connect(ssl: *mut SSL) -> c_int641     pub fn SSL_connect(ssl: *mut SSL) -> c_int;
SSL_read(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int642     pub fn SSL_read(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int;
SSL_peek(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int643     pub fn SSL_peek(ssl: *mut SSL, buf: *mut c_void, num: c_int) -> c_int;
644     #[cfg(any(ossl111, libressl340))]
SSL_read_early_data( s: *mut SSL, buf: *mut c_void, num: size_t, readbytes: *mut size_t, ) -> c_int645     pub fn SSL_read_early_data(
646         s: *mut SSL,
647         buf: *mut c_void,
648         num: size_t,
649         readbytes: *mut size_t,
650     ) -> c_int;
651     #[cfg(ossl111)]
SSL_bytes_to_cipher_list( s: *mut SSL, bytes: *const c_uchar, len: size_t, isv2format: c_int, sk: *mut *mut stack_st_SSL_CIPHER, scsvs: *mut *mut stack_st_SSL_CIPHER, ) -> c_int652     pub fn SSL_bytes_to_cipher_list(
653         s: *mut SSL,
654         bytes: *const c_uchar,
655         len: size_t,
656         isv2format: c_int,
657         sk: *mut *mut stack_st_SSL_CIPHER,
658         scsvs: *mut *mut stack_st_SSL_CIPHER,
659     ) -> c_int;
660 }
661 
662 extern "C" {
SSL_write(ssl: *mut SSL, buf: *const c_void, num: c_int) -> c_int663     pub fn SSL_write(ssl: *mut SSL, buf: *const c_void, num: c_int) -> c_int;
664     #[cfg(any(ossl111, libressl340))]
SSL_write_early_data( s: *mut SSL, buf: *const c_void, num: size_t, written: *mut size_t, ) -> c_int665     pub fn SSL_write_early_data(
666         s: *mut SSL,
667         buf: *const c_void,
668         num: size_t,
669         written: *mut size_t,
670     ) -> c_int;
SSL_ctrl(ssl: *mut SSL, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long671     pub fn SSL_ctrl(ssl: *mut SSL, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long;
SSL_CTX_ctrl(ctx: *mut SSL_CTX, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long672     pub fn SSL_CTX_ctrl(ctx: *mut SSL_CTX, cmd: c_int, larg: c_long, parg: *mut c_void) -> c_long;
673     #[link_name = "SSL_CTX_callback_ctrl"]
SSL_CTX_callback_ctrl__fixed_rust( ctx: *mut SSL_CTX, cmd: c_int, fp: Option<unsafe extern "C" fn()>, ) -> c_long674     pub fn SSL_CTX_callback_ctrl__fixed_rust(
675         ctx: *mut SSL_CTX,
676         cmd: c_int,
677         fp: Option<unsafe extern "C" fn()>,
678     ) -> c_long;
679 }
680 
681 cfg_if! {
682     if #[cfg(any(ossl110, libressl291))] {
683         extern "C" {
684             pub fn TLS_method() -> *const SSL_METHOD;
685 
686             pub fn DTLS_method() -> *const SSL_METHOD;
687 
688             pub fn TLS_server_method() -> *const SSL_METHOD;
689 
690             pub fn TLS_client_method() -> *const SSL_METHOD;
691         }
692     } else {
693         extern "C" {
694             #[cfg(not(osslconf = "OPENSSL_NO_SSL3_METHOD"))]
695             pub fn SSLv3_method() -> *const SSL_METHOD;
696 
697             pub fn SSLv23_method() -> *const SSL_METHOD;
698 
699             pub fn SSLv23_client_method() -> *const SSL_METHOD;
700 
701             pub fn SSLv23_server_method() -> *const SSL_METHOD;
702 
703             pub fn TLSv1_method() -> *const SSL_METHOD;
704 
705             pub fn TLSv1_1_method() -> *const SSL_METHOD;
706 
707             pub fn TLSv1_2_method() -> *const SSL_METHOD;
708 
709             pub fn DTLSv1_method() -> *const SSL_METHOD;
710 
711             #[cfg(ossl102)]
712             pub fn DTLSv1_2_method() -> *const SSL_METHOD;
713         }
714     }
715 }
716 
717 extern "C" {
SSL_get_error(ssl: *const SSL, ret: c_int) -> c_int718     pub fn SSL_get_error(ssl: *const SSL, ret: c_int) -> c_int;
SSL_get_version(ssl: *const SSL) -> *const c_char719     pub fn SSL_get_version(ssl: *const SSL) -> *const c_char;
720 
SSL_do_handshake(ssl: *mut SSL) -> c_int721     pub fn SSL_do_handshake(ssl: *mut SSL) -> c_int;
SSL_shutdown(ssl: *mut SSL) -> c_int722     pub fn SSL_shutdown(ssl: *mut SSL) -> c_int;
723 
SSL_CTX_set_client_CA_list(ctx: *mut SSL_CTX, list: *mut stack_st_X509_NAME)724     pub fn SSL_CTX_set_client_CA_list(ctx: *mut SSL_CTX, list: *mut stack_st_X509_NAME);
725 
SSL_CTX_add_client_CA(ctx: *mut SSL_CTX, cacert: *mut X509) -> c_int726     pub fn SSL_CTX_add_client_CA(ctx: *mut SSL_CTX, cacert: *mut X509) -> c_int;
727 
SSL_CTX_set_default_verify_paths(ctx: *mut SSL_CTX) -> c_int728     pub fn SSL_CTX_set_default_verify_paths(ctx: *mut SSL_CTX) -> c_int;
SSL_CTX_load_verify_locations( ctx: *mut SSL_CTX, CAfile: *const c_char, CApath: *const c_char, ) -> c_int729     pub fn SSL_CTX_load_verify_locations(
730         ctx: *mut SSL_CTX,
731         CAfile: *const c_char,
732         CApath: *const c_char,
733     ) -> c_int;
734 }
735 
736 const_ptr_api! {
737     extern "C" {
738         pub fn SSL_get_ssl_method(ssl: #[const_ptr_if(ossl111b)] SSL) -> *const SSL_METHOD;
739     }
740 }
741 
742 extern "C" {
SSL_set_connect_state(s: *mut SSL)743     pub fn SSL_set_connect_state(s: *mut SSL);
SSL_set_accept_state(s: *mut SSL)744     pub fn SSL_set_accept_state(s: *mut SSL);
745 
746     #[cfg(not(ossl110))]
SSL_library_init() -> c_int747     pub fn SSL_library_init() -> c_int;
748 
SSL_CIPHER_description( cipher: *const SSL_CIPHER, buf: *mut c_char, size: c_int, ) -> *mut c_char749     pub fn SSL_CIPHER_description(
750         cipher: *const SSL_CIPHER,
751         buf: *mut c_char,
752         size: c_int,
753     ) -> *mut c_char;
754 
SSL_get_certificate(ssl: *const SSL) -> *mut X509755     pub fn SSL_get_certificate(ssl: *const SSL) -> *mut X509;
756 }
757 const_ptr_api! {
758     extern "C" {
759         pub fn SSL_get_privatekey(ssl: #[const_ptr_if(any(ossl102, libressl280))] SSL) -> *mut EVP_PKEY;
760     }
761 }
762 
763 extern "C" {
764     #[cfg(any(ossl102, libressl270))]
SSL_CTX_get0_certificate(ctx: *const SSL_CTX) -> *mut X509765     pub fn SSL_CTX_get0_certificate(ctx: *const SSL_CTX) -> *mut X509;
766     #[cfg(any(ossl102, libressl340))]
SSL_CTX_get0_privatekey(ctx: *const SSL_CTX) -> *mut EVP_PKEY767     pub fn SSL_CTX_get0_privatekey(ctx: *const SSL_CTX) -> *mut EVP_PKEY;
768 
SSL_set_shutdown(ss: *mut SSL, mode: c_int)769     pub fn SSL_set_shutdown(ss: *mut SSL, mode: c_int);
SSL_get_shutdown(ssl: *const SSL) -> c_int770     pub fn SSL_get_shutdown(ssl: *const SSL) -> c_int;
SSL_version(ssl: *const SSL) -> c_int771     pub fn SSL_version(ssl: *const SSL) -> c_int;
SSL_get_session(s: *const SSL) -> *mut SSL_SESSION772     pub fn SSL_get_session(s: *const SSL) -> *mut SSL_SESSION;
SSL_get_SSL_CTX(ssl: *const SSL) -> *mut SSL_CTX773     pub fn SSL_get_SSL_CTX(ssl: *const SSL) -> *mut SSL_CTX;
SSL_set_SSL_CTX(ssl: *mut SSL, ctx: *mut SSL_CTX) -> *mut SSL_CTX774     pub fn SSL_set_SSL_CTX(ssl: *mut SSL, ctx: *mut SSL_CTX) -> *mut SSL_CTX;
775 
SSL_get_verify_result(ssl: *const SSL) -> c_long776     pub fn SSL_get_verify_result(ssl: *const SSL) -> c_long;
777     #[cfg(ossl110)]
SSL_get0_verified_chain(ssl: *const SSL) -> *mut stack_st_X509778     pub fn SSL_get0_verified_chain(ssl: *const SSL) -> *mut stack_st_X509;
779 
780     #[cfg(any(ossl110, libressl270))]
SSL_get_client_random(ssl: *const SSL, out: *mut c_uchar, len: size_t) -> size_t781     pub fn SSL_get_client_random(ssl: *const SSL, out: *mut c_uchar, len: size_t) -> size_t;
782     #[cfg(any(ossl110, libressl270))]
SSL_get_server_random(ssl: *const SSL, out: *mut c_uchar, len: size_t) -> size_t783     pub fn SSL_get_server_random(ssl: *const SSL, out: *mut c_uchar, len: size_t) -> size_t;
784     #[cfg(any(ossl110, libressl273))]
SSL_SESSION_get_master_key( session: *const SSL_SESSION, out: *mut c_uchar, outlen: size_t, ) -> size_t785     pub fn SSL_SESSION_get_master_key(
786         session: *const SSL_SESSION,
787         out: *mut c_uchar,
788         outlen: size_t,
789     ) -> size_t;
790 }
791 
792 extern "C" {
793     #[cfg(not(ossl110))]
SSL_get_ex_new_index( argl: c_long, argp: *mut c_void, new_func: Option<CRYPTO_EX_new>, dup_func: Option<CRYPTO_EX_dup>, free_func: Option<CRYPTO_EX_free>, ) -> c_int794     pub fn SSL_get_ex_new_index(
795         argl: c_long,
796         argp: *mut c_void,
797         new_func: Option<CRYPTO_EX_new>,
798         dup_func: Option<CRYPTO_EX_dup>,
799         free_func: Option<CRYPTO_EX_free>,
800     ) -> c_int;
801 
SSL_set_ex_data(ssl: *mut SSL, idx: c_int, data: *mut c_void) -> c_int802     pub fn SSL_set_ex_data(ssl: *mut SSL, idx: c_int, data: *mut c_void) -> c_int;
SSL_get_ex_data(ssl: *const SSL, idx: c_int) -> *mut c_void803     pub fn SSL_get_ex_data(ssl: *const SSL, idx: c_int) -> *mut c_void;
804 
805     #[cfg(not(ossl110))]
SSL_CTX_get_ex_new_index( argl: c_long, argp: *mut c_void, new_func: Option<CRYPTO_EX_new>, dup_func: Option<CRYPTO_EX_dup>, free_func: Option<CRYPTO_EX_free>, ) -> c_int806     pub fn SSL_CTX_get_ex_new_index(
807         argl: c_long,
808         argp: *mut c_void,
809         new_func: Option<CRYPTO_EX_new>,
810         dup_func: Option<CRYPTO_EX_dup>,
811         free_func: Option<CRYPTO_EX_free>,
812     ) -> c_int;
813 
SSL_CTX_set_ex_data(ctx: *mut SSL_CTX, idx: c_int, data: *mut c_void) -> c_int814     pub fn SSL_CTX_set_ex_data(ctx: *mut SSL_CTX, idx: c_int, data: *mut c_void) -> c_int;
SSL_CTX_get_ex_data(ctx: *const SSL_CTX, idx: c_int) -> *mut c_void815     pub fn SSL_CTX_get_ex_data(ctx: *const SSL_CTX, idx: c_int) -> *mut c_void;
816 
SSL_get_ex_data_X509_STORE_CTX_idx() -> c_int817     pub fn SSL_get_ex_data_X509_STORE_CTX_idx() -> c_int;
818 }
819 
820 extern "C" {
821     #[link_name = "SSL_CTX_set_tmp_dh_callback"]
SSL_CTX_set_tmp_dh_callback__fixed_rust( ctx: *mut SSL_CTX, dh: Option< unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut DH, >, )822     pub fn SSL_CTX_set_tmp_dh_callback__fixed_rust(
823         ctx: *mut SSL_CTX,
824         dh: Option<
825             unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut DH,
826         >,
827     );
828     #[link_name = "SSL_set_tmp_dh_callback"]
SSL_set_tmp_dh_callback__fixed_rust( ctx: *mut SSL, dh: Option< unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut DH, >, )829     pub fn SSL_set_tmp_dh_callback__fixed_rust(
830         ctx: *mut SSL,
831         dh: Option<
832             unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut DH,
833         >,
834     );
835     #[cfg(not(ossl110))]
836     #[link_name = "SSL_CTX_set_tmp_ecdh_callback"]
SSL_CTX_set_tmp_ecdh_callback__fixed_rust( ctx: *mut SSL_CTX, ecdh: Option< unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut EC_KEY, >, )837     pub fn SSL_CTX_set_tmp_ecdh_callback__fixed_rust(
838         ctx: *mut SSL_CTX,
839         ecdh: Option<
840             unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut EC_KEY,
841         >,
842     );
843     #[cfg(not(ossl110))]
844     #[link_name = "SSL_set_tmp_ecdh_callback"]
SSL_set_tmp_ecdh_callback__fixed_rust( ssl: *mut SSL, ecdh: Option< unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut EC_KEY, >, )845     pub fn SSL_set_tmp_ecdh_callback__fixed_rust(
846         ssl: *mut SSL,
847         ecdh: Option<
848             unsafe extern "C" fn(ssl: *mut SSL, is_export: c_int, keylength: c_int) -> *mut EC_KEY,
849         >,
850     );
851 }
852 
853 cfg_if! {
854     if #[cfg(libressl)] {
855         extern "C" {
856             pub fn SSL_get_current_compression(ssl: *mut SSL) -> *const libc::c_void;
857         }
858     } else if #[cfg(not(osslconf = "OPENSSL_NO_COMP"))] {
859         const_ptr_api! {
860             extern "C" {
861                 pub fn SSL_get_current_compression(ssl: #[const_ptr_if(ossl111b)] SSL) -> *const COMP_METHOD;
862             }
863         }
864     }
865 }
866 cfg_if! {
867     if #[cfg(libressl)] {
868         extern "C" {
869             pub fn SSL_COMP_get_name(comp: *const libc::c_void) -> *const c_char;
870         }
871     } else if #[cfg(not(osslconf = "OPENSSL_NO_COMP"))] {
872         extern "C" {
873             pub fn SSL_COMP_get_name(comp: *const COMP_METHOD) -> *const c_char;
874         }
875     }
876 }
877 
878 #[cfg(not(osslconf = "OPENSSL_NO_COMP"))]
879 extern "C" {
880     #[cfg(ossl110)]
COMP_get_type(meth: *const COMP_METHOD) -> i32881     pub fn COMP_get_type(meth: *const COMP_METHOD) -> i32;
882 }
883 
884 extern "C" {
885     #[cfg(any(ossl110, libressl270))]
SSL_CIPHER_get_cipher_nid(c: *const SSL_CIPHER) -> c_int886     pub fn SSL_CIPHER_get_cipher_nid(c: *const SSL_CIPHER) -> c_int;
887     #[cfg(any(ossl110, libressl270))]
SSL_CIPHER_get_digest_nid(c: *const SSL_CIPHER) -> c_int888     pub fn SSL_CIPHER_get_digest_nid(c: *const SSL_CIPHER) -> c_int;
889 }
890 
891 const_ptr_api! {
892     extern "C" {
893         #[cfg(ossl110)]
894         pub fn SSL_session_reused(ssl: #[const_ptr_if(ossl111c)] SSL) -> c_int;
895     }
896 }
897 
898 const_ptr_api! {
899     extern "C" {
900         #[cfg(any(ossl102, libressl273))]
901         pub fn SSL_is_server(s: #[const_ptr_if(any(ossl110f, libressl273))] SSL) -> c_int;
902     }
903 }
904 
905 extern "C" {
906     #[cfg(ossl110)]
OPENSSL_init_ssl(opts: u64, settings: *const OPENSSL_INIT_SETTINGS) -> c_int907     pub fn OPENSSL_init_ssl(opts: u64, settings: *const OPENSSL_INIT_SETTINGS) -> c_int;
908 }
909 
910 extern "C" {
911     #[cfg(ossl111)]
SSL_CTX_set_num_tickets(ctx: *mut SSL_CTX, num_tickets: size_t) -> c_int912     pub fn SSL_CTX_set_num_tickets(ctx: *mut SSL_CTX, num_tickets: size_t) -> c_int;
913 
914     #[cfg(ossl111)]
SSL_set_num_tickets(s: *mut SSL, num_tickets: size_t) -> c_int915     pub fn SSL_set_num_tickets(s: *mut SSL, num_tickets: size_t) -> c_int;
916 
917     #[cfg(ossl111b)]
SSL_CTX_get_num_tickets(ctx: *const SSL_CTX) -> size_t918     pub fn SSL_CTX_get_num_tickets(ctx: *const SSL_CTX) -> size_t;
919     #[cfg(all(ossl111, not(ossl111b)))]
SSL_CTX_get_num_tickets(ctx: *mut SSL_CTX) -> size_t920     pub fn SSL_CTX_get_num_tickets(ctx: *mut SSL_CTX) -> size_t;
921 
922     #[cfg(ossl111b)]
SSL_get_num_tickets(s: *const SSL) -> size_t923     pub fn SSL_get_num_tickets(s: *const SSL) -> size_t;
924     #[cfg(all(ossl111, not(ossl111b)))]
SSL_get_num_tickets(s: *mut SSL) -> size_t925     pub fn SSL_get_num_tickets(s: *mut SSL) -> size_t;
926 }
927