Skip to content

Signature APIs#1241

Open
wysiwys wants to merge 60 commits intomainfrom
wysiwys/signature-apis
Open

Signature APIs#1241
wysiwys wants to merge 60 commits intomainfrom
wysiwys/signature-apis

Conversation

@wysiwys
Copy link
Contributor

@wysiwys wysiwys commented Nov 17, 2025

  • Implement key-centric and slice-based signature public APIs for libcrux-ml-dsa, libcrux-ed25519, and libcrux-ecdsa
  • Include macros in libcrux-traits crate that reduce boilerplate in signature API implementations in crates
  • Add libcrux-signature crate
  • Implement internal sign_mut() in libcrux-ml-dsa (moved from the change in Signature traits #1080 )
  • Update changelogs
  • Additional documentation as needed

Resolves #1034

@wysiwys wysiwys self-assigned this Nov 17, 2025
Copy link
Member

@keks keks left a comment

Choose a reason for hiding this comment

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

I think this looks pretty good! I left some comments for feedback. I also noticed that there are a few public items (I think just modules?) that do not have a doc comment, I guess these are what you had in mind with the documentation todo in the PR?

@franziskuskiefer franziskuskiefer mentioned this pull request Dec 1, 2025
24 tasks
@wysiwys wysiwys force-pushed the wysiwys/signature-apis branch from dad5321 to e1dbc7e Compare December 11, 2025 11:08
@wysiwys wysiwys marked this pull request as ready for review December 11, 2025 16:20
/// An error when verifying a signature.
#[derive(Debug)]
pub enum VerificationError {
// TODO: add doc comment.
Copy link
Member

Choose a reason for hiding this comment

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

These todos should get resolvec

// TODO: add doc comment.
MalformedHintError,
// TODO: add doc comment.
SignerResponseExceedsBoundError,
Copy link
Member

Choose a reason for hiding this comment

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

Error names usually shouldn't contain "error".

@@ -0,0 +1,721 @@
//! This module includes key-centric and slice-based APIs for ML-DSA.
Copy link
Member

Choose a reason for hiding this comment

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

This module looks like it's duplicate lots of code and adds way more APIs we need to maintain.
Do you intend to maintain all APIs or drop some?

It looks like this is true for all new APIs in this PR.

pub mod signature;

pub use libcrux_secrets;
pub use rand;
Copy link
Member

Choose a reason for hiding this comment

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

Should this go behind a rand feaure?
I see we include it unconditionally already. So this may be something for a follow up to clean up.

//!
//! // generate a new signature keypair
//! use rand::TryRngCore;
//! let mut rng = rand::rngs::OsRng;
Copy link
Member

Choose a reason for hiding this comment

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

Using rng's in this way suggests that we think its' a good idea. We shouldn't do that and at least add a comment about using proper rngs.

version.workspace = true

[dependencies]
libcrux-ecdsa = { version = "0.0.4", path = "../../algorithms/ecdsa", optional = true }
Copy link
Member

Choose a reason for hiding this comment

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

We should use workspace dependencies evereywhere.


[dev-dependencies]
# used for rustdocs
libcrux-signature = { path = "../crates/primitives/signature" }
Copy link
Member

Choose a reason for hiding this comment

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

workspace dependency? I'm not sure this can be built on docs.rs.

"expose-hacl",
] }
libcrux-macros = { version = "=0.0.3", path = "../../utils/macros" }
libcrux-traits = { version = "=0.0.4", path = "../../../traits" }
Copy link
Member

Choose a reason for hiding this comment

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

workspace dependencies?

"expose-hacl",
] }
libcrux-sha2 = { version = "=0.0.4", path = "../sha2" }
libcrux-secrets = { version = "=0.0.4", path = "../../utils/secrets" }
Copy link
Member

Choose a reason for hiding this comment

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

Workspace dependencies?

);
}

#[test]
Copy link
Member

Choose a reason for hiding this comment

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

Should these go into a test module?

@jschneider-bensch
Copy link
Collaborator

jschneider-bensch commented Jan 20, 2026

@wysiwys: We should discuss whether this is in good state at the moment.

@jschneider-bensch
Copy link
Collaborator

As discussed offline, I'll take over here, rebase and work towards a slightly scaled back version that exposes the key centric APIs on the already existing types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signature APIs

4 participants

Comments