Rust wrapper: ed25519: guard generate with ed25519_make_key cfg - #11307
Conversation
|
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Pull request overview
This PR improves feature-detection and conditional compilation around Ed25519 key generation by introducing an explicit ed25519_make_key cfg in the Rust wrapper (driven by wc_ed25519_make_key prototype presence) and by guarding the corresponding C API prototypes behind HAVE_ED25519_MAKE_KEY. This aligns the Rust wrapper, headers, and C tests with builds where Ed25519 key generation is compiled out.
Changes:
- Rust wrapper: add
ed25519_make_keycfg emission inbuild.rsand gateEd25519::generate*()plus RNG-dependent tests/examples oned25519_make_key. - C headers: guard
wc_ed25519_make_public()/wc_ed25519_make_key()prototypes withHAVE_ED25519_MAKE_KEY. - C tests and APIs: tighten preprocessor guards so tests and
wolfSSL_ED25519_generate_key()are only built when make-key support is present.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wrapper/rust/wolfssl-wolfcrypt/tests/test_ed25519.rs | Gates RNG usage and key-generation-dependent tests on ed25519_make_key. |
| wrapper/rust/wolfssl-wolfcrypt/src/ed25519.rs | Gates generate() / generate_ex() (and related examples) on ed25519_make_key to match available C symbols. |
| wrapper/rust/wolfssl-wolfcrypt/build.rs | Emits cargo:rustc-cfg=ed25519_make_key when wc_ed25519_make_key is present in bindings. |
| wolfssl/wolfcrypt/ed25519.h | Wraps make-public/make-key prototypes with #ifdef HAVE_ED25519_MAKE_KEY. |
| tests/api/test_ossl_ecx.c | Requires HAVE_ED25519_MAKE_KEY for ED25519 keygen-related OpenSSL-compat tests. |
| tests/api/test_asn.c | Requires HAVE_ED25519_MAKE_KEY for ASN/keygen test paths that generate Ed25519 keys. |
| tests/api.c | Tightens guards around code paths that generate/make-public Ed25519 keys. |
| src/pk.c | Ensures wolfSSL_ED25519_generate_key() is only compiled when make-key support exists and improves the “not built in” diagnostic ordering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11307
Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-rs-src, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
philljj
left a comment
There was a problem hiding this comment.
Looks good.
Please review the Fenrir define guard item.
Runs clean with skoll, other than this test coverage suggestion:
MEDIUM-1: Add coverage for the make-key-disabled configuration
- File:
wrapper/rust/wolfssl-wolfcrypt/build.rs:423 - Function:
scan_cfg - Action: SUGGEST
Description: The PR's primary behavior is the new false path for ed25519_make_key, but the Rust CI matrix never builds wolfSSL with NO_ED25519_MAKE_KEY; it either enables Ed25519 normally or disables Ed25519 entirely. The test changes only add conditional guards, so ordinary configurations always take the existing make-key-present path. Consequently, a regression in the header guard, cfg detection, or exclusion of generate() and make_public() would not be detected.
Code:
check_cfg(&binding, "wc_ed25519_make_key", "ed25519_make_key");
Recommendation: Exercise the exact reduced-feature configuration fixed by this PR so the generated bindings omit wc_ed25519_make_key and the Rust crate is verified without ed25519_make_key.
Detect based on wc_ed25519_make_key prototype presence and guard prototype presence with HAVE_ED25519_MAKE_KEY.
5829a81 to
055b128
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11307
Scan targets checked: wolfcrypt-bugs, wolfcrypt-rs-bugs, wolfcrypt-rs-src, wolfcrypt-src, wolfssl-bugs, wolfssl-src
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Fenrir's latest completed scan found no issues; clearing the prior automated change request.
|
retest this please |
Description
Detect based on wc_ed25519_make_key prototype presence and guard prototype presence with HAVE_ED25519_MAKE_KEY.
Fixes F-8303
Testing
How did you test?
Checklist