Fix: WolfCrypt 7 fenrir fixes#10808
Conversation
4db6bea to
7719bc6
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10808
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
7719bc6 to
9986611
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10808
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10808
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
07a672b to
791842d
Compare
|
Jenkins retest this please |
|
retest this please |
791842d to
15d2b46
Compare
|
retest this please |
There was a problem hiding this comment.
Pull request overview
This PR addresses multiple Fenrir findings in wolfCrypt by removing undefined behavior caused by unaligned/aliasing-unsafe pointer casts when reading/writing integer types from byte buffers, and by fixing an output-length propagation bug in the Renesas FSPSM RSA private decrypt path.
Changes:
- Reworked XMSS address byte-setting to use byte-wise stores instead of casting encoded address buffers to
word32*. - Updated SLH-DSA AVX2 x4 SHAKE helpers to use
readUnalignedWord64/writeUnalignedWord64instead of casting hash buffers toword64*. - Fixed scrypt big-endian
Integerifyshifts to avoid integer-promotion/shift UB, fixed SE050 ECC key-id reads using unaligned helpers, and corrected FSPSM RSA private decrypt to update the caller’s*outLen.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| wolfcrypt/src/wc_xmss_impl.c | Removes word32* casting from encoded XMSS address manipulation to avoid unaligned access / strict-aliasing UB. |
| wolfcrypt/src/wc_slhdsa.c | Replaces word64* casts in AVX2 x4 SHAKE hash buffer helpers with unaligned read/write helpers. |
| wolfcrypt/src/pwdbased.c | Adds explicit word32 casts in scrypt big-endian Integerify composition to prevent shift/promotion UB. |
| wolfcrypt/src/port/Renesas/renesas_fspsm_rsa.c | Fixes RSA private decrypt to pass the correct outLen pointer so the caller’s *outLen is updated. |
| wolfcrypt/src/ecc.c | Uses readUnalignedWord32 to safely read SE050 key IDs from key->id without alignment/aliasing UB. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Fixed a series of Fenrir issues that mostly pertained to alignment UB when reading byte arrays as various sizes of integers.
https://fenrir.wolfssl.com/finding/6438
FSPSM RSA private-decrypt never updates caller's *outLen (passes &outLen instead of outLen)
https://fenrir.wolfssl.com/finding/5414
SLH-DSA AVX2 x4 SHAKE helpers cast hash byte streams to word64
https://fenrir.wolfssl.com/finding/5415
ML-DSA little-endian pack/unpack paths cast encoded byte buffers to word pointers
https://fenrir.wolfssl.com/finding/6165
scrypt scryptROMix big-endian Integerify shifts bytes without width cast (signed overflow/oversized shift on 16-bit int)
https://fenrir.wolfssl.com/finding/6166
wc_ecc_init_id (SE050) reinterprets byte id[] array as word32 via pointer cast
https://fenrir.wolfssl.com/finding/6167
XMSS hash-address byte buffers cast to word32* in address-encoding helpers (unaligned access / strict aliasing)
https://fenrir.wolfssl.com/finding/6177
PKCS#12 parse leaves decrypted SafeContents (incl. plaintext private KeyBag) in freed heap buffer