diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-25 15:30:29 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2022-07-25 15:30:32 +0200 |
commit | 558bf7de020c9852fa52291dcbb25e84c582509b (patch) | |
tree | fe33f9dc10ae095813fa9592fb55a176d4737aba | |
parent | e04d73a476c6e6fb1493fe2d8b14b696af516f75 (diff) |
Clarify Eax importnora/bump_crypt
- The eax crate has two Eax structs, eax::Eax and eax::online::Eax.
The online variant is also exported as eax::online::EaxOnline.
- Make it easier to see that we are importing the online variant, by
referencing eax::online::EaxOnline.
-rw-r--r-- | openpgp/src/crypto/backend/rust/aead.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/openpgp/src/crypto/backend/rust/aead.rs b/openpgp/src/crypto/backend/rust/aead.rs index 76a5379f..58dea86b 100644 --- a/openpgp/src/crypto/backend/rust/aead.rs +++ b/openpgp/src/crypto/backend/rust/aead.rs @@ -4,7 +4,7 @@ use std::cmp; use cipher::{Block, BlockCipher, BlockEncrypt, NewBlockCipher}; use cipher::consts::U16; -use eax::online::{Eax, Encrypt, Decrypt}; +use eax::online::{EaxOnline, Encrypt, Decrypt}; use generic_array::{ArrayLength, GenericArray}; use crate::{Error, Result}; @@ -31,7 +31,7 @@ impl<T, N: ArrayLength<T>> GenericArrayExt<T, N> for GenericArray<T, N> { const LEN: usize = N::USIZE; } -impl<Cipher> Aead for Eax<Cipher, Encrypt> +impl<Cipher> Aead for EaxOnline<Cipher, Encrypt> where Cipher: BlockCipher<BlockSize = U16> + NewBlockCipher + BlockEncrypt + Clone, Cipher::ParBlocks: ArrayLength<Block<Cipher>>, @@ -61,7 +61,7 @@ where } } -impl<Cipher> Aead for Eax<Cipher, Decrypt> +impl<Cipher> Aead for EaxOnline<Cipher, Decrypt> where Cipher: BlockCipher<BlockSize = U16> + NewBlockCipher + BlockEncrypt + Clone, Cipher::ParBlocks: ArrayLength<Block<Cipher>>, @@ -90,7 +90,7 @@ where } } -impl<Cipher, Op> seal::Sealed for Eax<Cipher, Op> +impl<Cipher, Op> seal::Sealed for EaxOnline<Cipher, Op> where Cipher: BlockCipher<BlockSize = U16> + NewBlockCipher + BlockEncrypt + Clone, Cipher::ParBlocks: ArrayLength<Block<Cipher>>, @@ -109,31 +109,31 @@ impl AEADAlgorithm { AEADAlgorithm::EAX => match sym_algo { SymmetricAlgorithm::AES128 => match op { CipherOp::Encrypt => Ok(Box::new( - Eax::<aes::Aes128, Encrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes128, Encrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), CipherOp::Decrypt => Ok(Box::new( - Eax::<aes::Aes128, Decrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes128, Decrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), } SymmetricAlgorithm::AES192 => match op { CipherOp::Encrypt => Ok(Box::new( - Eax::<aes::Aes192, Encrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes192, Encrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), CipherOp::Decrypt => Ok(Box::new( - Eax::<aes::Aes192, Decrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes192, Decrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), } SymmetricAlgorithm::AES256 => match op { CipherOp::Encrypt => Ok(Box::new( - Eax::<aes::Aes256, Encrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes256, Encrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), CipherOp::Decrypt => Ok(Box::new( - Eax::<aes::Aes256, Decrypt>::with_key_and_nonce( + EaxOnline::<aes::Aes256, Decrypt>::with_key_and_nonce( GenericArray::try_from_slice(key)?, GenericArray::try_from_slice(nonce)?))), } |