From 5989092543c07a28af5379a4b67a1b08665de6fd Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 10 Nov 2023 21:50:04 -0500 Subject: [PATCH] Expose ChaCha20 on LibreSSL --- openssl-sys/src/handwritten/evp.rs | 2 +- openssl/src/cipher.rs | 2 +- openssl/src/symm.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openssl-sys/src/handwritten/evp.rs b/openssl-sys/src/handwritten/evp.rs index 6d11447506..fabb13383e 100644 --- a/openssl-sys/src/handwritten/evp.rs +++ b/openssl-sys/src/handwritten/evp.rs @@ -370,7 +370,7 @@ extern "C" { pub fn EVP_aes_256_wrap() -> *const EVP_CIPHER; #[cfg(ossl110)] pub fn EVP_aes_256_wrap_pad() -> *const EVP_CIPHER; - #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))] + #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn EVP_chacha20() -> *const EVP_CIPHER; #[cfg(all(any(ossl110, libressl360), not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn EVP_chacha20_poly1305() -> *const EVP_CIPHER; diff --git a/openssl/src/cipher.rs b/openssl/src/cipher.rs index 722847b0ef..b5c82e8f68 100644 --- a/openssl/src/cipher.rs +++ b/openssl/src/cipher.rs @@ -453,7 +453,7 @@ impl Cipher { unsafe { CipherRef::from_ptr(ffi::EVP_idea_cbc() as *mut _) } } - #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))] + #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn chacha20() -> &'static CipherRef { unsafe { CipherRef::from_ptr(ffi::EVP_chacha20() as *mut _) } } diff --git a/openssl/src/symm.rs b/openssl/src/symm.rs index 21cf6cb075..1e9dc34fc6 100644 --- a/openssl/src/symm.rs +++ b/openssl/src/symm.rs @@ -383,7 +383,7 @@ impl Cipher { } /// Requires OpenSSL 1.1.0 or newer. - #[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))] + #[cfg(all(any(ossl110, libressl310), not(osslconf = "OPENSSL_NO_CHACHA")))] pub fn chacha20() -> Cipher { unsafe { Cipher(ffi::EVP_chacha20()) } } @@ -1592,7 +1592,7 @@ mod tests { } #[test] - #[cfg(ossl110)] + #[cfg(any(ossl110, libressl310))] fn test_chacha20() { let key = "0000000000000000000000000000000000000000000000000000000000000000"; let iv = "00000000000000000000000000000000";