summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-05-23 11:28:14 +0200
committerJustus Winter <justus@sequoia-pgp.org>2023-05-23 15:48:48 +0200
commit11b11b73d911962a8396c0f6bc57612fdfd25adc (patch)
tree79954be4123b9a63b97cf7b42aaedd03b8818190
parentda190daf38d664d6087aba50fcff3f1b69beb659 (diff)
openpgp: Prefer OCB if available in the Nettle backend.
-rw-r--r--openpgp/src/crypto/backend/nettle.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp/src/crypto/backend/nettle.rs b/openpgp/src/crypto/backend/nettle.rs
index a8624513..c0cb767f 100644
--- a/openpgp/src/crypto/backend/nettle.rs
+++ b/openpgp/src/crypto/backend/nettle.rs
@@ -36,7 +36,11 @@ impl AEADAlgorithm {
/// algorithm and the most performing one, but fall back to any
/// supported algorithm.
pub(crate) const fn const_default() -> AEADAlgorithm {
- AEADAlgorithm::EAX
+ if nettle::aead::OCB_IS_SUPPORTED {
+ AEADAlgorithm::OCB
+ } else {
+ AEADAlgorithm::EAX
+ }
}
pub(crate) fn is_supported_by_backend(&self) -> bool {