refactor(rng): converge ecdsa off legacy rand line#261
refactor(rng): converge ecdsa off legacy rand line#261EffortlessSteven wants to merge 2 commits intorng-localize-legacy-linefrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request initiates the convergence of cryptographic components by migrating the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request refactors uselesskey-ecdsa to use the current RNG stack, moving it off the legacy rand 0.8 line. The changes involve updating several cryptographic dependencies to their release candidate versions and adapting the code to their new APIs. The changes are well-contained and align with the PR's goal. My review focuses on a maintainability improvement regarding the naming of the updated RNG dependencies, suggesting a more idiomatic approach to improve clarity for future contributors.
| rand_chacha10.workspace = true | ||
| rand_core10.workspace = true |
There was a problem hiding this comment.
The dependency names rand_chacha10 and rand_core10 are unconventional and could be confusing for future maintainers, as they don't match the actual crate names on crates.io. It's more idiomatic to use the original crate names, which can be done by aliasing the workspace dependencies here. This improves readability and aligns with common Rust practices.
Applying this suggestion will require updating the corresponding use statements and type paths in src/keypair.rs.
| rand_chacha10.workspace = true | |
| rand_core10.workspace = true | |
| rand_chacha = { workspace = true, package = "rand_chacha10" } | |
| rand_core = { workspace = true, package = "rand_core10" } |
| use rand_chacha10::ChaCha20Rng; | ||
| use rand_core10::SeedableRng; |
There was a problem hiding this comment.
| } | ||
|
|
||
| fn generate_p256(spec: EcdsaSpec, rng: &mut impl rand_core::CryptoRngCore) -> Inner { | ||
| fn generate_p256(spec: EcdsaSpec, rng: &mut impl rand_core10::CryptoRng) -> Inner { |
There was a problem hiding this comment.
To align with the suggested change in Cargo.toml of using idiomatic crate names, the type path for the rng parameter should be updated to use rand_core.
| fn generate_p256(spec: EcdsaSpec, rng: &mut impl rand_core10::CryptoRng) -> Inner { | |
| fn generate_p256(spec: EcdsaSpec, rng: &mut impl rand_core::CryptoRng) -> Inner { |
| } | ||
|
|
||
| fn generate_p384(spec: EcdsaSpec, rng: &mut impl rand_core::CryptoRngCore) -> Inner { | ||
| fn generate_p384(spec: EcdsaSpec, rng: &mut impl rand_core10::CryptoRng) -> Inner { |
There was a problem hiding this comment.
To align with the suggested change in Cargo.toml of using idiomatic crate names, the type path for the rng parameter should be updated to use rand_core.
| fn generate_p384(spec: EcdsaSpec, rng: &mut impl rand_core10::CryptoRng) -> Inner { | |
| fn generate_p384(spec: EcdsaSpec, rng: &mut impl rand_core::CryptoRng) -> Inner { |
873ce13 to
ee04d09
Compare
Summary
This is the first crypto-edge convergence step on top of #260: move
uselesskey-ecdsaoff the legacyrand 0.8/rand_core 0.6line and onto the current RNG aliases plus the corresponding RustCrypto RC curve stack.What changed
uselesskey-ecdsafrom local legacy RNG deps to:rand_chacha10.workspacerand_core10.workspacep256 = 0.14.0-rc.8p384 = 0.14.0-rc.8elliptic-curve = 0.14.0-rc.29Generate::try_generate_from_rngto_sec1_pointWhy
After #260, the legacy RNG line is no longer workspace-scoped. This PR proves one crypto-edge crate can actually converge without drifting deterministic fixture identity.
The important claim here is not just compilation. The existing deterministic regression harness still passes after the dependency move.
Stacked on #260.
Refs #257.
Testing
cargo test -p uselesskey-ecdsa --all-featurescargo test -p uselesskey-integration-tests --features determinism-regression --test determinism_regressioncargo xtask gate