diff options
| author | Steven Fackler <[email protected]> | 2014-11-16 13:57:05 -0800 |
|---|---|---|
| committer | Steven Fackler <[email protected]> | 2014-11-16 14:01:24 -0800 |
| commit | 5258ce6ece505c6c9b40310bcff0ef55a3073300 (patch) | |
| tree | eab32d5ca0322fb083a1f18d4ad9321ee367d0ff /src | |
| parent | Merge pull request #96 from coyotebush/xts (diff) | |
| download | rust-openssl-5258ce6ece505c6c9b40310bcff0ef55a3073300.tar.xz rust-openssl-5258ce6ece505c6c9b40310bcff0ef55a3073300.zip | |
Move AES XTS support to a feature
Diffstat (limited to 'src')
| -rw-r--r-- | src/crypto/hash.rs | 2 | ||||
| -rw-r--r-- | src/crypto/symm.rs | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/crypto/hash.rs b/src/crypto/hash.rs index b00dfba8..14dd34b5 100644 --- a/src/crypto/hash.rs +++ b/src/crypto/hash.rs @@ -122,7 +122,7 @@ mod tests { pub fn hash_writer(t: super::HashType, data: &[u8]) -> Vec<u8> { let mut h = super::Hasher::new(t); - h.write(data); + h.write(data).unwrap(); h.finalize() } diff --git a/src/crypto/symm.rs b/src/crypto/symm.rs index 6ad39933..6af4be6c 100644 --- a/src/crypto/symm.rs +++ b/src/crypto/symm.rs @@ -11,12 +11,16 @@ pub enum Mode { pub enum Type { AES_128_ECB, AES_128_CBC, + /// Requires the `aes_xts` feature + #[cfg(feature = "aes_xts")] AES_128_XTS, // AES_128_CTR, //AES_128_GCM, AES_256_ECB, AES_256_CBC, + /// Requires the `aes_xts` feature + #[cfg(feature = "aes_xts")] AES_256_XTS, // AES_256_CTR, //AES_256_GCM, @@ -29,12 +33,14 @@ fn evpc(t: Type) -> (*const ffi::EVP_CIPHER, uint, uint) { match t { AES_128_ECB => (ffi::EVP_aes_128_ecb(), 16u, 16u), AES_128_CBC => (ffi::EVP_aes_128_cbc(), 16u, 16u), + #[cfg(feature = "aes_xts")] AES_128_XTS => (ffi::EVP_aes_128_xts(), 32u, 16u), // AES_128_CTR => (EVP_aes_128_ctr(), 16u, 0u), //AES_128_GCM => (EVP_aes_128_gcm(), 16u, 16u), AES_256_ECB => (ffi::EVP_aes_256_ecb(), 32u, 16u), AES_256_CBC => (ffi::EVP_aes_256_cbc(), 32u, 16u), + #[cfg(feature = "aes_xts")] AES_256_XTS => (ffi::EVP_aes_256_xts(), 64u, 16u), // AES_256_CTR => (EVP_aes_256_ctr(), 32u, 0u), //AES_256_GCM => (EVP_aes_256_gcm(), 32u, 16u), @@ -268,6 +274,7 @@ mod tests { } #[test] + #[cfg(feature = "aes_xts")] fn test_aes256_xts() { // Test case 174 from // http://csrc.nist.gov/groups/STM/cavp/documents/aes/XTSTestVectors.zip |