From 78c1e2409d1d319cb8ea8484719e4ada6ee0125e Mon Sep 17 00:00:00 2001 From: Hiroki Noda Date: Sat, 25 Jan 2020 00:49:47 +0900 Subject: [PATCH] Add EVP_EncryptInit_ex/EVP_EncryptFinish_ex, and the equivalently named decrypt functions Some functions including low level AES functions would be deprecated in next OpenSSL version(3.0). OpenSSL team says that application should use the high level EVP APIs, so I added these functions. See also: https://github.com/openssl/openssl/pull/10580 https://github.com/openssl/openssl/pull/10740 --- openssl-sys/src/evp.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/openssl-sys/src/evp.rs b/openssl-sys/src/evp.rs index a0b3fea9..b4e74c19 100644 --- a/openssl-sys/src/evp.rs +++ b/openssl-sys/src/evp.rs @@ -122,6 +122,13 @@ extern "C" { npubk: c_int, ) -> c_int; pub fn EVP_SealFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int; + pub fn EVP_EncryptInit_ex( + ctx: *mut EVP_CIPHER_CTX, + cipher: *const EVP_CIPHER, + impl_: *mut ENGINE, + key: *const c_uchar, + iv: *const c_uchar, + ) -> c_int; pub fn EVP_EncryptUpdate( ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, @@ -129,6 +136,11 @@ extern "C" { in_: *const u8, inl: c_int, ) -> c_int; + pub fn EVP_EncryptFinal_ex( + ctx: *mut EVP_CIPHER_CTX, + out: *mut c_uchar, + outl: *mut c_int, + ) -> c_int; pub fn EVP_OpenInit( ctx: *mut EVP_CIPHER_CTX, type_: *const EVP_CIPHER, @@ -138,6 +150,13 @@ extern "C" { priv_: *mut EVP_PKEY, ) -> c_int; pub fn EVP_OpenFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> c_int; + pub fn EVP_DecryptInit_ex( + ctx: *mut EVP_CIPHER_CTX, + cipher: *const EVP_CIPHER, + impl_: *mut ENGINE, + key: *const c_uchar, + iv: *const c_uchar, + ) -> c_int; pub fn EVP_DecryptUpdate( ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, @@ -145,6 +164,11 @@ extern "C" { in_: *const u8, inl: c_int, ) -> c_int; + pub fn EVP_DecryptFinal_ex( + ctx: *mut EVP_CIPHER_CTX, + outm: *mut c_uchar, + outl: *mut c_int + ) -> c_int; } cfg_if! { if #[cfg(any(ossl111b, libressl280))] {