diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2022-05-12 10:43:52 +0200 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2022-05-12 13:32:30 +0200 |
commit | b1fdd0e62e12c936206db8aa9b567678a23c4708 (patch) | |
tree | 366fb6178c3eca43ff58ca008ec963ece677a7bf /openpgp/src/crypto/aead.rs | |
parent | 8f8e46bf43b9908827f576e4f8b3629df01ed3ee (diff) |
openpgp: Rename `iv_size` to `nonce_size` leaving `iv_size`.
- Rename `iv_size` to `nonce_size`.
- Introduce `iv_size` that forwards to `nonce_size` for compatibility
reasons.
- Change all calls to `iv_size` to `nonce_size`.
Diffstat (limited to 'openpgp/src/crypto/aead.rs')
-rw-r--r-- | openpgp/src/crypto/aead.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs index f9d5149a..b225c6be 100644 --- a/openpgp/src/crypto/aead.rs +++ b/openpgp/src/crypto/aead.rs @@ -93,8 +93,8 @@ impl AEADAlgorithm { } } - /// Returns the initialization vector size of the AEAD algorithm. - pub fn iv_size(&self) -> Result<usize> { + /// Returns the nonce size of the AEAD algorithm. + pub fn nonce_size(&self) -> Result<usize> { use self::AEADAlgorithm::*; match self { // According to RFC4880bis, Section 5.16.1. @@ -106,6 +106,14 @@ impl AEADAlgorithm { _ => Err(Error::UnsupportedAEADAlgorithm(*self).into()), } } + + /// Returns the initialization vector size of the AEAD algorithm. + /// + /// This function is deprecated. Please use + /// [`AEADAlgorithm::nonce_size`]. + pub fn iv_size(&self) -> Result<usize> { + self.nonce_size() + } } /// Schedules nonce and additional authenticated data for use with @@ -862,7 +870,7 @@ mod tests { let mut key = vec![0; sym_algo.key_size().unwrap()]; crate::crypto::random(&mut key); let key: SessionKey = key.into(); - let mut iv = vec![0; aead.iv_size().unwrap()]; + let mut iv = vec![0; aead.nonce_size().unwrap()]; crate::crypto::random(&mut iv); let mut ciphertext = Vec::new(); |