summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/crypto')
-rw-r--r--openpgp/src/crypto/backend/openssl/asymmetric.rs6
-rw-r--r--openpgp/src/crypto/mpi.rs7
2 files changed, 9 insertions, 4 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()),
})
}
}
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs
index e2a93992..7cc94206 100644
--- a/openpgp/src/crypto/mpi.rs
+++ b/openpgp/src/crypto/mpi.rs
@@ -201,10 +201,14 @@ impl MPI {
Ok((&value[1..], &[]))
},
+ Unknown(_) if ! curve.is_brainpoolp384() =>
+ Err(Error::UnsupportedEllipticCurve(curve.clone()).into()),
+
NistP256
| NistP384
| NistP521
| BrainpoolP256
+ | Unknown(_)
| BrainpoolP512
=>
{
@@ -232,9 +236,6 @@ impl MPI {
Ok((&value[1..1 + coordinate_length],
&value[1 + coordinate_length..]))
},
-
- Unknown(_) =>
- Err(Error::UnsupportedEllipticCurve(curve.clone()).into()),
}
}