Skip to content

Commit 78219ec

Browse files
authored
Merge pull request sfackler#2045 from alex/cipher-getters
Expose CBC mode for several more (bad) ciphers
2 parents 2f269c9 + 5f502a2 commit 78219ec

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

openssl-sys/src/handwritten/evp.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,23 +396,33 @@ extern "C" {
396396
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
397397
pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
398398
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
399+
pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER;
400+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
399401
pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
400402
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
401403
pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
402404
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
405+
pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER;
406+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
403407
pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
404408
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
405409
pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
410+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
411+
pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER;
406412

407413
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
408414
pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
409415
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
410416
pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
417+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
418+
pub fn EVP_cast5_cbc() -> *const EVP_CIPHER;
411419

412420
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
413421
pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
414422
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
415423
pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
424+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
425+
pub fn EVP_idea_cbc() -> *const EVP_CIPHER;
416426

417427
#[cfg(not(ossl110))]
418428
pub fn OPENSSL_add_all_algorithms_noconf();

openssl/src/symm.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,26 @@ impl Cipher {
288288
unsafe { Cipher(ffi::EVP_rc4()) }
289289
}
290290

291+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
292+
pub fn camellia_128_cbc() -> Cipher {
293+
unsafe { Cipher(ffi::EVP_camellia_128_cbc()) }
294+
}
295+
296+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
297+
pub fn camellia_192_cbc() -> Cipher {
298+
unsafe { Cipher(ffi::EVP_camellia_192_cbc()) }
299+
}
300+
301+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
302+
pub fn camellia_256_cbc() -> Cipher {
303+
unsafe { Cipher(ffi::EVP_camellia_256_cbc()) }
304+
}
305+
306+
#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
307+
pub fn cast5_cbc() -> Cipher {
308+
unsafe { Cipher(ffi::EVP_cast5_cbc()) }
309+
}
310+
291311
/// Requires OpenSSL 1.1.0 or newer.
292312
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
293313
pub fn chacha20() -> Cipher {
@@ -300,6 +320,11 @@ impl Cipher {
300320
unsafe { Cipher(ffi::EVP_chacha20_poly1305()) }
301321
}
302322

323+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
324+
pub fn idea_cbc() -> Cipher {
325+
unsafe { Cipher(ffi::EVP_idea_cbc()) }
326+
}
327+
303328
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
304329
pub fn seed_cbc() -> Cipher {
305330
unsafe { Cipher(ffi::EVP_seed_cbc()) }

0 commit comments

Comments
 (0)