1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#![deny(trivial_numeric_casts, unused_qualifications)]
#![forbid(anonymous_parameters, unused_import_braces, unused_results, warnings)]
#[cfg(feature = "jemalloc_allocator")]
#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
#[cfg(feature = "error_strings")]
#[macro_use]
extern crate enum_to_u8_slice_derive;
use ring::rand;
use ring::rand::SecureRandom;
#[doc(hidden)]
pub(self) const MAGIC_SIZE: usize = 4;
use lazy_static::lazy_static;
lazy_static! {
#[doc(hidden)]
pub(self) static ref MAGIC: [u8; MAGIC_SIZE] = {
let mut number = [0u8; MAGIC_SIZE];
if rand::SystemRandom::new().fill(&mut number).is_ok() {
number
} else {
panic!("Getrandom error");
}
};
}
#[doc(hidden)]
pub(crate) trait OpaquePointerGuard {
fn check_magic(&self) -> bool;
}
#[macro_use]
mod macros;
#[macro_use]
mod error_san;
#[allow(improper_ctypes)]
pub mod libssl;
#[allow(improper_ctypes)]
pub mod libcrypto;