Support EVP_des_ede3.

This cipher is used, for example, for DES challenges for authenticating
against a Yubikey, so supporting it in rust-openssl is generally useful.
This commit is contained in:
Axel Rasmussen 2018-02-04 13:17:09 -08:00
parent 637c160c83
commit 404bbeddfd
No known key found for this signature in database
GPG Key ID: 9027E5A55C2E90A9
2 changed files with 16 additions and 0 deletions

View File

@ -1885,6 +1885,7 @@ extern "C" {
pub fn EVP_des_cbc() -> *const EVP_CIPHER; pub fn EVP_des_cbc() -> *const EVP_CIPHER;
pub fn EVP_des_ecb() -> *const EVP_CIPHER; pub fn EVP_des_ecb() -> *const EVP_CIPHER;
pub fn EVP_des_ede3() -> *const EVP_CIPHER;
pub fn EVP_BytesToKey( pub fn EVP_BytesToKey(
typ: *const EVP_CIPHER, typ: *const EVP_CIPHER,

View File

@ -133,6 +133,10 @@ impl Cipher {
unsafe { Cipher(ffi::EVP_des_ecb()) } unsafe { Cipher(ffi::EVP_des_ecb()) }
} }
pub fn des_ede3() -> Cipher {
unsafe { Cipher(ffi::EVP_des_ede3()) }
}
pub fn rc4() -> Cipher { pub fn rc4() -> Cipher {
unsafe { Cipher(ffi::EVP_rc4()) } unsafe { Cipher(ffi::EVP_rc4()) }
} }
@ -1035,6 +1039,17 @@ mod tests {
cipher_test(super::Cipher::des_ecb(), pt, ct, key, iv); cipher_test(super::Cipher::des_ecb(), pt, ct, key, iv);
} }
#[test]
fn test_des_ede3() {
let pt = "9994f4c69d40ae4f34ff403b5cf39d4c8207ea5d3e19a5fd";
let ct = "9e5c4297d60582f81071ac8ab7d0698d4c79de8b94c519858207ea5d3e19a5fd";
let key = "010203040506070801020304050607080102030405060708";
let iv = "5cc118306dc702e4";
cipher_test(super::Cipher::des_ede3(), pt, ct, key, iv);
}
#[test] #[test]
fn test_aes128_gcm() { fn test_aes128_gcm() {
let key = "0e00c76561d2bd9b40c3c15427e2b08f"; let key = "0e00c76561d2bd9b40c3c15427e2b08f";