]> git.proxmox.com Git - cargo.git/blob - vendor/openssl-sys/src/tls1.rs
New upstream version 0.63.1
[cargo.git] / vendor / openssl-sys / src / tls1.rs
1 use libc::*;
2 use std::mem;
3 use std::ptr;
4
5 use *;
6
7 pub const TLS1_VERSION: c_int = 0x301;
8 pub const TLS1_1_VERSION: c_int = 0x302;
9 pub const TLS1_2_VERSION: c_int = 0x303;
10 #[cfg(any(ossl111, libressl340))]
11 pub const TLS1_3_VERSION: c_int = 0x304;
12
13 pub const TLS1_AD_DECODE_ERROR: c_int = 50;
14 pub const TLS1_AD_UNRECOGNIZED_NAME: c_int = 112;
15
16 pub const TLSEXT_NAMETYPE_host_name: c_int = 0;
17 pub const TLSEXT_STATUSTYPE_ocsp: c_int = 1;
18
19 pub unsafe fn SSL_set_tlsext_host_name(s: *mut SSL, name: *mut c_char) -> c_long {
20 SSL_ctrl(
21 s,
22 SSL_CTRL_SET_TLSEXT_HOSTNAME,
23 TLSEXT_NAMETYPE_host_name as c_long,
24 name as *mut c_void,
25 )
26 }
27
28 pub unsafe fn SSL_set_tlsext_status_type(s: *mut SSL, type_: c_int) -> c_long {
29 SSL_ctrl(
30 s,
31 SSL_CTRL_SET_TLSEXT_STATUS_REQ_TYPE,
32 type_ as c_long,
33 ptr::null_mut(),
34 )
35 }
36
37 pub unsafe fn SSL_get_tlsext_status_ocsp_resp(ssl: *mut SSL, resp: *mut *mut c_uchar) -> c_long {
38 SSL_ctrl(
39 ssl,
40 SSL_CTRL_GET_TLSEXT_STATUS_REQ_OCSP_RESP,
41 0,
42 resp as *mut c_void,
43 )
44 }
45
46 pub unsafe fn SSL_set_tlsext_status_ocsp_resp(
47 ssl: *mut SSL,
48 resp: *mut c_uchar,
49 len: c_long,
50 ) -> c_long {
51 SSL_ctrl(
52 ssl,
53 SSL_CTRL_SET_TLSEXT_STATUS_REQ_OCSP_RESP,
54 len,
55 resp as *mut c_void,
56 )
57 }
58
59 #[deprecated(note = "use SSL_CTX_set_tlsext_servername_callback__fixed_rust instead")]
60 #[allow(deprecated)]
61 pub unsafe fn SSL_CTX_set_tlsext_servername_callback(
62 ctx: *mut SSL_CTX,
63 // FIXME should have the right signature
64 cb: Option<extern "C" fn()>,
65 ) -> c_long {
66 SSL_CTX_callback_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_CB, cb)
67 }
68
69 pub unsafe fn SSL_CTX_set_tlsext_servername_callback__fixed_rust(
70 ctx: *mut SSL_CTX,
71 cb: Option<unsafe extern "C" fn(*mut SSL, *mut c_int, *mut c_void) -> c_int>,
72 ) -> c_long {
73 SSL_CTX_callback_ctrl__fixed_rust(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_CB, mem::transmute(cb))
74 }
75
76 pub const SSL_TLSEXT_ERR_OK: c_int = 0;
77 pub const SSL_TLSEXT_ERR_ALERT_WARNING: c_int = 1;
78 pub const SSL_TLSEXT_ERR_ALERT_FATAL: c_int = 2;
79 pub const SSL_TLSEXT_ERR_NOACK: c_int = 3;
80
81 pub unsafe fn SSL_CTX_set_tlsext_servername_arg(ctx: *mut SSL_CTX, arg: *mut c_void) -> c_long {
82 SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_SERVERNAME_ARG, 0, arg)
83 }
84
85 pub unsafe fn SSL_CTX_set_tlsext_status_cb(
86 ctx: *mut SSL_CTX,
87 cb: Option<unsafe extern "C" fn(*mut SSL, *mut c_void) -> c_int>,
88 ) -> c_long {
89 SSL_CTX_callback_ctrl__fixed_rust(ctx, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB, mem::transmute(cb))
90 }
91
92 pub unsafe fn SSL_CTX_set_tlsext_status_arg(ctx: *mut SSL_CTX, arg: *mut c_void) -> c_long {
93 SSL_CTX_ctrl(ctx, SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB_ARG, 0, arg)
94 }