Unverified Commit 93f9e02e authored by Alex Gaynor's avatar Alex Gaynor Committed by GitHub
Browse files

Merge pull request #2432 from huwcbjones/huw/pkey-ctx-dsa-paramgen

pkey_ctx: add ability to generate DSA params & keys
parents 9584d98c 17fe4c82
Loading
Loading
Loading
Loading

openssl-sys/src/dsa.rs

0 → 100644
+21 −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_dsa_paramgen_bits(ctx: *mut EVP_PKEY_CTX, nbits: c_int) -> c_int {
            EVP_PKEY_CTX_ctrl(
                ctx,
                EVP_PKEY_DSA,
                EVP_PKEY_OP_PARAMGEN,
                EVP_PKEY_CTRL_DSA_PARAMGEN_BITS,
                nbits,
                ptr::null_mut(),
            )
        }
    }
}

pub const EVP_PKEY_CTRL_DSA_PARAMGEN_BITS: c_int = EVP_PKEY_ALG_CTRL + 1;
+1 −0
Original line number Diff line number Diff line
@@ -162,6 +162,7 @@ cfg_if! {
    }
}

pub const EVP_PKEY_OP_PARAMGEN: c_int = 1 << 1;
pub const EVP_PKEY_OP_KEYGEN: c_int = 1 << 2;
cfg_if! {
    if #[cfg(ossl300)] {
+5 −0
Original line number Diff line number Diff line
@@ -2,6 +2,11 @@ use libc::*;

use super::super::*;

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

cfg_if! {
    if #[cfg(any(ossl110, libressl280))] {
        pub enum DSA_SIG {}
+2 −0
Original line number Diff line number Diff line
@@ -584,7 +584,9 @@ extern "C" {
        ...
    ) -> *mut EVP_PKEY;
    pub fn EVP_PKEY_keygen_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
    pub fn EVP_PKEY_paramgen_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
    pub fn EVP_PKEY_keygen(ctx: *mut EVP_PKEY_CTX, key: *mut *mut EVP_PKEY) -> c_int;
    pub fn EVP_PKEY_paramgen(ctx: *mut EVP_PKEY_CTX, key: *mut *mut EVP_PKEY) -> c_int;

    pub fn EVP_PKEY_sign_init(ctx: *mut EVP_PKEY_CTX) -> c_int;
    pub fn EVP_PKEY_sign(
+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::dsa::*;
    pub use self::dtls1::*;
    pub use self::ec::*;
    pub use self::err::*;
@@ -103,6 +104,7 @@ mod openssl {
    mod bn;
    mod cms;
    mod crypto;
    mod dsa;
    mod dtls1;
    mod ec;
    mod err;
Loading