diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-04-05 14:26:01 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2024-04-05 14:26:01 +0700 |
commit | 9762da219c208cd71e0173a89f7a88e214ce23bd (patch) | |
tree | 3b180b0c7b398ae9425d7dcd28bdf07f672c64a1 | |
parent | DTLS: more robust exclusion of stream ciphers (diff) | |
download | BouncyCastle.NET-ed25519-9762da219c208cd71e0173a89f7a88e214ce23bd.tar.xz |
TLS: Use more appropriate method to check for ECDH curve
-rw-r--r-- | crypto/src/tls/NamedGroup.cs | 2 | ||||
-rw-r--r-- | crypto/src/tls/TlsServerProtocol.cs | 2 | ||||
-rw-r--r-- | crypto/src/tls/TlsUtilities.cs | 6 |
3 files changed, 4 insertions, 6 deletions
diff --git a/crypto/src/tls/NamedGroup.cs b/crypto/src/tls/NamedGroup.cs index 15671a837..a345b8ce0 100644 --- a/crypto/src/tls/NamedGroup.cs +++ b/crypto/src/tls/NamedGroup.cs @@ -224,9 +224,7 @@ namespace Org.BouncyCastle.Tls public static string GetCurveName(int namedGroup) { if (RefersToASpecificCurve(namedGroup)) - { return CurveNames[namedGroup - sect163k1]; - } return null; } diff --git a/crypto/src/tls/TlsServerProtocol.cs b/crypto/src/tls/TlsServerProtocol.cs index 528440272..252660a16 100644 --- a/crypto/src/tls/TlsServerProtocol.cs +++ b/crypto/src/tls/TlsServerProtocol.cs @@ -356,7 +356,7 @@ namespace Org.BouncyCastle.Tls int namedGroup = clientShare.NamedGroup; TlsAgreement agreement; - if (NamedGroup.RefersToASpecificCurve(namedGroup)) + if (NamedGroup.RefersToAnECDHCurve(namedGroup)) { agreement = crypto.CreateECDomain(new TlsECConfig(namedGroup)).CreateECDH(); } diff --git a/crypto/src/tls/TlsUtilities.cs b/crypto/src/tls/TlsUtilities.cs index 67a49e5ef..c6c4a052a 100644 --- a/crypto/src/tls/TlsUtilities.cs +++ b/crypto/src/tls/TlsUtilities.cs @@ -5019,7 +5019,7 @@ namespace Org.BouncyCastle.Tls } TlsAgreement agreement = null; - if (NamedGroup.RefersToASpecificCurve(supportedGroup)) + if (NamedGroup.RefersToAnECDHCurve(supportedGroup)) { if (crypto.HasECDHAgreement()) { @@ -5079,7 +5079,7 @@ namespace Org.BouncyCastle.Tls if (!crypto.HasNamedGroup(group)) continue; - if ((NamedGroup.RefersToASpecificCurve(group) && !crypto.HasECDHAgreement()) || + if ((NamedGroup.RefersToAnECDHCurve(group) && !crypto.HasECDHAgreement()) || (NamedGroup.RefersToASpecificFiniteField(group) && !crypto.HasDHAgreement())) { continue; @@ -5107,7 +5107,7 @@ namespace Org.BouncyCastle.Tls if (!crypto.HasNamedGroup(group)) continue; - if ((NamedGroup.RefersToASpecificCurve(group) && !crypto.HasECDHAgreement()) || + if ((NamedGroup.RefersToAnECDHCurve(group) && !crypto.HasECDHAgreement()) || (NamedGroup.RefersToASpecificFiniteField(group) && !crypto.HasDHAgreement())) { continue; |