1 use libc::*;
2 
3 pub const ERR_TXT_MALLOCED: c_int = 0x01;
4 pub const ERR_TXT_STRING: c_int = 0x02;
5 
6 pub const ERR_LIB_PEM: c_int = 9;
7 
8 const_fn! {
9     pub const fn ERR_PACK(l: c_int, f: c_int, r: c_int) -> c_ulong {
10         ((l as c_ulong & 0x0FF) << 24) |
11         ((f as c_ulong & 0xFFF) << 12) |
12         (r as c_ulong & 0xFFF)
13     }
14 
15     pub const fn ERR_GET_LIB(l: c_ulong) -> c_int {
16         ((l >> 24) & 0x0FF) as c_int
17     }
18 
19     pub const fn ERR_GET_FUNC(l: c_ulong) -> c_int {
20         ((l >> 12) & 0xFFF) as c_int
21     }
22 
23     pub const fn ERR_GET_REASON(l: c_ulong) -> c_int {
24         (l & 0xFFF) as c_int
25     }
26 }
27 
28 #[repr(C)]
29 pub struct ERR_STRING_DATA {
30     pub error: c_ulong,
31     pub string: *const c_char,
32 }
33 
34 extern "C" {
ERR_put_error(lib: c_int, func: c_int, reason: c_int, file: *const c_char, line: c_int)35     pub fn ERR_put_error(lib: c_int, func: c_int, reason: c_int, file: *const c_char, line: c_int);
ERR_set_error_data(data: *mut c_char, flags: c_int)36     pub fn ERR_set_error_data(data: *mut c_char, flags: c_int);
37 
ERR_get_error() -> c_ulong38     pub fn ERR_get_error() -> c_ulong;
ERR_get_error_line_data( file: *mut *const c_char, line: *mut c_int, data: *mut *const c_char, flags: *mut c_int, ) -> c_ulong39     pub fn ERR_get_error_line_data(
40         file: *mut *const c_char,
41         line: *mut c_int,
42         data: *mut *const c_char,
43         flags: *mut c_int,
44     ) -> c_ulong;
ERR_peek_last_error() -> c_ulong45     pub fn ERR_peek_last_error() -> c_ulong;
ERR_clear_error()46     pub fn ERR_clear_error();
ERR_lib_error_string(err: c_ulong) -> *const c_char47     pub fn ERR_lib_error_string(err: c_ulong) -> *const c_char;
ERR_func_error_string(err: c_ulong) -> *const c_char48     pub fn ERR_func_error_string(err: c_ulong) -> *const c_char;
ERR_reason_error_string(err: c_ulong) -> *const c_char49     pub fn ERR_reason_error_string(err: c_ulong) -> *const c_char;
50     #[cfg(ossl110)]
ERR_load_strings(lib: c_int, str: *mut ERR_STRING_DATA) -> c_int51     pub fn ERR_load_strings(lib: c_int, str: *mut ERR_STRING_DATA) -> c_int;
52     #[cfg(not(ossl110))]
ERR_load_strings(lib: c_int, str: *mut ERR_STRING_DATA)53     pub fn ERR_load_strings(lib: c_int, str: *mut ERR_STRING_DATA);
54     #[cfg(not(ossl110))]
ERR_load_crypto_strings()55     pub fn ERR_load_crypto_strings();
56 
ERR_get_next_error_library() -> c_int57     pub fn ERR_get_next_error_library() -> c_int;
58 }
59