Repository navigation
Fix clang-tidy 14 findings in test.c, sha3.c and aes.c - #11970
Merged
Merged
Conversation
- test.c cert_test(): the ret = 0 after the inhibitAnyPolicy check is never read (clang-analyzer-deadcode.DeadStores); every following path assigns ret before done. - sha3.c Sha3Update(): clang-analyzer-core.DivideZero on len / (p * 8U). p is range-checked to 9..21, but on the CshakeBytePad path (entry with i == rate and len 0) the analyzer loses the range and treats p * 8U as zero. Computing the block size once into a local after the range check, as Sha3Final() does with rate, avoids the false positive. - aes.c: parenthesize the macro argument in the three GMULT definitions (bugprone-macro-parentheses).
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the clang-tidy warning cleanup.
No open issues 🎉
What changed in this PR
This PR addresses clang-tidy 14 warnings in wolfCrypt’s certificate tests, SHA-3 implementation, and AES-GCM macros without intended behavior changes.
Changes:
- Remove an unused assignment in
cert_test(). - Compute and reuse the validated SHA-3 block size to avoid a divide-by-zero false positive.
- Parenthesize the cast argument in three
GMULTmacros.
| File | Description |
|---|---|
wolfcrypt/test/test.c |
Remove a dead store after the inhibitAnyPolicy check. |
wolfcrypt/src/sha3.c |
Reuse a local block size throughout Sha3Update(). |
wolfcrypt/src/aes.c |
Parenthesize m in three GMULT definitions. |
Review effort: Balanced
|
Member
Author
|
Jenkins retest this please |
douzzer
approved these changes
Nov 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PRB clang-tidy legs have not run since the multi-test sandbox change; once https://github.com/wolfSSL/testing/pull/1093 lands, clang-tidy 14 reports three findings on master, which are fixed in this PR:
cert_test(): drop a deadret = 0(deadcode.DeadStores)Sha3Update(): compute the block size once after the range check, avoiding a core.DivideZero false positive on the cSHAKE byte-pad pathGMULTmacros: parenthesize the macro argument (bugprone-macro-parentheses)