From 34260b833fe5fc66b8322ce106f0f970cb99a10e Mon Sep 17 00:00:00 2001 From: Naomi Kirby Date: Wed, 26 Apr 2023 15:24:33 -0700 Subject: [PATCH] Check for OPENSSL_NO_RC4 when using EVP_rc4 --- openssl-sys/build/expando.c | 4 ++++ openssl-sys/src/handwritten/evp.rs | 1 + openssl/src/cipher.rs | 1 + openssl/src/symm.rs | 1 + 4 files changed, 7 insertions(+) diff --git a/openssl-sys/build/expando.c b/openssl-sys/build/expando.c index 11fb04db0..54681a0b9 100644 --- a/openssl-sys/build/expando.c +++ b/openssl-sys/build/expando.c @@ -79,6 +79,10 @@ RUST_CONF_OPENSSL_NO_OCSP RUST_CONF_OPENSSL_NO_PSK #endif +#ifdef OPENSSL_NO_RC4 +RUST_CONF_OPENSSL_NO_RC4 +#endif + #ifdef OPENSSL_NO_RFC3779 RUST_CONF_OPENSSL_NO_RFC3779 #endif diff --git a/openssl-sys/src/handwritten/evp.rs b/openssl-sys/src/handwritten/evp.rs index 050d2c88b..db018e9a4 100644 --- a/openssl-sys/src/handwritten/evp.rs +++ b/openssl-sys/src/handwritten/evp.rs @@ -311,6 +311,7 @@ extern "C" { pub fn EVP_des_ede3_cbc() -> *const EVP_CIPHER; pub fn EVP_des_ede3_cfb64() -> *const EVP_CIPHER; pub fn EVP_des_cbc() -> *const EVP_CIPHER; + #[cfg(not(osslconf = "OPENSSL_NO_RC4"))] pub fn EVP_rc4() -> *const EVP_CIPHER; pub fn EVP_bf_ecb() -> *const EVP_CIPHER; pub fn EVP_bf_cbc() -> *const EVP_CIPHER; diff --git a/openssl/src/cipher.rs b/openssl/src/cipher.rs index aeedf459a..87f7660cd 100644 --- a/openssl/src/cipher.rs +++ b/openssl/src/cipher.rs @@ -324,6 +324,7 @@ impl Cipher { unsafe { CipherRef::from_ptr(ffi::EVP_des_ede3_cfb64() as *mut _) } } + #[cfg(not(osslconf = "OPENSSL_NO_RC4"))] pub fn rc4() -> &'static CipherRef { unsafe { CipherRef::from_ptr(ffi::EVP_rc4() as *mut _) } } diff --git a/openssl/src/symm.rs b/openssl/src/symm.rs index 911a7ab2e..611080805 100644 --- a/openssl/src/symm.rs +++ b/openssl/src/symm.rs @@ -283,6 +283,7 @@ impl Cipher { unsafe { Cipher(ffi::EVP_des_ede3_cfb64()) } } + #[cfg(not(osslconf = "OPENSSL_NO_RC4"))] pub fn rc4() -> Cipher { unsafe { Cipher(ffi::EVP_rc4()) } } -- GitLab