Repository navigation
Conversation
|
@claude review |
There was a problem hiding this comment.
🟡 Changes recommended
The test’s allocator hooks can cause invalid accesses or frees during ECC cache cleanup, and its wipe watcher falsely fails when memory-zero checking adds an allocation prefix.
2 open issues
What changed in this PR
This PR strengthens ECCSI key cleanup by wiping sensitive multiprecision values and adds a regression test for secret signing key (SSK) zeroization.
Changes:
- Replace
mp_free()withmp_forcezero()for the SSK and temporary value. - Add and register a heap-math test that inspects the SSK buffer before release.
| File | Description |
|---|---|
wolfcrypt/src/eccsi.c |
Wipes the SSK and temporary value during key cleanup. |
tests/api/test_eccsi.h |
Declares and registers the zeroization test. |
tests/api/test_eccsi.c |
Adds allocator hooks to verify the SSK is wiped before release. |
Review effort: Balanced
|
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Beyond the inline finding on the test, I also checked the library change in wc_FreeEccsiKey. mp_forcezero exists for all three math backends: sp_int, tfm and integer.c. In heap math it still calls mp_free after zeroing, so switching from mp_free does not leak the ssk/tmp buffers.
Extended reasoning...
The change in wolfcrypt/src/eccsi.c replaces mp_free with mp_forcezero for the ECCSI SSK and tmp, and adds an allocator-hook test. I checked that mp_forcezero is defined for every math backend and still frees heap memory in integer.c.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
Coverage: 2 of 2 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
70dd9b8 to
0747760
Compare
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
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
0747760 to
841150b
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
Coverage: 0 of 1 in-scope changed file(s) opened by the reviewer; not opened: tests/api/test_eccsi.c
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
There was a problem hiding this comment.
🟡 Changes recommended
The test guard includes heap-math FREERTOS and FREERTOS_TCP configurations without WOLFSSL_TRACK_MEMORY, where XFREE bypasses callbacks and causes false failures even when the SSK is correctly wiped.
1 open issue
Review effort: Balanced
841150b to
683359b
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
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
There was a problem hiding this comment.
🟡 Changes recommended
The callback-based test incorrectly runs under HAVE_IO_POOL or WOLFSSL_EMBOS, where XFREE bypasses allocator callbacks and causes false failures despite correct zeroization.
1 open issue
1 resolved since last review
Review effort: Balanced
683359b to
df9ce1a
Compare
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfssl-bugs
Unchanged since last review (not re-run): wolfcrypt-src, wolfcrypt-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
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
| mp_free(&key->ssk); | ||
| mp_free(&key->tmp); | ||
| mp_forcezero(&key->ssk); | ||
| mp_forcezero(&key->tmp); |
There was a problem hiding this comment.
When does key->tmp hold sensitive data.
There was a problem hiding this comment.
It doesn't, so I put it back to mp_free. Only the SSK is wiped now.
| #ifdef WOLFCRYPT_ECCSI_CLIENT | ||
| mp_free(&key->ssk); | ||
| mp_free(&key->tmp); | ||
| mp_forcezero(&key->ssk); |
There was a problem hiding this comment.
Add a WOLFSSL_CHECK_MEM_ZERO check.
When private data is put into key->ssk or key->tmp, call mp_memzero_add().
key->tmp only holds public values, so it does not need wiping.
df9ce1a to
d0dfa93
Compare
|
@claude review |
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11998
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Not reviewed (no scan target covers them): tests/api/test_eccsi.h
Coverage: 2 of 2 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: Max


Description
Testing
Built --enable-all-crypto --enable-heapmath and passed test suite with updated tests.
Checklist