Skip to content

Commit 43264a3

Browse files
committed
sys/ec: add EVP_PKEY_CTX_set_ec_paramgen_curve_nid
1 parent d9fa658 commit 43264a3

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

openssl-sys/src/ec.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ use super::*;
55

66
pub const OPENSSL_EC_NAMED_CURVE: c_int = 1;
77

8+
cfg_if! {
9+
if #[cfg(not(ossl300))] {
10+
pub unsafe fn EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx: *mut EVP_PKEY_CTX, nid: c_int) -> c_int {
11+
EVP_PKEY_CTX_ctrl(
12+
ctx,
13+
EVP_PKEY_EC,
14+
EVP_PKEY_OP_PARAMGEN|EVP_PKEY_OP_KEYGEN,
15+
EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID,
16+
nid,
17+
ptr::null_mut(),
18+
)
19+
}
20+
}
21+
}
822
#[cfg(ossl300)]
923
pub unsafe fn EVP_EC_gen(curve: *const c_char) -> *mut EVP_PKEY {
1024
EVP_PKEY_Q_keygen(
@@ -14,3 +28,5 @@ pub unsafe fn EVP_EC_gen(curve: *const c_char) -> *mut EVP_PKEY {
1428
curve,
1529
)
1630
}
31+
32+
pub const EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID: c_int = EVP_PKEY_ALG_CTRL + 1;

openssl-sys/src/handwritten/ec.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
use super::super::*;
22
use libc::*;
33

4+
#[cfg(ossl300)]
5+
extern "C" {
6+
pub fn EVP_PKEY_CTX_set_ec_paramgen_curve_nid(ctx: *mut EVP_PKEY_CTX, nid: c_int) -> c_int;
7+
}
8+
49
#[repr(C)]
510
#[derive(Copy, Clone)]
611
pub enum point_conversion_form_t {

0 commit comments

Comments
 (0)