AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 19 Bitcoin

hashes: Add cpufeatures for no_std SIMD detection

Public commit record

What the developer wrote

Authored by jrakibi

88/100 · Strong
hashes: Add cpufeatures for no_std SIMD detection

Currently SIMD requires `std` because we use `is_x86_feature_detected!`
and `is_aarch64_feature_detected!` macros for runtime CPU feature detection.
This means `no_std` users cannot benefit from the performance boost
provided by hardware SHA extensions.

This adds `cpufeatures` crate as an optional dependency.
When enabled, it provides runtime CPU feature detection in `no_std`
environments for both x86/x86_64 and aarch64.

Discussed in https://github.com/rust-bitcoin/rust-bitcoin/issues/5568#issuecomment-3816450830

Update lock files
✓ Descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Links an issue, advisory, or supporting reference
The short version

What changed, and why it matters

This change lets users of the library who don't use the standard Rust library ('no_std' environments, common in embedded or blockchain hardware) benefit from faster SHA-256 hashing via CPU-specific instructions. It adds an optional helper crate that detects CPU features in 'no_std' mode, similar to how the standard library already does it. There is no direct evidence in the commit that this fixes a security vulnerability; it is a performance and portability improvement.

Recommended action

No immediate security action required. Reviewers may want to verify that the `cpufeatures` crate's detection logic correctly identifies the required instruction-set features on target platforms and that the unsafe SIMD intrinsics remain sound under `no_std`.

Security signals we found

01

Adds optional runtime CPU feature detection for no_std builds

02

Uses `cpufeatures` crate, a widely-used Rust ecosystem crate for CPUID detection

03

Does not remove or weaken existing feature gates; extends them with an additional feature

04

No mention of security bug, vulnerability, or CVE in commit message or diff

05

No unsafe code added beyond existing SIMD intrinsics already present

Risk score

Why this scored 19/100

Our methodology →
Potential impact 2/30
Exploitability 1/25
Stealth signal 1/15
Affected reach 3/15
Confidence 8/10
Evidence quality 4/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.