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