Skip to content

Commit

Permalink
TLS: Use more appropriate method to check for ECDH curve
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdettman committed Apr 4, 2024
1 parent c626bc3 commit 7a2cc6f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ protected ServerHello generate13ServerHello(ClientHello clientHello, HandshakeMe
int namedGroup = clientShare.getNamedGroup();

TlsAgreement agreement;
if (NamedGroup.refersToASpecificCurve(namedGroup))
if (NamedGroup.refersToAnECDHCurve(namedGroup))
{
agreement = crypto.createECDomain(new TlsECConfig(namedGroup)).createECDH();
}
Expand Down
6 changes: 3 additions & 3 deletions tls/src/main/java/org/bouncycastle/tls/TlsUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -5336,7 +5336,7 @@ private static void collectKeyShares(TlsClientContext clientContext, int[] suppo
}

TlsAgreement agreement = null;
if (NamedGroup.refersToASpecificCurve(supportedGroup))
if (NamedGroup.refersToAnECDHCurve(supportedGroup))
{
if (crypto.hasECDHAgreement())
{
Expand Down Expand Up @@ -5409,7 +5409,7 @@ static KeyShareEntry selectKeyShare(TlsCrypto crypto, ProtocolVersion negotiated
continue;
}

if ((NamedGroup.refersToASpecificCurve(group) && !crypto.hasECDHAgreement()) ||
if ((NamedGroup.refersToAnECDHCurve(group) && !crypto.hasECDHAgreement()) ||
(NamedGroup.refersToASpecificFiniteField(group) && !crypto.hasDHAgreement()) ||
(NamedGroup.refersToASpecificKem(group) && !crypto.hasKemAgreement()))
{
Expand Down Expand Up @@ -5446,7 +5446,7 @@ static int selectKeyShareGroup(TlsCrypto crypto, ProtocolVersion negotiatedVersi
continue;
}

if ((NamedGroup.refersToASpecificCurve(group) && !crypto.hasECDHAgreement()) ||
if ((NamedGroup.refersToAnECDHCurve(group) && !crypto.hasECDHAgreement()) ||
(NamedGroup.refersToASpecificFiniteField(group) && !crypto.hasDHAgreement()) ||
(NamedGroup.refersToASpecificKem(group) && !crypto.hasKemAgreement()))
{
Expand Down

0 comments on commit 7a2cc6f

Please sign in to comment.