openssl_sys/handwritten/
dh.rs

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