Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions libcrux-ml-kem/src/types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
macro_rules! impl_generic_struct {
($name:ident, $doc:expr) => {
#[derive(Clone)]
Copy link
Member

Choose a reason for hiding this comment

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

This is also used for the private keys, which shouldn't make it that easy. Can you move the struct definition out of here? Then you can add clone only for the public keys.

Copy link
Author

@mmaker mmaker Nov 18, 2025

Choose a reason for hiding this comment

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

I can, just to understand better the desired feature tho: why are secret keys not clone-able?

Currently it's not possible to use secret keys across threads, or have it be serialized with zerocopy. I don't think cloning secret keys explicitly (differently than, say, Copy) causes security issues, right?

Anyways, going first with the external implementation.

Copy link
Member

Choose a reason for hiding this comment

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

It's not a strong requirement. But copying any secret bytes may be a security issue. Making it easier is just not great. But it's not a huge deal, and this bit is changing anyway. So maybe let's just keep it as is for now.

#[doc = $doc]
pub struct $name<const SIZE: usize> {
pub(crate) value: [u8; SIZE],
Expand Down