diff options
author | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2023-01-19 09:55:34 +0100 |
---|---|---|
committer | Wiktor Kwapisiewicz <wiktor@metacode.biz> | 2023-01-19 10:05:54 +0100 |
commit | aacdf9b232c383693fa0c6d9411d3ec168b9487a (patch) | |
tree | ff7275759852b0a2b69a350468c6023735321e10 /openpgp/src/crypto/backend | |
parent | 6536f5e00152b77fb88d7e420334649b41c12ad1 (diff) |
Fix EC curve detection.
- Some systems have smaller set of supported curves and even though the
curve identifiers are compiled in the usage of the curve fails.
- Try to construct an `EcGroup` using retrieved `Nid` as this is a cheap
check that will fail if the curve is truly unsupported.
- Fixes #976.
Diffstat (limited to 'openpgp/src/crypto/backend')
-rw-r--r-- | openpgp/src/crypto/backend/openssl.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp/src/crypto/backend/openssl.rs b/openpgp/src/crypto/backend/openssl.rs index 4e610bfe..aa5c9db7 100644 --- a/openpgp/src/crypto/backend/openssl.rs +++ b/openpgp/src/crypto/backend/openssl.rs @@ -43,7 +43,11 @@ impl Curve { } else { // the rest of EC algorithms are supported via the same // codepath - openssl::nid::Nid::try_from(self).is_ok() + if let Ok(nid) = openssl::nid::Nid::try_from(self) { + openssl::ec::EcGroup::from_curve_name(nid).is_ok() + } else { + false + } } } } |