Unverified Commit 7e7ce09b authored by Wiktor Kwapisiewicz's avatar Wiktor Kwapisiewicz
Browse files

Expose Camellia, CAST5 and IDEA ciphers

All of them are used in the OpenPGP specification for symmetric ciphers
[0].

IDEA and CAST5 may be old but they are provided for users for decryption
of archive data. Camellia is used in the new version of the OpenPGP
specification as an alternative to AES.

[0]: https://openpgp-wg.gitlab.io/rfc4880bis/#name-symmetric-key-algorithms
parent 6d556313
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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
+23 −0
Original line number Diff line number Diff line
@@ -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();

+50 −0
Original line number Diff line number Diff line
@@ -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 _) }