Skip to content

Commit 46dbd2e

Browse files
committed
Test BCL MLKem and BouncyCastle MLKem
1 parent 25967e7 commit 46dbd2e

File tree

2 files changed

+68
-15
lines changed

2 files changed

+68
-15
lines changed

.github/workflows/build.yml

Lines changed: 56 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ jobs:
107107
name: Windows Integration Tests .NET Framework
108108
runs-on: windows-2025
109109
steps:
110-
- name: Print Windows Version
111-
shell: pwsh
112-
run: |
113-
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
114-
115110
- name: Checkout
116111
uses: actions/checkout@v6
117112
with:
@@ -133,15 +128,41 @@ jobs:
133128
podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/
134129
podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image
135130
136-
- name: Run Integration Tests .NET Framework
131+
- name: Run Integration Tests .NET Framework 1
132+
run:
133+
dotnet test `
134+
-f net48 `
135+
--logger "console;verbosity=normal" `
136+
--logger GitHubActions `
137+
-p:CollectCoverage=true `
138+
-p:CoverletOutputFormat=cobertura `
139+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_1.xml `
140+
test\Renci.SshNet.IntegrationTests\
141+
142+
- name: Run Integration Tests .NET Framework 2
137143
run:
138144
dotnet test `
139145
-f net48 `
140146
--logger "console;verbosity=normal" `
141147
--logger GitHubActions `
148+
--filter "Name=MLKem768X25519Sha256" `
149+
-p:DefineConstants="Test_BCL_MLKem" `
142150
-p:CollectCoverage=true `
143151
-p:CoverletOutputFormat=cobertura `
144-
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage.xml `
152+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_2.xml `
153+
test\Renci.SshNet.IntegrationTests\
154+
155+
- name: Run Integration Tests .NET Framework 3
156+
run:
157+
dotnet test `
158+
-f net48 `
159+
--logger "console;verbosity=normal" `
160+
--logger GitHubActions `
161+
--filter "Name=MLKem768X25519Sha256" `
162+
-p:DefineConstants="Test_BouncyCastle_MLKem" `
163+
-p:CollectCoverage=true `
164+
-p:CoverletOutputFormat=cobertura `
165+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_3.xml `
145166
test\Renci.SshNet.IntegrationTests\
146167

147168
- name: Archive Coverlet Results
@@ -154,11 +175,6 @@ jobs:
154175
name: Windows Integration Tests .NET
155176
runs-on: windows-2025
156177
steps:
157-
- name: Print Windows Version
158-
shell: pwsh
159-
run: |
160-
Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion"
161-
162178
- name: Checkout
163179
uses: actions/checkout@v6
164180
with:
@@ -180,15 +196,41 @@ jobs:
180196
podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/
181197
podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image
182198
183-
- name: Run Integration Tests .NET
199+
- name: Run Integration Tests .NET 1
200+
run:
201+
dotnet test `
202+
-f net10.0 `
203+
--logger "console;verbosity=normal" `
204+
--logger GitHubActions `
205+
-p:CollectCoverage=true `
206+
-p:CoverletOutputFormat=cobertura `
207+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_1.xml `
208+
test\Renci.SshNet.IntegrationTests\
209+
210+
- name: Run Integration Tests .NET 2
211+
run:
212+
dotnet test `
213+
-f net10.0 `
214+
--logger "console;verbosity=normal" `
215+
--logger GitHubActions `
216+
--filter "Name=MLKem768X25519Sha256" `
217+
-p:DefineConstants="Test_BCL_MLKem" `
218+
-p:CollectCoverage=true `
219+
-p:CoverletOutputFormat=cobertura `
220+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_2.xml `
221+
test\Renci.SshNet.IntegrationTests\
222+
223+
- name: Run Integration Tests .NET 3
184224
run:
185225
dotnet test `
186226
-f net10.0 `
187227
--logger "console;verbosity=normal" `
188228
--logger GitHubActions `
229+
--filter "Name=MLKem768X25519Sha256" `
230+
-p:DefineConstants="Test_BouncyCastle_MLKem" `
189231
-p:CollectCoverage=true `
190232
-p:CoverletOutputFormat=cobertura `
191-
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage.xml `
233+
-p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_3.xml `
192234
test\Renci.SshNet.IntegrationTests\
193235

194236
- name: Archive Coverlet Results

src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@ namespace Renci.SshNet.Security
1111
{
1212
internal sealed partial class KeyExchangeMLKem768X25519Sha256 : KeyExchangeECCurve25519
1313
{
14+
#if Test_BCL_MLKem
15+
private MLKemBclImpl _mlkemImpl;
16+
#elif Test_BouncyCastle_MLKem
17+
private MLKemBouncyCastleImpl _mlkemImpl;
18+
#else
1419
private Impl _mlkemImpl;
20+
#endif
1521

1622
/// <summary>
1723
/// Gets algorithm name.
@@ -39,6 +45,11 @@ protected override void StartImpl()
3945

4046
Session.KeyExchangeHybridReplyMessageReceived += Session_KeyExchangeHybridReplyMessageReceived;
4147

48+
#if Test_BCL_MLKem
49+
_mlkemImpl = new MLKemBclImpl();
50+
#elif Test_BouncyCastle_MLKem
51+
_mlkemImpl = new MLKemBouncyCastleImpl();
52+
#else
4253
if (MLKem.IsSupported)
4354
{
4455
_mlkemImpl = new MLKemBclImpl();
@@ -47,7 +58,7 @@ protected override void StartImpl()
4758
{
4859
_mlkemImpl = new MLKemBouncyCastleImpl();
4960
}
50-
61+
#endif
5162
var mlkem768PublicKey = _mlkemImpl.GenerateClientPublicKey();
5263

5364
var x25519PublicKey = _impl.GenerateClientPublicKey();

0 commit comments

Comments
 (0)