Skip to content

Commit 9dae5d8

Browse files
authored
Merge pull request #1717 from wiktor-k/add-ciphers
Expose Camellia, CAST5 and IDEA ciphers
2 parents bb87002 + 7e7ce09 commit 9dae5d8

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

openssl-sys/build/expando.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ RUST_CONF_OPENSSL_NO_BUF_FREELISTS
2727
RUST_CONF_OPENSSL_NO_CHACHA
2828
#endif
2929

30+
#ifdef OPENSSL_NO_IDEA
31+
RUST_CONF_OPENSSL_NO_IDEA
32+
#endif
33+
34+
#ifdef OPENSSL_NO_CAMELLIA
35+
RUST_CONF_OPENSSL_NO_CAMELLIA
36+
#endif
37+
3038
#ifdef OPENSSL_NO_CMS
3139
RUST_CONF_OPENSSL_NO_CMS
3240
#endif

openssl-sys/src/handwritten/evp.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,29 @@ extern "C" {
364364
#[cfg(all(any(ossl111, libressl291), not(osslconf = "OPENSSL_NO_SM4")))]
365365
pub fn EVP_sm4_ctr() -> *const EVP_CIPHER;
366366

367+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
368+
pub fn EVP_camellia_128_cfb128() -> *const EVP_CIPHER;
369+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
370+
pub fn EVP_camellia_128_ecb() -> *const EVP_CIPHER;
371+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
372+
pub fn EVP_camellia_192_cfb128() -> *const EVP_CIPHER;
373+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
374+
pub fn EVP_camellia_192_ecb() -> *const EVP_CIPHER;
375+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
376+
pub fn EVP_camellia_256_cfb128() -> *const EVP_CIPHER;
377+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
378+
pub fn EVP_camellia_256_ecb() -> *const EVP_CIPHER;
379+
380+
#[cfg(not(boringssl))]
381+
pub fn EVP_cast5_cfb64() -> *const EVP_CIPHER;
382+
#[cfg(not(boringssl))]
383+
pub fn EVP_cast5_ecb() -> *const EVP_CIPHER;
384+
385+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
386+
pub fn EVP_idea_cfb64() -> *const EVP_CIPHER;
387+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
388+
pub fn EVP_idea_ecb() -> *const EVP_CIPHER;
389+
367390
#[cfg(not(ossl110))]
368391
pub fn OPENSSL_add_all_algorithms_noconf();
369392

openssl/src/cipher.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,56 @@ impl Cipher {
328328
unsafe { CipherRef::from_ptr(ffi::EVP_rc4() as *mut _) }
329329
}
330330

331+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
332+
pub fn camellia128_cfb128() -> &'static CipherRef {
333+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_cfb128() as *mut _) }
334+
}
335+
336+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
337+
pub fn camellia128_ecb() -> &'static CipherRef {
338+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_128_ecb() as *mut _) }
339+
}
340+
341+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
342+
pub fn camellia192_cfb128() -> &'static CipherRef {
343+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_cfb128() as *mut _) }
344+
}
345+
346+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
347+
pub fn camellia192_ecb() -> &'static CipherRef {
348+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_192_ecb() as *mut _) }
349+
}
350+
351+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
352+
pub fn camellia256_cfb128() -> &'static CipherRef {
353+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_cfb128() as *mut _) }
354+
}
355+
356+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_CAMELLIA")))]
357+
pub fn camellia256_ecb() -> &'static CipherRef {
358+
unsafe { CipherRef::from_ptr(ffi::EVP_camellia_256_ecb() as *mut _) }
359+
}
360+
361+
#[cfg(not(boringssl))]
362+
pub fn cast5_cfb64() -> &'static CipherRef {
363+
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_cfb64() as *mut _) }
364+
}
365+
366+
#[cfg(not(boringssl))]
367+
pub fn cast5_ecb() -> &'static CipherRef {
368+
unsafe { CipherRef::from_ptr(ffi::EVP_cast5_ecb() as *mut _) }
369+
}
370+
371+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
372+
pub fn idea_cfb64() -> &'static CipherRef {
373+
unsafe { CipherRef::from_ptr(ffi::EVP_idea_cfb64() as *mut _) }
374+
}
375+
376+
#[cfg(not(any(boringssl, osslconf = "OPENSSL_NO_IDEA")))]
377+
pub fn idea_ecb() -> &'static CipherRef {
378+
unsafe { CipherRef::from_ptr(ffi::EVP_idea_ecb() as *mut _) }
379+
}
380+
331381
#[cfg(all(ossl110, not(osslconf = "OPENSSL_NO_CHACHA")))]
332382
pub fn chacha20() -> &'static CipherRef {
333383
unsafe { CipherRef::from_ptr(ffi::EVP_chacha20() as *mut _) }

0 commit comments

Comments
 (0)