Unverified Commit 78219eca authored by Alex Gaynor's avatar Alex Gaynor Committed by GitHub
Browse files

Merge pull request #2045 from alex/cipher-getters

Expose CBC mode for several more (bad) ciphers
parents 2f269c9e 5f502a29
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -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();
+25 −0
Original line number Diff line number Diff line
@@ -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 {
@@ -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()) }