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

Make verified ML-KEM available in libcrux-ml-kem #329

Open
wants to merge 62 commits into
base: dev
Choose a base branch
from

Conversation

jschneider-bensch
Copy link

@jschneider-bensch jschneider-bensch commented Jun 21, 2024

This PR integrates the version of ML-KEM into libcrux-ml-kem that was verified and previously lived in the kem module of libcrux. I've also introduced a pre-verification feature gate in libcrux-ml-kem and libcrux-kem for code that is not verified, yet.

Fixes #326

@franziskuskiefer franziskuskiefer added the waiting-on-author Status: This is awaiting some action from the author. label Jun 24, 2024
@jschneider-bensch
Copy link
Author

Introducing feature gating helper macros makes the presentation much cleaner! The only small wrinkle is the kem module which can't be feature gated by macro, otherwise this happens

error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
  --> libcrux-ml-kem/src/kem/kyber/serialize.rs:9:5
   |
9  | use crate::cloop;
   |     ^^^^^^^^^^^^
   |
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

waiting for the code updates, please re-request review.

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

lgtm with a few nits and one bigger issue below.

Looks like I didn't feature guard tests, example etc. in #333. Now things fail when running without default features.

You can run cargo hack test --each-feature (excluding things like simd128 on x64 machines with --exclude-features) to see what happens. In particular cargo test --no-default-features seems to fail already. We should get that on CI.

So broken combinations are at least

  • --no-default-features
  • --no-default-features --features kyber

Especially the second one should work.

But we can do that in a follow up if you want.

libcrux-ml-kem/src/lib.rs Outdated Show resolved Hide resolved
libcrux-ml-kem/src/lib.rs Show resolved Hide resolved
libcrux-ml-kem/src/lib.rs Outdated Show resolved Hide resolved
libcrux-ml-kem/src/types.rs Outdated Show resolved Hide resolved
libcrux-ml-kem/src/kem.rs Outdated Show resolved Hide resolved
libcrux-kem/src/kem.rs Outdated Show resolved Hide resolved
libcrux-ml-kem/Cargo.toml Outdated Show resolved Hide resolved
libcrux-ml-kem/src/kem/kyber/helper.rs Show resolved Hide resolved
@jschneider-bensch
Copy link
Author

I added more feature gates, so cargo test --no-default-features at least should work now.

Copy link
Member

@franziskuskiefer franziskuskiefer left a comment

Choose a reason for hiding this comment

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

I did a pass and fixed all the remaining issues (that I found, there may be more).
I also added more docs and regenerated F* and C code. I think this is good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🏗 In progress
Development

Successfully merging this pull request may close these issues.

Offer verified ML-KEM API in libcrux-ml-kem
2 participants