diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2023-03-01 16:25:59 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2023-03-01 18:08:57 +0100 |
commit | 913904754ddd585d93522bc45e8d9e830d278f9a (patch) | |
tree | 14e20277ddcdde82806e55586ef8748a5af27d90 /openpgp/src/crypto/backend/openssl | |
parent | ea5606fd9cd2096301e7e4b690f9998d6a36bff9 (diff) |
openpgp: Add support for brainpoolP384r1.
- One of the brainpool curves was not included in our enum Curve,
because at the time we implemented ECC support, it wasn't part of
the RFC4880bis document.
- Unfortunately, we failed to mark enum Curve as non-exhaustive, so
we cannot add a variant without breaking the API.
- We can, however, support the curve by matching on its OID.
Diffstat (limited to 'openpgp/src/crypto/backend/openssl')
-rw-r--r-- | openpgp/src/crypto/backend/openssl/asymmetric.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp/src/crypto/backend/openssl/asymmetric.rs b/openpgp/src/crypto/backend/openssl/asymmetric.rs index aef777bf..5a1dc295 100644 --- a/openpgp/src/crypto/backend/openssl/asymmetric.rs +++ b/openpgp/src/crypto/backend/openssl/asymmetric.rs @@ -70,8 +70,12 @@ impl TryFrom<&Curve> for Nid { Curve::NistP384 => Nid::SECP384R1, Curve::NistP521 => Nid::SECP521R1, Curve::BrainpoolP256 => Nid::BRAINPOOL_P256R1, + Curve::Unknown(_) if curve.is_brainpoolp384() => Nid::BRAINPOOL_P384R1, Curve::BrainpoolP512 => Nid::BRAINPOOL_P512R1, - _ => return Err(crate::Error::UnsupportedEllipticCurve(curve.clone()).into()), + Curve::Ed25519 | // Handled differently. + Curve::Cv25519 | // Handled differently. + Curve::Unknown(_) => + return Err(crate::Error::UnsupportedEllipticCurve(curve.clone()).into()), }) } } |