Skip to content

Commit

Permalink
Merge pull request #1717 from wiktor-k/add-ciphers
Browse files Browse the repository at this point in the history
Expose Camellia, CAST5 and IDEA ciphers
  • Loading branch information
sfackler authored Nov 3, 2022
2 parents bb87002 + 7e7ce09 commit 9dae5d8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
8 changes: 8 additions & 0 deletions openssl-sys/build/expando.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ RUST_CONF_OPENSSL_NO_BUF_FREELISTS
RUST_CONF_OPENSSL_NO_CHACHA
#endif

#ifdef OPENSSL_NO_IDEA
RUST_CONF_OPENSSL_NO_IDEA
#endif

#ifdef OPENSSL_NO_CAMELLIA
RUST_CONF_OPENSSL_NO_CAMELLIA
#endif

#ifdef OPENSSL_NO_CMS
RUST_CONF_OPENSSL_NO_CMS
#endif
Expand Down
23 changes: 23 additions & 0 deletions openssl-sys/src/handwritten/evp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,29 @@ extern "C" {
#[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
pub fn EVP_sm4_ctr() -> *const EVP_CIPHER;

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER;
#[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_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_256_cfb128() -> *const EVP_CIPHER;
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;

#[cfg(not(boringssl))]
pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
#[cfg(not(boringssl))]
pub fn EVP_cast5_ecb() -> *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(ossl110))]
pub fn OPENSSL_add_all_algorithms_noconf();

Expand Down
50 changes: 50 additions & 0 deletions openssl/src/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,56 @@ impl Cipher {
unsafe { CipherRef::from_ptr(ffi::EVP_rc4() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia128_cfb128() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cfb128() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia128_ecb() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_ecb() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia192_cfb128() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cfb128() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia192_ecb() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_ecb() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia256_cfb128() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cfb128() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
pub fn camellia256_ecb() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_ecb() as *mut _) }
}

#[cfg(not(boringssl))]
pub fn cast5_cfb64() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cfb64() as *mut _) }
}

#[cfg(not(boringssl))]
pub fn cast5_ecb() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_ecb() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn idea_cfb64() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_idea_cfb64() as *mut _) }
}

#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
pub fn idea_ecb() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_idea_ecb() as *mut _) }
}

#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
pub fn chacha20() -> &'static CipherRef {
unsafe { CipherRef::from_ptr(ffi::EVP_chacha20() as *mut _) }
Expand Down

0 comments on commit 9dae5d8

Please sign in to comment.