From 3291ea16ef45f5d5632159137ff3e9ce8e114ecd Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 31 Aug 2024 13:07:53 -0700 Subject: [PATCH 1/2] add basic EVP_KDF bindings --- openssl-sys/src/handwritten/kdf.rs | 8 ++++++++ openssl-sys/src/handwritten/params.rs | 7 +++++++ openssl-sys/src/handwritten/types.rs | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/openssl-sys/src/handwritten/kdf.rs b/openssl-sys/src/handwritten/kdf.rs index 0f14b63a9c..d34f27450c 100644 --- a/openssl-sys/src/handwritten/kdf.rs +++ b/openssl-sys/src/handwritten/kdf.rs @@ -21,6 +21,14 @@ cfg_if! { info: *const u8, infolen: c_int, ) -> c_int; + pub fn EVP_KDF_CTX_new(kdf: *mut EVP_KDF) -> *mut EVP_KDF_CTX; + pub fn EVP_KDF_CTX_free(ctx: *mut EVP_KDF_CTX); + pub fn EVP_KDF_CTX_reset(ctx: *mut EVP_KDF_CTX); + pub fn EVP_KDF_CTX_get_kdf_size(ctx: *mut EVP_KDF_CTX) -> size_t; + pub fn EVP_KDF_derive(ctx: *mut EVP_KDF_CTX, key: *mut u8, keylen: size_t, params: *const OSSL_PARAM) -> c_int; + pub fn EVP_KDF_fetch(ctx: *mut OSSL_LIB_CTX, algorithm: *const c_char, properties: *const c_char) -> *mut EVP_KDF; + pub fn EVP_KDF_free(kdf: *mut EVP_KDF); } + } } diff --git a/openssl-sys/src/handwritten/params.rs b/openssl-sys/src/handwritten/params.rs index 3ed00c0488..542cef3374 100644 --- a/openssl-sys/src/handwritten/params.rs +++ b/openssl-sys/src/handwritten/params.rs @@ -6,4 +6,11 @@ extern "C" { pub fn OSSL_PARAM_construct_uint(key: *const c_char, buf: *mut c_uint) -> OSSL_PARAM; #[cfg(ossl300)] pub fn OSSL_PARAM_construct_end() -> OSSL_PARAM; + #[cfg(ossl300)] + pub fn OSSL_PARAM_construct_octet_string( + key: *const c_char, + buf: *mut c_void, + bsize: size_t, + ) -> OSSL_PARAM; + } diff --git a/openssl-sys/src/handwritten/types.rs b/openssl-sys/src/handwritten/types.rs index 593e20cdb2..df7d050da8 100644 --- a/openssl-sys/src/handwritten/types.rs +++ b/openssl-sys/src/handwritten/types.rs @@ -1139,3 +1139,8 @@ pub struct OSSL_PARAM { data_size: size_t, return_size: size_t, } + +#[cfg(ossl300)] +pub enum EVP_KDF {} +#[cfg(ossl300)] +pub enum EVP_KDF_CTX {} \ No newline at end of file From 3ed6fe2a010bcc49d31fd0715f18bb87db34775b Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Sat, 31 Aug 2024 13:15:44 -0700 Subject: [PATCH 2/2] fmt --- openssl-sys/src/handwritten/types.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openssl-sys/src/handwritten/types.rs b/openssl-sys/src/handwritten/types.rs index df7d050da8..d465a44148 100644 --- a/openssl-sys/src/handwritten/types.rs +++ b/openssl-sys/src/handwritten/types.rs @@ -1143,4 +1143,4 @@ pub struct OSSL_PARAM { #[cfg(ossl300)] pub enum EVP_KDF {} #[cfg(ossl300)] -pub enum EVP_KDF_CTX {} \ No newline at end of file +pub enum EVP_KDF_CTX {}