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