From 88c5bd81c7a72b73fdfc741fe958a20ebd397063 Mon Sep 17 00:00:00 2001 From: Leo Date: Sat, 6 Jul 2019 17:11:37 +0800 Subject: [PATCH] Add AES-192 and OFB mode --- openssl-sys/src/evp.rs | 11 +++++++++++ openssl/src/symm.rs | 44 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/openssl-sys/src/evp.rs b/openssl-sys/src/evp.rs index 2d06e827..4ab210bb 100644 --- a/openssl-sys/src/evp.rs +++ b/openssl-sys/src/evp.rs @@ -224,6 +224,16 @@ extern "C" { pub fn EVP_aes_128_ccm() -> *const EVP_CIPHER; pub fn EVP_aes_128_gcm() -> *const EVP_CIPHER; pub fn EVP_aes_128_xts() -> *const EVP_CIPHER; + pub fn EVP_aes_128_ofb() -> *const EVP_CIPHER; + pub fn EVP_aes_192_ecb() -> *const EVP_CIPHER; + pub fn EVP_aes_192_cbc() -> *const EVP_CIPHER; + pub fn EVP_aes_192_cfb1() -> *const EVP_CIPHER; + pub fn EVP_aes_192_cfb8() -> *const EVP_CIPHER; + pub fn EVP_aes_192_cfb128() -> *const EVP_CIPHER; + pub fn EVP_aes_192_ctr() -> *const EVP_CIPHER; + pub fn EVP_aes_192_ccm() -> *const EVP_CIPHER; + pub fn EVP_aes_192_gcm() -> *const EVP_CIPHER; + pub fn EVP_aes_192_ofb() -> *const EVP_CIPHER; pub fn EVP_aes_256_ecb() -> *const EVP_CIPHER; pub fn EVP_aes_256_cbc() -> *const EVP_CIPHER; pub fn EVP_aes_256_cfb1() -> *const EVP_CIPHER; @@ -233,6 +243,7 @@ extern "C" { pub fn EVP_aes_256_ccm() -> *const EVP_CIPHER; pub fn EVP_aes_256_gcm() -> *const EVP_CIPHER; pub fn EVP_aes_256_xts() -> *const EVP_CIPHER; + pub fn EVP_aes_256_ofb() -> *const EVP_CIPHER; #[cfg(ossl110)] pub fn EVP_chacha20() -> *const ::EVP_CIPHER; #[cfg(ossl110)] diff --git a/openssl/src/symm.rs b/openssl/src/symm.rs index 726917a5..59252dc4 100644 --- a/openssl/src/symm.rs +++ b/openssl/src/symm.rs @@ -126,6 +126,46 @@ impl Cipher { unsafe { Cipher(ffi::EVP_aes_128_ccm()) } } + pub fn aes_128_ofb() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_128_ofb()) } + } + + pub fn aes_192_ecb() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_ecb()) } + } + + pub fn aes_192_cbc() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_cbc()) } + } + + pub fn aes_192_ctr() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_ctr()) } + } + + pub fn aes_192_cfb1() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_cfb1()) } + } + + pub fn aes_192_cfb128() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_cfb128()) } + } + + pub fn aes_192_cfb8() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_cfb8()) } + } + + pub fn aes_192_gcm() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_gcm()) } + } + + pub fn aes_192_ccm() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_ccm()) } + } + + pub fn aes_192_ofb() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_192_ofb()) } + } + pub fn aes_256_ecb() -> Cipher { unsafe { Cipher(ffi::EVP_aes_256_ecb()) } } @@ -162,6 +202,10 @@ impl Cipher { unsafe { Cipher(ffi::EVP_aes_256_ccm()) } } + pub fn aes_256_ofb() -> Cipher { + unsafe { Cipher(ffi::EVP_aes_256_ofb()) } + } + pub fn bf_cbc() -> Cipher { unsafe { Cipher(ffi::EVP_bf_cbc()) } }