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
This commit is contained in:
Hiroki Noda 2020-01-25 00:49:47 +09:00
parent ad37e7e07d
commit 78c1e2409d
1 changed files with 24 additions and 0 deletions

View File

@ -122,6 +122,13 @@ extern "C" {
npubk: c_int, npubk: c_int,
) -> 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_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( pub fn EVP_EncryptUpdate(
ctx: *mut EVP_CIPHER_CTX, ctx: *mut EVP_CIPHER_CTX,
out: *mut c_uchar, out: *mut c_uchar,
@ -129,6 +136,11 @@ extern "C" {
in_: *const u8, in_: *const u8,
inl: c_int, inl: c_int,
) -> 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( pub fn EVP_OpenInit(
ctx: *mut EVP_CIPHER_CTX, ctx: *mut EVP_CIPHER_CTX,
type_: *const EVP_CIPHER, type_: *const EVP_CIPHER,
@ -138,6 +150,13 @@ extern "C" {
priv_: *mut EVP_PKEY, priv_: *mut EVP_PKEY,
) -> c_int; ) -> c_int;
pub fn EVP_OpenFinal(ctx: *mut EVP_CIPHER_CTX, out: *mut c_uchar, outl: *mut c_int) -> 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( pub fn EVP_DecryptUpdate(
ctx: *mut EVP_CIPHER_CTX, ctx: *mut EVP_CIPHER_CTX,
out: *mut c_uchar, out: *mut c_uchar,
@ -145,6 +164,11 @@ extern "C" {
in_: *const u8, in_: *const u8,
inl: c_int, inl: c_int,
) -> 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! { cfg_if! {
if #[cfg(any(ossl111b, libressl280))] { if #[cfg(any(ossl111b, libressl280))] {