Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose CBC mode for several more (bad) ciphers #2045

Merged
merged 1 commit into from Sep 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions openssl-sys/src/handwritten/evp.rs
Expand Up @@ -396,23 +396,33 @@ extern "C" {
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_128_cbc() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_192_cbc() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_256_cbc() -> *const EVP_CIPHER;

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAST")))]
pub fn EVP_cast5_cbc() -> *const EVP_CIPHER;

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn EVP_idea_cbc() -> *const EVP_CIPHER;

#[cfg(not(ossl110))]
pub fn OPENSSL_add_all_algorithms_noconf();
Expand Down
25 changes: 25 additions & 0 deletions openssl/src/symm.rs
Expand Up @@ -288,6 +288,26 @@ impl Cipher {
unsafe { Cipher(ffi::EVP_rc4()) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia_128_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_camellia_128_cbc()) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia_192_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_camellia_192_cbc()) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia_256_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_camellia_256_cbc()) }
}

#[cfg(not(osslconf = "OPENSSL_NO_CAST"))]
pub fn cast5_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_cast5_cbc()) }
}

/// Requires OpenSSL 1.1.0 or newer.
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
pub fn chacha20() -> Cipher {
Expand All @@ -300,6 +320,11 @@ impl Cipher {
unsafe { Cipher(ffi::EVP_chacha20_poly1305()) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn idea_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_idea_cbc()) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_SEED")))]
pub fn seed_cbc() -> Cipher {
unsafe { Cipher(ffi::EVP_seed_cbc()) }
Expand Down