summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2023-08-23 14:07:24 +0200
committerJustus Winter <justus@sequoia-pgp.org>2023-08-23 14:07:24 +0200
commit5a5a56256f018a1f0bd28c291733e51b360da4b6 (patch)
tree9fa90b7a83d08c98b839c4967b59c8bc0e0e9efb
parent47458ae5c56586bbd702497c2584fa78017d22a4 (diff)
openpgp: Make OCB the default on Nettle if available.
-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 2d73705a..04fef2eb 100644
--- a/openpgp/src/crypto/backend/nettle.rs
+++ b/openpgp/src/crypto/backend/nettle.rs
@@ -37,7 +37,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 {