summary refs log tree commit diff
path: root/crypto/test
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-09-11 12:00:39 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-09-11 12:00:39 +0700
commit67d33a2258f53f50f348a1362335e8201d3a77b2 (patch)
treef5345c561cfc01c592613e8d845a48f789a81635 /crypto/test
parentCRL NextUpdate can be null (diff)
downloadBouncyCastle.NET-ed25519-67d33a2258f53f50f348a1362335e8201d3a77b2.tar.xz
Check DH standard group lookup
Diffstat (limited to 'crypto/test')
-rw-r--r--crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs b/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs
index 60f88bd05..a274cc5ba 100644
--- a/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs
+++ b/crypto/test/src/tls/crypto/test/BcTlsCryptoTest.cs
@@ -4,6 +4,7 @@ using System.IO;
 
 using NUnit.Framework;
 
+using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Security;
 using Org.BouncyCastle.Tls.Crypto.Impl.BC;
 using Org.BouncyCastle.Tls.Tests;
@@ -183,7 +184,15 @@ namespace Org.BouncyCastle.Tls.Crypto.Tests
             IList groups = new TestTlsDHGroupVerifier().Groups;
             foreach (DHGroup dhGroup in groups)
             {
-                int namedGroup = TlsDHUtilities.GetNamedGroupForDHParameters(dhGroup.P, dhGroup.G);
+                BigInteger p = dhGroup.P, g = dhGroup.G;
+
+                /*
+                 * DefaultTlsDHGroupVerifier default groups are configured from DHStandardGroups, so
+                 * we expect to recover the exact instance here.
+                 */
+                Assert.AreSame(dhGroup, TlsDHUtilities.GetStandardGroupForDHParameters(p, g));
+
+                int namedGroup = TlsDHUtilities.GetNamedGroupForDHParameters(p, g);
 
                 // Already tested the named groups
                 if (NamedGroup.RefersToASpecificFiniteField(namedGroup))