Unverified Commit b472ce4b authored by Huw Jones's avatar Huw Jones
Browse files

sys/dh: add EVP_PKEY_CTX set dh prime_len & generator

parent 01b045fc
Loading
Loading
Loading
Loading

openssl-sys/src/dh.rs

0 → 100644
+32 −0
Original line number Diff line number Diff line
use libc::*;
use std::ptr;

use super::super::*;

cfg_if! {
    if #[cfg(not(ossl300))] {
        pub unsafe fn EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx: *mut EVP_PKEY_CTX, len: c_int) -> c_int {
            EVP_PKEY_CTX_ctrl(
                ctx,
                EVP_PKEY_DH,
                EVP_PKEY_OP_PARAMGEN,
                EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN,
                len,
                ptr::null_mut(),
            )
        }
        pub unsafe fn EVP_PKEY_CTX_set_dh_paramgen_generator(ctx: *mut EVP_PKEY_CTX, gen: c_int) -> c_int {
            EVP_PKEY_CTX_ctrl(
                ctx,
                EVP_PKEY_DH,
                EVP_PKEY_OP_PARAMGEN,
                EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR,
                gen,
                ptr::null_mut(),
            )
        }
    }
}

pub const EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN: c_int = EVP_PKEY_ALG_CTRL + 1;
pub const EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR: c_int = EVP_PKEY_ALG_CTRL + 2;
+6 −0
Original line number Diff line number Diff line
use super::super::*;

#[cfg(ossl300)]
extern "C" {
    pub fn EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx: *mut EVP_PKEY_CTX, len: c_int) -> c_int;
    pub fn EVP_PKEY_CTX_set_dh_paramgen_generator(ctx: *mut EVP_PKEY_CTX, gen: c_int) -> c_int;
}

extern "C" {
    pub fn DH_new() -> *mut DH;
    pub fn DH_free(dh: *mut DH);
+2 −0
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ mod openssl {
    pub use self::bn::*;
    pub use self::cms::*;
    pub use self::crypto::*;
    pub use self::dh::*;
    pub use self::dsa::*;
    pub use self::dtls1::*;
    pub use self::ec::*;
@@ -104,6 +105,7 @@ mod openssl {
    mod bn;
    mod cms;
    mod crypto;
    mod dh;
    mod dsa;
    mod dtls1;
    mod ec;