diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-10-25 14:04:28 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-10-25 14:04:28 +0200 |
commit | 016c14898bfda1c106b8178cee3fb28dc32baacb (patch) | |
tree | dc4681ba4e635f9748a5c6cd477230432ccd1864 | |
parent | ae6a4413aaed99f62b00c2120dd919c3ab5ee21c (diff) |
openpgp: Enable parsing of AED packets using OCB.
- Parsing the headers of AED packets is not possible without knowing
the AEAD algorithm used due to the fact that the length of the IV
field is dependent on the AEAD algorithm.
- In the case of OCB, the RFC4880bis does not specify an exact
length of the IV, but GnuPG hardcodes it to 15.
-rw-r--r-- | openpgp/src/crypto/aead.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/openpgp/src/crypto/aead.rs b/openpgp/src/crypto/aead.rs index 0f3e5330..93e6ad5d 100644 --- a/openpgp/src/crypto/aead.rs +++ b/openpgp/src/crypto/aead.rs @@ -26,6 +26,9 @@ impl AEADAlgorithm { &EAX => // Digest size is independent of the cipher. Ok(aead::Eax::<cipher::Aes128>::DIGEST_SIZE), + &OCB => + // According to RFC4880bis, Section 5.16.2. + Ok(16), _ => Err(Error::UnsupportedAEADAlgorithm(self.clone()).into()), } } @@ -36,6 +39,11 @@ impl AEADAlgorithm { match self { &EAX => Ok(16), // According to RFC4880bis, Section 5.16.1. + &OCB => + // According to RFC4880bis, Section 5.16.2, the IV is "at + // least 15 octets long". GnuPG hardcodes 15 in + // openpgp_aead_algo_info. + Ok(15), _ => Err(Error::UnsupportedAEADAlgorithm(self.clone()).into()), } } |