@@ -23,8 +23,9 @@ protected TlsProtocolKemTest(TlsCrypto crypto)
2323 {
2424 this .crypto = crypto ;
2525 }
26- // mismatched ML-KEM strengths w/o classical crypto
27- public void testMismatchStrength () throws Exception
26+
27+ // mismatched ML-KEM groups w/o classical crypto
28+ public void testMismatchedGroups () throws Exception
2829 {
2930 PipedInputStream clientRead = TlsTestUtils .createPipedInputStream ();
3031 PipedInputStream serverRead = TlsTestUtils .createPipedInputStream ();
@@ -42,6 +43,7 @@ public void testMismatchStrength() throws Exception
4243 catch (Exception ignored )
4344 {
4445 }
46+
4547 MockTlsKemClient client = new MockTlsKemClient (crypto , null );
4648 client .setNamedGroups (new int []{ NamedGroup .MLKEM512 });
4749 try
@@ -56,7 +58,22 @@ public void testMismatchStrength() throws Exception
5658 serverThread .join ();
5759 }
5860
59- public void testClientServer () throws Exception
61+ public void testMLKEM512 () throws Exception
62+ {
63+ implTestClientServer (NamedGroup .MLKEM512 );
64+ }
65+
66+ public void testMLKEM768 () throws Exception
67+ {
68+ implTestClientServer (NamedGroup .MLKEM768 );
69+ }
70+
71+ public void testMLKEM1024 () throws Exception
72+ {
73+ implTestClientServer (NamedGroup .MLKEM1024 );
74+ }
75+
76+ private void implTestClientServer (int kemGroup ) throws Exception
6077 {
6178 PipedInputStream clientRead = TlsTestUtils .createPipedInputStream ();
6279 PipedInputStream serverRead = TlsTestUtils .createPipedInputStream ();
@@ -66,10 +83,12 @@ public void testClientServer() throws Exception
6683 TlsClientProtocol clientProtocol = new TlsClientProtocol (clientRead , clientWrite );
6784 TlsServerProtocol serverProtocol = new TlsServerProtocol (serverRead , serverWrite );
6885
69- ServerThread serverThread = new ServerThread (crypto , serverProtocol , null , false );
86+ ServerThread serverThread = new ServerThread (crypto , serverProtocol , new int []{ kemGroup } , false );
7087 serverThread .start ();
7188
7289 MockTlsKemClient client = new MockTlsKemClient (crypto , null );
90+ client .setNamedGroups (new int []{ kemGroup });
91+
7392 clientProtocol .connect (client );
7493
7594 // NOTE: Because we write-all before we read-any, this length can't be more than the pipe capacity
0 commit comments