diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2021-10-06 12:17:59 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2022-01-06 18:49:23 +0100 |
commit | 8210f923647472794745016db2b59e34c8751e8c (patch) | |
tree | c5486ba7d42fd5f6523801c15df0ea472cc0a5b9 /openpgp/src/crypto/mpi.rs | |
parent | dfbc2f8207a9bc3f9faeea2eebdfc39c6ffb91f2 (diff) |
openpgp: Exhaustively handle curves in MPI::decode_point_common.
Diffstat (limited to 'openpgp/src/crypto/mpi.rs')
-rw-r--r-- | openpgp/src/crypto/mpi.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/openpgp/src/crypto/mpi.rs b/openpgp/src/crypto/mpi.rs index c586e3fa..4ecde45b 100644 --- a/openpgp/src/crypto/mpi.rs +++ b/openpgp/src/crypto/mpi.rs @@ -190,8 +190,13 @@ impl MPI { Ok((&value[1..], &[])) }, - _ => { - + NistP256 + | NistP384 + | NistP521 + | BrainpoolP256 + | BrainpoolP512 + => + { // Length of one coordinate in bytes, rounded up. let coordinate_length = (curve.len()? + 7) / 8; @@ -216,6 +221,9 @@ impl MPI { Ok((&value[1..1 + coordinate_length], &value[1 + coordinate_length..])) }, + + Unknown(_) => + Err(Error::UnsupportedEllipticCurve(curve.clone()).into()), } } |