Repository navigation
sha256: byte-reverse the wc_Sha256Transform block for ppc64le asm - #11987
yosuke-wolfssl wants to merge 1 commit into
Conversation
- wc_Sha256Transform() takes the ByteReverseWords() local-buffer path on WOLFSSL_PPC64_ASM little-endian builds. Issue: F-17179
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the little-endian PPC64 SHA-256 byte-order fix.
No open issues 🎉
What changed in this PR
Fixes incorrect SHA-256 chaining states from wc_Sha256Transform() on little-endian PPC64 assembly builds by converting host-order input words to the byte order expected by the assembly implementation.
Changes:
- Extends the existing byte-reversal buffer path to little-endian PPC64 assembly builds.
- Reuses existing buffer clearing and leaves big-endian PPC64 behavior unchanged.
| File | Description |
|---|---|
wolfcrypt/src/sha256.c |
Adds little-endian PPC64 assembly to the input byte-reversal condition in wc_Sha256Transform(). |
Review effort: Balanced
|
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11987
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs
Coverage: 1 of 1 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Lite
Problem
On ppc64le builds with
--enable-ppc64-asm,wc_Sha256Transform()returns the wrong chaining state on every call. The API takes the block as host-order 32-bit words. The PPC64 asm (Transform_Sha256_Len) loads each word withlwbrxon little-endian because it expects a big-endian byte stream, which is whatSha256Update()andSha256Final()pass.wc_Sha256Transform()handed the host-order block straight to the asm, so every message word was byte-swapped. The ARM/RISC-V arm of the function already converts the block first.Fix (
wolfcrypt/src/sha256.c)The existing
ByteReverseWords()local-buffer branch ofwc_Sha256Transform()now also coversWOLFSSL_PPC64_ASM && LITTLE_ENDIAN_ORDER. The asm then receives the same byte stream that Update gives it. The buffer is stillForceZero()ed.Closes f-17179.
Tests
No new tests. The existing known-answer tests
test_wc_Sha256Transformandtest_wolfSSL_SHA256_Transformalready cover this. They failed on ppc64le before the fix, but no CI job builds the PPC64 asm.Verification
Configure:
--enable-ppc64-asm --enable-opensslextra --disable-shared, run under qemu-user.sha256API group +testwolfcrypt