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
use libc::{c_char, c_int, c_uint, c_void, size_t};

pub use libgpg_error_sys::gpg_error_t as gcry_error_t;

// extern {
//     pub type gcry_thread_cbs;
//     pub type gcry_context;
//     pub type gcry_sexp;
//     pub type gcry_mpi;
//     pub type gcry_mpi_point;
//     pub type gcry_cipher_handle;
//     pub type gcry_md_handle;
//     pub type gcry_mac_handle;
// }

#[repr(C)]
pub struct gcry_thread_cbs {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_context {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_sexp {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_mpi {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_mpi_point {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_cipher_handle {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_md_handle {
    _priv: [u8; 0],
}
#[repr(C)]
pub struct gcry_mac_handle {
    _priv: [u8; 0],
}

pub type gcry_ctx_t = *mut gcry_context;
pub type gcry_sexp_t = *mut gcry_sexp;
pub type gcry_mpi_t = *mut gcry_mpi;
pub type gcry_mpi_point_t = *mut gcry_mpi_point;
pub type gcry_cipher_hd_t = *mut gcry_cipher_handle;
pub type gcry_md_hd_t = *mut gcry_md_handle;
pub type gcry_mac_hd_t = *mut gcry_mac_handle;

pub type gcry_prime_check_func_t =
    Option<unsafe extern "C" fn(*mut c_void, c_int, gcry_mpi_t) -> c_int>;

pub type gcry_handler_progress_t =
    Option<unsafe extern "C" fn(*mut c_void, *const c_char, c_int, c_int, c_int)>;
pub type gcry_handler_alloc_t = Option<unsafe extern "C" fn(size_t) -> *mut c_void>;
pub type gcry_handler_secure_check_t = Option<unsafe extern "C" fn(*const c_void) -> c_int>;
pub type gcry_handler_realloc_t = Option<unsafe extern "C" fn(*mut c_void, size_t) -> *mut c_void>;
pub type gcry_handler_free_t = Option<unsafe extern "C" fn(*mut c_void)>;
pub type gcry_handler_no_mem_t = Option<unsafe extern "C" fn(*mut c_void, size_t, c_uint) -> c_int>;
pub type gcry_handler_error_t = Option<unsafe extern "C" fn(*mut c_void, c_int, *const c_char)>;
//pub type gcry_handler_log_t = Option<unsafe extern fn(*mut c_void, c_int, *const c_char, va_list)>