From 60cde342dc16fcde2b92246ac4a94bf59ecead9a Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Sun, 22 Jun 2025 12:01:00 +0800 Subject: [PATCH 1/5] Use BCL MLKem --- .github/workflows/build.yml | 90 +++++++++++++++++-- src/Renci.SshNet/Renci.SshNet.csproj | 6 +- ...KeyExchangeMLKem768X25519Sha256.BclImpl.cs | 36 ++++++++ ...geMLKem768X25519Sha256.BouncyCastleImpl.cs | 36 ++++++++ .../KeyExchangeMLKem768X25519Sha256.cs | 54 +++++++---- 5 files changed, 193 insertions(+), 29 deletions(-) create mode 100644 src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BclImpl.cs create mode 100644 src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BouncyCastleImpl.cs diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bbf46a9f4..380b84adc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: -p:CoverletOutput=../../coverlet/linux_unit_test_net_10_coverage.xml \ test/Renci.SshNet.Tests/ - - name: Run Integration Tests .NET + - name: Run Integration Tests .NET 1 run: | dotnet test \ -f net10.0 \ @@ -44,7 +44,33 @@ jobs: --logger GitHubActions \ -p:CollectCoverage=true \ -p:CoverletOutputFormat=cobertura \ - -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage.xml \ + -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_1.xml \ + test/Renci.SshNet.IntegrationTests/ + + - name: Run Integration Tests .NET 2 + run: | + dotnet test \ + -f net10.0 \ + --logger "console;verbosity=normal" \ + --logger GitHubActions \ + --filter "Name=MLKem768X25519Sha256" \ + -p:DefineConstants="Test_BCL_MLKem" \ + -p:CollectCoverage=true \ + -p:CoverletOutputFormat=cobertura \ + -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_2.xml \ + test/Renci.SshNet.IntegrationTests/ + + - name: Run Integration Tests .NET 3 + run: | + dotnet test \ + -f net10.0 \ + --logger "console;verbosity=normal" \ + --logger GitHubActions \ + --filter "Name=MLKem768X25519Sha256" \ + -p:DefineConstants="Test_BouncyCastle_MLKem" \ + -p:CollectCoverage=true \ + -p:CoverletOutputFormat=cobertura \ + -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_3.xml \ test/Renci.SshNet.IntegrationTests/ - name: Archive Coverlet Results @@ -128,15 +154,41 @@ jobs: podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - - name: Run Integration Tests .NET Framework + - name: Run Integration Tests .NET Framework 1 + run: + dotnet test ` + -f net48 ` + --logger "console;verbosity=normal" ` + --logger GitHubActions ` + -p:CollectCoverage=true ` + -p:CoverletOutputFormat=cobertura ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_1.xml ` + test\Renci.SshNet.IntegrationTests\ + + - name: Run Integration Tests .NET Framework 2 run: dotnet test ` -f net48 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` + --filter "Name=MLKem768X25519Sha256" ` + -p:DefineConstants="Test_BCL_MLKem" ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage.xml ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_2.xml ` + test\Renci.SshNet.IntegrationTests\ + + - name: Run Integration Tests .NET Framework 3 + run: + dotnet test ` + -f net48 ` + --logger "console;verbosity=normal" ` + --logger GitHubActions ` + --filter "Name=MLKem768X25519Sha256" ` + -p:DefineConstants="Test_BouncyCastle_MLKem" ` + -p:CollectCoverage=true ` + -p:CoverletOutputFormat=cobertura ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_3.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results @@ -170,15 +222,41 @@ jobs: podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - - name: Run Integration Tests .NET + - name: Run Integration Tests .NET 1 + run: + dotnet test ` + -f net10.0 ` + --logger "console;verbosity=normal" ` + --logger GitHubActions ` + -p:CollectCoverage=true ` + -p:CoverletOutputFormat=cobertura ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_1.xml ` + test\Renci.SshNet.IntegrationTests\ + + - name: Run Integration Tests .NET 2 + run: + dotnet test ` + -f net10.0 ` + --logger "console;verbosity=normal" ` + --logger GitHubActions ` + --filter "Name=MLKem768X25519Sha256" ` + -p:DefineConstants="Test_BCL_MLKem" ` + -p:CollectCoverage=true ` + -p:CoverletOutputFormat=cobertura ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_2.xml ` + test\Renci.SshNet.IntegrationTests\ + + - name: Run Integration Tests .NET 3 run: dotnet test ` -f net10.0 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` + --filter "Name=MLKem768X25519Sha256" ` + -p:DefineConstants="Test_BouncyCastle_MLKem" ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_9_coverage.xml ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_3.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results diff --git a/src/Renci.SshNet/Renci.SshNet.csproj b/src/Renci.SshNet/Renci.SshNet.csproj index 9b7af1590..2d906c1c9 100644 --- a/src/Renci.SshNet/Renci.SshNet.csproj +++ b/src/Renci.SshNet/Renci.SshNet.csproj @@ -49,14 +49,10 @@ - + - - - - True diff --git a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BclImpl.cs b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BclImpl.cs new file mode 100644 index 000000000..6cc22e522 --- /dev/null +++ b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BclImpl.cs @@ -0,0 +1,36 @@ +using System; +using System.Security.Cryptography; + +namespace Renci.SshNet.Security +{ + internal sealed partial class KeyExchangeMLKem768X25519Sha256 + { + private sealed class MLKemBclImpl : Impl + { + private MLKem _mlkem; + + public override byte[] GenerateClientPublicKey() + { + _mlkem = MLKem.GenerateKey(MLKemAlgorithm.MLKem768); + return _mlkem.ExportEncapsulationKey(); + } + + public override byte[] CalculateAgreement(byte[] serverPublicKey) + { + var mlkemSecret = new byte[MLKemAlgorithm.MLKem768.SharedSecretSizeInBytes]; + _mlkem.Decapsulate(serverPublicKey.AsSpan(0, MLKemAlgorithm.MLKem768.CiphertextSizeInBytes), mlkemSecret); + return mlkemSecret; + } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _mlkem?.Dispose(); + } + + base.Dispose(disposing); + } + } + } +} diff --git a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BouncyCastleImpl.cs b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BouncyCastleImpl.cs new file mode 100644 index 000000000..73eb3c08f --- /dev/null +++ b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.BouncyCastleImpl.cs @@ -0,0 +1,36 @@ +using Org.BouncyCastle.Crypto.Generators; +using Org.BouncyCastle.Crypto.Kems; +using Org.BouncyCastle.Crypto.Parameters; + +using Renci.SshNet.Abstractions; + +namespace Renci.SshNet.Security +{ + internal sealed partial class KeyExchangeMLKem768X25519Sha256 + { + private sealed class MLKemBouncyCastleImpl : Impl + { + private MLKemDecapsulator _mlkemDecapsulator; + + public override byte[] GenerateClientPublicKey() + { + var mlkem768KeyPairGenerator = new MLKemKeyPairGenerator(); + mlkem768KeyPairGenerator.Init(new MLKemKeyGenerationParameters(CryptoAbstraction.SecureRandom, MLKemParameters.ml_kem_768)); + var mlkem768KeyPair = mlkem768KeyPairGenerator.GenerateKeyPair(); + + _mlkemDecapsulator = new MLKemDecapsulator(MLKemParameters.ml_kem_768); + _mlkemDecapsulator.Init(mlkem768KeyPair.Private); + + return ((MLKemPublicKeyParameters)mlkem768KeyPair.Public).GetEncoded(); + } + + public override byte[] CalculateAgreement(byte[] serverPublicKey) + { + var mlkemSecret = new byte[_mlkemDecapsulator.SecretLength]; + _mlkemDecapsulator.Decapsulate(serverPublicKey, 0, _mlkemDecapsulator.EncapsulationLength, mlkemSecret, 0, _mlkemDecapsulator.SecretLength); + + return mlkemSecret; + } + } + } +} diff --git a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs index 87614f8e6..5ef44ca1a 100644 --- a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs +++ b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs @@ -2,19 +2,22 @@ using System.Linq; using System.Security.Cryptography; -using Org.BouncyCastle.Crypto.Generators; -using Org.BouncyCastle.Crypto.Kems; using Org.BouncyCastle.Crypto.Parameters; -using Renci.SshNet.Abstractions; using Renci.SshNet.Common; using Renci.SshNet.Messages.Transport; namespace Renci.SshNet.Security { - internal sealed class KeyExchangeMLKem768X25519Sha256 : KeyExchangeECCurve25519 + internal sealed partial class KeyExchangeMLKem768X25519Sha256 : KeyExchangeECCurve25519 { - private MLKemDecapsulator _mlkemDecapsulator; +#if Test_BCL_MLKem + private MLKemBclImpl _mlkemImpl; +#elif Test_BouncyCastle_MLKem + private MLKemBouncyCastleImpl _mlkemImpl; +#else + private Impl _mlkemImpl; +#endif /// /// Gets algorithm name. @@ -42,14 +45,21 @@ protected override void StartImpl() Session.KeyExchangeHybridReplyMessageReceived += Session_KeyExchangeHybridReplyMessageReceived; - var mlkem768KeyPairGenerator = new MLKemKeyPairGenerator(); - mlkem768KeyPairGenerator.Init(new MLKemKeyGenerationParameters(CryptoAbstraction.SecureRandom, MLKemParameters.ml_kem_768)); - var mlkem768KeyPair = mlkem768KeyPairGenerator.GenerateKeyPair(); - - _mlkemDecapsulator = new MLKemDecapsulator(MLKemParameters.ml_kem_768); - _mlkemDecapsulator.Init(mlkem768KeyPair.Private); - - var mlkem768PublicKey = ((MLKemPublicKeyParameters)mlkem768KeyPair.Public).GetEncoded(); +#if Test_BCL_MLKem + _mlkemImpl = new MLKemBclImpl(); +#elif Test_BouncyCastle_MLKem + _mlkemImpl = new MLKemBouncyCastleImpl(); +#else + if (MLKem.IsSupported) + { + _mlkemImpl = new MLKemBclImpl(); + } + else + { + _mlkemImpl = new MLKemBouncyCastleImpl(); + } +#endif + var mlkem768PublicKey = _mlkemImpl.GenerateClientPublicKey(); var x25519PublicKey = _impl.GenerateClientPublicKey(); @@ -101,20 +111,28 @@ private void HandleServerHybridReply(byte[] hostKey, byte[] serverExchangeValue, _hostKey = hostKey; _signature = signature; - if (serverExchangeValue.Length != _mlkemDecapsulator.EncapsulationLength + X25519PublicKeyParameters.KeySize) + if (serverExchangeValue.Length != MLKemAlgorithm.MLKem768.CiphertextSizeInBytes + X25519PublicKeyParameters.KeySize) { throw new SshConnectionException( string.Format(CultureInfo.CurrentCulture, "Bad S_Reply length: {0}.", serverExchangeValue.Length), DisconnectReason.KeyExchangeFailed); } - var mlkemSecret = new byte[_mlkemDecapsulator.SecretLength]; - - _mlkemDecapsulator.Decapsulate(serverExchangeValue, 0, _mlkemDecapsulator.EncapsulationLength, mlkemSecret, 0, _mlkemDecapsulator.SecretLength); + var mlkemSecret = _mlkemImpl.CalculateAgreement(serverExchangeValue); - var x25519Agreement = _impl.CalculateAgreement(serverExchangeValue.Take(_mlkemDecapsulator.EncapsulationLength, X25519PublicKeyParameters.KeySize)); + var x25519Agreement = _impl.CalculateAgreement(serverExchangeValue.Take(MLKemAlgorithm.MLKem768.CiphertextSizeInBytes, X25519PublicKeyParameters.KeySize)); SharedKey = SHA256.HashData(mlkemSecret.Concat(x25519Agreement)); } + + protected override void Dispose(bool disposing) + { + if (disposing) + { + _mlkemImpl?.Dispose(); + } + + base.Dispose(disposing); + } } } From 10101ad05635a6617d26f34c40d4024e8037c1da Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Sun, 16 Nov 2025 11:47:09 +0800 Subject: [PATCH 2/5] Install OpenSSL 3.5 before test BCL MLKem --- .github/workflows/build.yml | 88 ++++++++----------------------------- 1 file changed, 19 insertions(+), 69 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 380b84adc..03832813c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,7 @@ jobs: - name: Run Integration Tests .NET 1 run: | + openssl version dotnet test \ -f net10.0 \ --no-build \ @@ -49,6 +50,20 @@ jobs: - name: Run Integration Tests .NET 2 run: | + # ml-kem requires openssl 3.5.0+ https://learn.microsoft.com/en-us/dotnet/standard/security/cross-platform-cryptography#ml-kem + sudo apt remove openssl -y + wget https://github.com/openssl/openssl/releases/download/openssl-3.5.4/openssl-3.5.4.tar.gz + tar -xzvf openssl-3.5.4.tar.gz + cd openssl-3.5.4 + ./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib + make + sudo make install + export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl + export PATH=/usr/local/ssl/bin:$PATH + sudo ldconfig + openssl version + sudo systemctl restart ssh + cd .. dotnet test \ -f net10.0 \ --logger "console;verbosity=normal" \ @@ -60,19 +75,6 @@ jobs: -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_2.xml \ test/Renci.SshNet.IntegrationTests/ - - name: Run Integration Tests .NET 3 - run: | - dotnet test \ - -f net10.0 \ - --logger "console;verbosity=normal" \ - --logger GitHubActions \ - --filter "Name=MLKem768X25519Sha256" \ - -p:DefineConstants="Test_BouncyCastle_MLKem" \ - -p:CollectCoverage=true \ - -p:CoverletOutputFormat=cobertura \ - -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_3.xml \ - test/Renci.SshNet.IntegrationTests/ - - name: Archive Coverlet Results uses: actions/upload-artifact@v5 with: @@ -154,41 +156,15 @@ jobs: podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - - name: Run Integration Tests .NET Framework 1 - run: - dotnet test ` - -f net48 ` - --logger "console;verbosity=normal" ` - --logger GitHubActions ` - -p:CollectCoverage=true ` - -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_1.xml ` - test\Renci.SshNet.IntegrationTests\ - - - name: Run Integration Tests .NET Framework 2 - run: - dotnet test ` - -f net48 ` - --logger "console;verbosity=normal" ` - --logger GitHubActions ` - --filter "Name=MLKem768X25519Sha256" ` - -p:DefineConstants="Test_BCL_MLKem" ` - -p:CollectCoverage=true ` - -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_2.xml ` - test\Renci.SshNet.IntegrationTests\ - - - name: Run Integration Tests .NET Framework 3 + - name: Run Integration Tests .NET Framework run: dotnet test ` -f net48 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` - --filter "Name=MLKem768X25519Sha256" ` - -p:DefineConstants="Test_BouncyCastle_MLKem" ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage_3.xml ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_4_8_coverage.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results @@ -222,41 +198,15 @@ jobs: podman build -t renci-ssh-tests-server-image -f test/Renci.SshNet.IntegrationTests/Dockerfile test/Renci.SshNet.IntegrationTests/ podman run --rm -h renci-ssh-tests-server -d -p 2222:22 renci-ssh-tests-server-image - - name: Run Integration Tests .NET 1 - run: - dotnet test ` - -f net10.0 ` - --logger "console;verbosity=normal" ` - --logger GitHubActions ` - -p:CollectCoverage=true ` - -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_1.xml ` - test\Renci.SshNet.IntegrationTests\ - - - name: Run Integration Tests .NET 2 - run: - dotnet test ` - -f net10.0 ` - --logger "console;verbosity=normal" ` - --logger GitHubActions ` - --filter "Name=MLKem768X25519Sha256" ` - -p:DefineConstants="Test_BCL_MLKem" ` - -p:CollectCoverage=true ` - -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_2.xml ` - test\Renci.SshNet.IntegrationTests\ - - - name: Run Integration Tests .NET 3 + - name: Run Integration Tests .NET run: dotnet test ` -f net10.0 ` --logger "console;verbosity=normal" ` --logger GitHubActions ` - --filter "Name=MLKem768X25519Sha256" ` - -p:DefineConstants="Test_BouncyCastle_MLKem" ` -p:CollectCoverage=true ` -p:CoverletOutputFormat=cobertura ` - -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage_3.xml ` + -p:CoverletOutput=..\..\coverlet\windows_integration_test_net_10_coverage.xml ` test\Renci.SshNet.IntegrationTests\ - name: Archive Coverlet Results From 68dcd0f3c781eb46c9b61c9e8c7a14c971a7654d Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Sun, 23 Nov 2025 15:19:30 +0800 Subject: [PATCH 3/5] Remove the testing --- .github/workflows/build.yml | 32 ++----------------- .../KeyExchangeMLKem768X25519Sha256.cs | 13 +------- 2 files changed, 3 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 03832813c..7752bdd01 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,9 +35,8 @@ jobs: -p:CoverletOutput=../../coverlet/linux_unit_test_net_10_coverage.xml \ test/Renci.SshNet.Tests/ - - name: Run Integration Tests .NET 1 + - name: Run Integration Tests .NET run: | - openssl version dotnet test \ -f net10.0 \ --no-build \ @@ -45,34 +44,7 @@ jobs: --logger GitHubActions \ -p:CollectCoverage=true \ -p:CoverletOutputFormat=cobertura \ - -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_1.xml \ - test/Renci.SshNet.IntegrationTests/ - - - name: Run Integration Tests .NET 2 - run: | - # ml-kem requires openssl 3.5.0+ https://learn.microsoft.com/en-us/dotnet/standard/security/cross-platform-cryptography#ml-kem - sudo apt remove openssl -y - wget https://github.com/openssl/openssl/releases/download/openssl-3.5.4/openssl-3.5.4.tar.gz - tar -xzvf openssl-3.5.4.tar.gz - cd openssl-3.5.4 - ./Configure --prefix=/usr/local/ssl --openssldir=/usr/local/ssl shared zlib - make - sudo make install - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl - export PATH=/usr/local/ssl/bin:$PATH - sudo ldconfig - openssl version - sudo systemctl restart ssh - cd .. - dotnet test \ - -f net10.0 \ - --logger "console;verbosity=normal" \ - --logger GitHubActions \ - --filter "Name=MLKem768X25519Sha256" \ - -p:DefineConstants="Test_BCL_MLKem" \ - -p:CollectCoverage=true \ - -p:CoverletOutputFormat=cobertura \ - -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage_2.xml \ + -p:CoverletOutput=../../coverlet/linux_integration_test_net_10_coverage.xml \ test/Renci.SshNet.IntegrationTests/ - name: Archive Coverlet Results diff --git a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs index 5ef44ca1a..eaeaeac0a 100644 --- a/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs +++ b/src/Renci.SshNet/Security/KeyExchangeMLKem768X25519Sha256.cs @@ -11,13 +11,7 @@ namespace Renci.SshNet.Security { internal sealed partial class KeyExchangeMLKem768X25519Sha256 : KeyExchangeECCurve25519 { -#if Test_BCL_MLKem - private MLKemBclImpl _mlkemImpl; -#elif Test_BouncyCastle_MLKem - private MLKemBouncyCastleImpl _mlkemImpl; -#else private Impl _mlkemImpl; -#endif /// /// Gets algorithm name. @@ -45,11 +39,6 @@ protected override void StartImpl() Session.KeyExchangeHybridReplyMessageReceived += Session_KeyExchangeHybridReplyMessageReceived; -#if Test_BCL_MLKem - _mlkemImpl = new MLKemBclImpl(); -#elif Test_BouncyCastle_MLKem - _mlkemImpl = new MLKemBouncyCastleImpl(); -#else if (MLKem.IsSupported) { _mlkemImpl = new MLKemBclImpl(); @@ -58,7 +47,7 @@ protected override void StartImpl() { _mlkemImpl = new MLKemBouncyCastleImpl(); } -#endif + var mlkem768PublicKey = _mlkemImpl.GenerateClientPublicKey(); var x25519PublicKey = _impl.GenerateClientPublicKey(); From 756225e31786804c63d3df0e13e37c8b3388ebcb Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Sun, 23 Nov 2025 15:48:59 +0800 Subject: [PATCH 4/5] Print Windows version --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7752bdd01..c69f56bbe 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -107,6 +107,11 @@ jobs: name: Windows Integration Tests .NET Framework runs-on: windows-2025 steps: + - name: Print Windows Version + shell: pwsh + run: | + Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object LCUVe + - name: Checkout uses: actions/checkout@v5 with: @@ -149,6 +154,11 @@ jobs: name: Windows Integration Tests .NET runs-on: windows-2025 steps: + - name: Print Windows Version + shell: pwsh + run: | + Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object LCUVe + - name: Checkout uses: actions/checkout@v5 with: From 0cac7660b8dd33b701726a47be13660356b2c55f Mon Sep 17 00:00:00 2001 From: Scott Xu Date: Sun, 23 Nov 2025 15:50:58 +0800 Subject: [PATCH 5/5] Print full info --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c69f56bbe..b03762d39 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,7 @@ jobs: - name: Print Windows Version shell: pwsh run: | - Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object LCUVe + Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" - name: Checkout uses: actions/checkout@v5 @@ -157,7 +157,7 @@ jobs: - name: Print Windows Version shell: pwsh run: | - Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" | Select-Object LCUVe + Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" - name: Checkout uses: actions/checkout@v5