Skip to content

Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants - #11358

Open
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-10088
Open

Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants#11358
holtrop-wolfssl wants to merge 1 commit into
wolfSSL:masterfrom
holtrop-wolfssl:f-10088

Conversation

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor

Description

Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants

Fixes F-10088.

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 Sep 2, 2026
Copilot AI lite review requested due to automatic review settings September 2, 2026 19:37

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.

🟡 Changes recommended

The build script uses cargo::rustc-check-cfg (extra :), which Cargo will not parse as a build-script directive, preventing rustc-check-cfg validation from working.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes feature-gating in the Rust wolfCrypt RSA wrapper so hash-type constants are only exposed when the corresponding hashes are actually enabled, aligning the Rust API surface with the underlying wolfSSL build configuration (Fixes F-10088).

Changes:

  • Corrected #[cfg] guards for RSA hash type constants (SHA-224 and SHA-384) in the Rust wrapper.
  • Refactored build-script cfg probing to support conditional cfg enabling (check_cfg_if) and improved SHA-512/224 + SHA-512/256 feature detection.
  • Minor comment punctuation normalization in build.rs.
File summaries
File Description
wrapper/rust/wolfssl-wolfcrypt/src/rsa.rs Fixes SHA-224/SHA-384 cfg guards for RSA hash-type constants so they match the actual enabled hashes.
wrapper/rust/wolfssl-wolfcrypt/build.rs Improves cfg detection logic (adds has_symbol/check_cfg_if) and tightens SHA-512/224 + SHA-512/256 related gating; minor comment tweaks.
Review details

Suppressed comments (1)

wrapper/rust/wolfssl-wolfcrypt/build.rs:509

  • cargo::rustc-check-cfg has an extra ':' and won’t be recognized by Cargo build-script parsing (Cargo expects cargo:...). As written, the rsa_const_api cfg name won’t be registered for check-cfg validation.
    println!("cargo::rustc-check-cfg=cfg(rsa_const_api)");
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread wrapper/rust/wolfssl-wolfcrypt/build.rs
Normalize cargo:: directives in build.rs.

Fixes F-10088.
@holtrop-wolfssl

Copy link
Copy Markdown
Contributor Author

retest this please (build removed)

@holtrop-wolfssl

Copy link
Copy Markdown
Contributor Author

retest this please (ERROR: script returned exit code 5)

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.

3 participants