1use super::super::*;
2
3extern "C" {
4    pub fn DH_new() -> *mut DH;
5    pub fn DH_free(dh: *mut DH);
6    pub fn DH_check(dh: *const DH, codes: *mut c_int) -> c_int;
7
8    pub fn DH_generate_parameters(
9        prime_len: c_int,
10        generator: c_int,
11        callback: Option<extern "C" fn(c_int, c_int, *mut c_void)>,
12        cb_arg: *mut c_void,
13    ) -> *mut DH;
14
15    pub fn DH_generate_parameters_ex(
16        dh: *mut DH,
17        prime_len: c_int,
18        generator: c_int,
19        cb: *mut BN_GENCB,
20    ) -> c_int;
21
22    pub fn DH_generate_key(dh: *mut DH) -> c_int;
23    pub fn DH_compute_key(key: *mut c_uchar, pub_key: *const BIGNUM, dh: *mut DH) -> c_int;
24    pub fn DH_size(dh: *const DH) -> c_int;
25
26    pub fn d2i_DHparams(k: *mut *mut DH, pp: *mut *const c_uchar, length: c_long) -> *mut DH;
27    pub fn i2d_DHparams(dh: *const DH, pp: *mut *mut c_uchar) -> c_int;
28
29    #[cfg(ossl102)]
30    pub fn DH_get_1024_160() -> *mut DH;
31    #[cfg(ossl102)]
32    pub fn DH_get_2048_224() -> *mut DH;
33    #[cfg(ossl102)]
34    pub fn DH_get_2048_256() -> *mut DH;
35
36    #[cfg(any(ossl110, libressl270))]
37    pub fn DH_set0_pqg(dh: *mut DH, p: *mut BIGNUM, q: *mut BIGNUM, g: *mut BIGNUM) -> c_int;
38    #[cfg(any(ossl110, libressl270))]
39    pub fn DH_get0_pqg(
40        dh: *const DH,
41        p: *mut *const BIGNUM,
42        q: *mut *const BIGNUM,
43        g: *mut *const BIGNUM,
44    );
45
46    #[cfg(any(ossl110, libressl270))]
47    pub fn DH_set0_key(dh: *mut DH, pub_key: *mut BIGNUM, priv_key: *mut BIGNUM) -> c_int;
48
49    #[cfg(any(ossl110, libressl270))]
50    pub fn DH_get0_key(dh: *const DH, pub_key: *mut *const BIGNUM, priv_key: *mut *const BIGNUM);
51}
52