Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants - #11358
Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants#11358holtrop-wolfssl wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 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-cfghas an extra ':' and won’t be recognized by Cargo build-script parsing (Cargo expectscargo:...). As written, thersa_const_apicfg name won’t be registered forcheck-cfgvalidation.
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.
Normalize cargo:: directives in build.rs. Fixes F-10088.
333dff4 to
1558fe8
Compare
|
retest this please (build removed) |
|
retest this please (ERROR: script returned exit code 5) |
Description
Rust wrapper: rsa: fix sha224/sha384 cfg guards for hash type constants
Fixes F-10088.
Testing
How did you test?
Checklist