1#![allow(
2 clippy::missing_safety_doc,
3 dead_code,
4 non_camel_case_types,
5 non_snake_case,
6 non_upper_case_globals,
7 unused_imports
8)]
9#![doc(html_root_url = "https://docs.rs/variant-ssl-sys/0.15")]
10#![recursion_limit = "128"] extern crate libc;
13pub use std::ffi::c_int;
14
15#[cfg(feature = "boringssl")]
16extern crate bssl_sys;
17#[cfg(feature = "boringssl")]
18pub use bssl_sys::*;
19
20#[cfg(feature = "aws-lc")]
21extern crate aws_lc_sys;
22
23#[cfg(awslc)]
24#[allow(unpredictable_function_pointer_comparisons)]
25mod aws_lc {
26 #[cfg(all(feature = "aws-lc", not(feature = "aws-lc-fips")))]
27 pub use aws_lc_sys::*;
28
29 #[cfg(feature = "aws-lc-fips")]
30 pub use aws_lc_fips_sys::*;
31
32 #[cfg(not(any(feature = "aws-lc", feature = "aws-lc-fips")))]
33 include!(concat!(env!("OUT_DIR"), "/bindgen.rs"));
34
35 use std::ffi::{c_char, c_int, c_long, c_uint, c_void};
36
37 pub fn init() {
38 unsafe { CRYPTO_library_init() }
39 }
40
41 #[allow(non_snake_case)]
43 pub unsafe fn BIO_get_mem_data(b: *mut BIO, pp: *mut *mut c_char) -> c_long {
44 unsafe { BIO_ctrl(b, BIO_CTRL_INFO, 0, pp.cast::<c_void>()) }
45 }
46
47 #[cfg(awslc_pregenerated)]
55 #[allow(non_snake_case, clippy::cast_possible_wrap)]
56 pub fn ERR_GET_LIB(packed_error: c_uint) -> c_int {
57 ((packed_error >> 24) & 0xFF) as c_int
58 }
59
60 #[cfg(awslc_pregenerated)]
61 #[allow(non_snake_case, clippy::cast_possible_wrap)]
62 pub fn ERR_GET_REASON(packed_error: c_uint) -> c_int {
63 (packed_error & 0xFFF) as c_int
64 }
65
66 #[cfg(awslc_pregenerated)]
67 #[allow(non_snake_case)]
68 pub fn ERR_GET_FUNC(_packed_error: c_uint) -> c_int {
69 0
70 }
71}
72#[cfg(awslc)]
73pub use aws_lc::*;
74
75#[cfg(openssl)]
76#[path = "."]
77mod openssl {
78 use std::ffi::{c_char, c_int, c_void};
79
80 #[cfg(feature = "bindgen")]
81 include!(concat!(env!("OUT_DIR"), "/bindgen.rs"));
82
83 pub use self::aes::*;
84 pub use self::asn1::*;
85 pub use self::bio::*;
86 pub use self::bn::*;
87 pub use self::cms::*;
88 #[cfg(ossl300)]
89 pub use self::core_dispatch::*;
90 pub use self::crypto::*;
91 pub use self::dh::*;
92 pub use self::dsa::*;
93 pub use self::dtls1::*;
94 pub use self::ec::*;
95 pub use self::err::*;
96 pub use self::evp::*;
97 #[cfg(not(feature = "bindgen"))]
98 pub use self::handwritten::*;
99 #[cfg(tongsuo)]
100 pub use self::ntls::*;
101 pub use self::obj_mac::*;
102 pub use self::ocsp::*;
103 pub use self::pem::*;
104 pub use self::pkcs7::*;
105 pub use self::rsa::*;
106 pub use self::sha::*;
107 pub use self::srtp::*;
108 pub use self::ssl::*;
109 pub use self::ssl3::*;
110 pub use self::tls1::*;
111 pub use self::types::*;
112 pub use self::x509::*;
113 pub use self::x509_vfy::*;
114 pub use self::x509v3::*;
115
116 #[macro_use]
117 mod macros;
118
119 mod aes;
120 mod asn1;
121 mod bio;
122 mod bn;
123 mod cms;
124 #[cfg(ossl300)]
125 mod core_dispatch;
126 mod crypto;
127 mod dh;
128 mod dsa;
129 mod dtls1;
130 mod ec;
131 mod err;
132 mod evp;
133 #[cfg(not(feature = "bindgen"))]
134 mod handwritten;
135 #[cfg(tongsuo)]
136 mod ntls;
137 mod obj_mac;
138 mod ocsp;
139 mod pem;
140 mod pkcs7;
141 mod rsa;
142 mod sha;
143 mod srtp;
144 mod ssl;
145 mod ssl3;
146 mod tls1;
147 mod types;
148 mod x509;
149 mod x509_vfy;
150 mod x509v3;
151
152 use std::sync::Once;
153 static INIT: Once = Once::new();
155
156 pub type PasswordCallback = unsafe extern "C" fn(
158 buf: *mut c_char,
159 size: c_int,
160 rwflag: c_int,
161 user_data: *mut c_void,
162 ) -> c_int;
163
164 #[cfg(ossl110)]
165 pub fn init() {
166 use std::ptr;
167
168 #[cfg(not(ossl111b))]
169 let init_options = OPENSSL_INIT_LOAD_SSL_STRINGS;
170 #[cfg(ossl111b)]
171 let init_options = OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_NO_ATEXIT;
172
173 INIT.call_once(|| unsafe {
174 OPENSSL_init_ssl(init_options, ptr::null_mut());
175 })
176 }
177
178 #[cfg(libressl)]
179 pub fn init() {}
180
181 pub unsafe fn assume_init() {
191 INIT.call_once(|| {});
192 }
193}
194#[cfg(openssl)]
195pub use openssl::*;