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

hashes: disable SHA256 ARM SIMD on big-endian targets

Public commit record

What the developer wrote

Authored by russeree

73/100 · Adequate
hashes: disable SHA256 ARM SIMD on big-endian targets

The AArch64 SHA2 backend loads message words as native-endian u32 and then
unconditionally byte-reverses them for little-endian memory order. On
aarch64_be the load already yields big-endian words, so the extra reverse
corrupts every message word and produces wrong digests for SHA256, SHA256d
and SHA256t.

Gate the ARM SIMD backend on target_endian = "little" for both the
one-block SHA256 path and the two-way SHA256d path; big-endian targets use
the endian-correct software fallback.

Assisted-by: deepseek-v4.1-flash-1017
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context
The short version

What changed, and why it matters

This commit fixes a bug in the SHA-256 hashing code used by the rust-bitcoin library on big-endian ARM (AArch64) systems. The optimized ARM code always swapped bytes assuming the computer stores data in little-endian order. On a big-endian ARM system, that extra swap scrambled the input and produced completely wrong hash outputs. The fix disables the ARM-specific fast path on big-endian targets and falls back to the slower but correct generic code. Wrong SHA-256 hashes could break Bitcoin address generation, transaction validation, or any security check that depends on a correct hash.

Recommended action

Treat this as a correctness/security fix and include it in the next maintenance release. Users building rust-bitcoin for big-endian AArch64 (e.g., some embedded/network appliances) should upgrade. Add CI or cross-compilation tests for aarch64_be to prevent regression, and consider a runtime self-test that compares the optimized and fallback SHA-256 outputs.

Security signals we found

01

Incorrect cryptographic output on a supported architecture (big-endian AArch64)

02

Hash mismatch could violate Bitcoin protocol invariants

03

Conditional-compilation bug in architecture-specific optimized path

04

No input validation or runtime detection of endianness before the fix

Risk score

Why this scored 59/100

Our methodology →
Potential impact 18/30
Exploitability 8/25
Stealth signal 12/15
Affected reach 7/15
Confidence 9/10
Evidence quality 5/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.