diff options
author | Azul <azul@riseup.net> | 2020-11-17 07:04:01 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2020-11-24 12:24:36 +0100 |
commit | 43ad20c16ccee274cc4ecdb327e70e2349fa12ad (patch) | |
tree | 8f5a4ee4c08643a914fb519e609c987d57617a40 /openpgp/src/crypto/backend | |
parent | 7fb0e9302b1145d959bdb81b064b453d21f49b3a (diff) |
openpgp: seal Aead trait.
- Seal the Aead trait so it cannot be implemented outside the openpgp
crate.
- This way we can extend the trait without breaking the API
compatibility.
- See #538.
Diffstat (limited to 'openpgp/src/crypto/backend')
-rw-r--r-- | openpgp/src/crypto/backend/cng/aead.rs | 2 | ||||
-rw-r--r-- | openpgp/src/crypto/backend/nettle/aead.rs | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/openpgp/src/crypto/backend/cng/aead.rs b/openpgp/src/crypto/backend/cng/aead.rs index d0208221..d30073ca 100644 --- a/openpgp/src/crypto/backend/cng/aead.rs +++ b/openpgp/src/crypto/backend/cng/aead.rs @@ -2,6 +2,7 @@ use crate::{Error, Result}; use crate::crypto::aead::Aead; +use crate::seal; use crate::types::{AEADAlgorithm, SymmetricAlgorithm}; use super::symmetric::Ctr; @@ -73,6 +74,7 @@ impl EaxAes { } +impl seal::Sealed for EaxAes {} impl Aead for EaxAes { /// Adds associated data `ad`. fn update(&mut self, ad: &[u8]) { diff --git a/openpgp/src/crypto/backend/nettle/aead.rs b/openpgp/src/crypto/backend/nettle/aead.rs index 1614a20a..797dd040 100644 --- a/openpgp/src/crypto/backend/nettle/aead.rs +++ b/openpgp/src/crypto/backend/nettle/aead.rs @@ -4,8 +4,10 @@ use nettle::{aead, cipher}; use crate::{Error, Result}; use crate::crypto::aead::Aead; +use crate::seal; use crate::types::{AEADAlgorithm, SymmetricAlgorithm}; +impl<T: nettle::aead::Aead> seal::Sealed for T {} impl<T: nettle::aead::Aead> Aead for T { fn update(&mut self, ad: &[u8]) { self.update(ad) |