Skip to content

Rust wrapper: ed25519: guard generate with ed25519_make_key cfg - #11307

Merged
philljj merged 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-8303
Sep 4, 2026
Merged

Rust wrapper: ed25519: guard generate with ed25519_make_key cfg#11307
philljj merged 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-8303

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

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

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@holtrop-wolfssl holtrop-wolfssl self-assigned this Aug 28, 2026
Copilot AI lite review requested due to automatic review settings August 28, 2026 13:27
@wolfSSL-Bot

Copy link
Copy Markdown

Can one of the admins verify this patch?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_key cfg emission in build.rs and gate Ed25519::generate*() plus RNG-dependent tests/examples on ed25519_make_key.
  • C headers: guard wc_ed25519_make_public() / wc_ed25519_make_key() prototypes with HAVE_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 wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread tests/api.c

@philljj philljj left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread tests/api.c
Detect based on wc_ed25519_make_key prototype presence and guard
prototype presence with HAVE_ED25519_MAKE_KEY.

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@wolfSSL-Fenrir-bot
wolfSSL-Fenrir-bot dismissed their stale review August 31, 2026 14:04

Fenrir's latest completed scan found no issues; clearing the prior automated change request.

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor Author

retest this please

@philljj
philljj merged commit 88c0902 into wolfSSL:master Sep 4, 2026
385 checks passed
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.

5 participants