Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ML-KEM: OpenSSL Part 1 #113719

Merged
merged 50 commits into from
Mar 21, 2025
Merged

ML-KEM: OpenSSL Part 1 #113719

merged 50 commits into from
Mar 21, 2025

Conversation

vcsjones
Copy link
Member

@vcsjones vcsjones commented Mar 20, 2025

This brings in the minimum implementation to have a testable implementation of ML-KEM on Linux.

What is in this PR:

  • Key generation
  • Key import (seed, encapsulation key, decapsulation key)
  • Key export (seed, encapsulation key, decapsulation key)
  • Encapsulate and Decapsulate
  • Microsoft.Bcl.Cryptography (only working implementation for now is type-forwards, down level always has IsSupported as false until a Windows implementation is available)
  • Tests

What is not in this PR:

  • PKCS8 / SPKI loading and export
  • Convenience APIs, Callee-allocated buffers
  • Platform-specific derived types (MLKemOpenSsl, etc)
  • Certificates

Contributes to #113508

Comment on lines 112 to 122
[ConditionalFact(typeof(MLKem), nameof(MLKem.IsSupported))]
public static void ExportPrivateSeed_OnlyHasDecapsulationKey()
{
MLKemGenerateTestVector vector = MLKemGenerateTestVectors.First();
using MLKem kem = MLKem.ImportDecapsulationKey(
vector.Algorithm,
vector.DecapsulationKey.HexToByteArray());

Assert.Throws<CryptographicException>(() => kem.ExportPrivateSeed(
new byte[MLKem.PrivateSeedSizeInBytes]));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we'll have it later, but a template method boundary conditions test could import a decaps key (and/or encaps key) then call export on the seed with the wrong size, and we show that ExportPrivateSeedCore never got called.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add this to my scenario of "test cases when we have derived types" where "derived type = stub"

Copy link
Member

@bartonjs bartonjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So long as that one header uses a style consistently, LGTM

@vcsjones vcsjones merged commit f6fc3fb into dotnet:main Mar 21, 2025
145 of 148 checks passed
@vcsjones vcsjones deleted the ml-kem branch March 21, 2025 01:02
@vcsjones vcsjones mentioned this pull request Mar 21, 2025
@vcsjones vcsjones added this to the 10.0.0 milestone Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants