Repository navigation
harden error queue and GMULT cases, add force zero to ColdFire DES port - #12001
JacobBarthelmeh wants to merge 5 commits into
Conversation
|
There was a problem hiding this comment.
🟡 Changes recommended
Process-global error snapshots still permit data races and mismatched diagnostics, while new test assertions fail in Windows debug/OpenSSL-extra builds with the error queue disabled.
2 open issues
What changed in this PR
This PR hardens wolfSSL’s error-queue handling and cryptographic internals by addressing stale pointers, removing data-dependent branches, and clearing temporary key material.
Changes:
- Copy exported error strings, reset queue cursors during cleanup, and add regression tests.
- Replace conditional XOR operations with masking in GCM and GCM-SIV multiplication paths.
- Zero temporary key material after ColdFire DES operations.
| File | Description |
|---|---|
wolfcrypt/src/logging.c |
Adds error-string snapshots and resets cursors when clearing queues. |
wolfcrypt/src/des3.c |
Clears the ColdFire DES temporary key buffer. |
wolfcrypt/src/aes.c |
Uses branchless masking in selected multiplication paths. |
tests/api.c |
Adds queue-reset and returned-string lifetime checks. |
Review effort: Balanced
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #12001
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Coverage: 4 of 4 in-scope changed file(s) opened by the reviewer
Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)
This review was generated automatically by Fenrir. Reported findings require changes before merge.
Review tier: Max
| * until the next peek or pull by the same thread. Only written with the mutex | ||
| * held and the last byte is never written, so the strings are always | ||
| * terminated. */ | ||
| static THREAD_LS_T char wc_errq_file[WOLFSSL_MAX_ERROR_SZ]; |
There was a problem hiding this comment.
Error-queue string buffers are shared between threads when THREAD_LS_T is empty · Race conditions
In the mutex-protected global queue, wc_errq_file and wc_errq_reason become ordinary shared globals wherever THREAD_LS_T is empty: no HAVE_THREAD_LS, NO_THREAD_LS, FreeRTOS, Zephyr, or the kernel builds that #undef HAVE_THREAD_LS. They are written under the queue lock, but callers read them after ERRQ_UNLOCK(). Another thread's peek or pull can then overwrite the strings mid-read. Before this PR, peek and pull did not cause that.
Suggested fix: Fixing this for builds without working thread-local storage needs a design decision (caller-owned buffers, or requiring real TLS); see C11 §5.1.2.4 on data races.
Related known findings (similar but distinct; listed for context, not part of this finding)


No description provided.