diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-02-28 12:19:05 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-02-28 13:20:22 +0100 |
commit | f6b4b029930ac93fd6b3efed0128940b4b343fe0 (patch) | |
tree | efefee6c5e48723bfe1b10d6ce179aef478eeac5 /openpgp/src/crypto/backend/openssl | |
parent | 39bf91d6812f499327752803a6ecfada74a9b606 (diff) |
openpgp: Further simplify AEAD abstraction.
- Hand in the additional authenticated data when constructing the
context.
Diffstat (limited to 'openpgp/src/crypto/backend/openssl')
-rw-r--r-- | openpgp/src/crypto/backend/openssl/aead.rs | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/openpgp/src/crypto/backend/openssl/aead.rs b/openpgp/src/crypto/backend/openssl/aead.rs index 5e73ff0a..469539c0 100644 --- a/openpgp/src/crypto/backend/openssl/aead.rs +++ b/openpgp/src/crypto/backend/openssl/aead.rs @@ -13,11 +13,6 @@ struct OpenSslContext { } impl Aead for OpenSslContext { - fn update(&mut self, ad: &[u8]) -> Result<()> { - self.ctx.cipher_update(ad, None)?; - Ok(()) - } - fn encrypt_seal(&mut self, dst: &mut [u8], src: &[u8]) -> Result<()> { debug_assert_eq!(dst.len(), src.len() + self.digest_size()); @@ -59,6 +54,7 @@ impl AEADAlgorithm { &self, sym_algo: SymmetricAlgorithm, key: &[u8], + aad: &[u8], nonce: &[u8], op: CipherOp, ) -> Result<Box<dyn Aead>> { @@ -89,6 +85,7 @@ impl AEADAlgorithm { ctx.decrypt_init(None, None, Some(nonce))?, } ctx.set_padding(false); + ctx.cipher_update(aad, None)?; Ok(Box::new(OpenSslContext { ctx, })) |