Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460
Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460JacobBarthelmeh wants to merge 10 commits into
Conversation
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #10460
Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-src
No new issues found in the changed files. ✅
There was a problem hiding this comment.
Pull request overview
This PR addresses a set of static-analysis findings and robustness improvements across multiple crypto backends, and intentionally changes the public MD2/MD4 init/update/final APIs to return int status codes (breaking API compatibility as noted in the PR description).
Changes:
- Change MD2/MD4 public APIs (
wc_Init*,wc_*Update,wc_*Final) fromvoidtointand propagate error handling into implementations and tests. - Harden several hardware/port integrations (SECO/CAAM/devcrypto/ARIA) with missing allocation checks and additional sensitive-buffer zeroization.
- Improve ChaCha portability by avoiding potentially unaligned 32-bit loads, and add new test coverage for unaligned ChaCha/XChaCha key/IV buffers.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
wolfssl/wolfcrypt/md4.h |
Public MD4 API now returns int for init/update/final. |
wolfssl/wolfcrypt/md2.h |
Public MD2 API now returns int for init/update/final. |
wolfcrypt/src/md4.c |
MD4 functions now return status codes and validate arguments. |
wolfcrypt/src/md2.c |
MD2 functions now return status codes; wc_Md2Hash now propagates failures. |
wolfcrypt/test/test.c |
Updates MD2/MD4 tests for new return codes; adds unaligned ChaCha/XChaCha tests. |
tests/api/test_md4.c |
Updates API tests to validate new MD4 error returns. |
tests/api/test_md2.c |
Updates API tests to validate new MD2 error returns and wc_Md2Hash argument handling. |
wolfcrypt/src/chacha.c |
Uses readUnalignedWord32() to avoid unaligned loads. |
wolfcrypt/src/port/devcrypto/devcrypto_rsa.c |
Fixes missing NULL check for an allocation. |
wolfcrypt/src/port/devcrypto/devcrypto_aes.c |
Refactors CTR keystream generation to ensure cleanup and explicit zeroization. |
wolfcrypt/src/port/caam/wolfcaam_seco.c |
Adds allocation checks and zeros KEK material after use. |
wolfcrypt/src/port/caam/wolfcaam_fsl_nxp.c |
Adds allocation checks for alignment buffers and improves failure handling. |
wolfcrypt/src/port/aria/aria-cryptocb.c |
Zeroizes sensitive temporary key buffers in ARIA operations. |
doc/dox_comments/header_files/md4.h |
Updates MD4 doxygen prototypes to int return types. |
doc/dox_comments/header_files/md2.h |
Updates MD2 doxygen prototypes to int return types. |
doc/dox_comments/header_files-ja/md4.h |
Updates Japanese MD4 doxygen prototypes to int return types. |
doc/dox_comments/header_files-ja/md2.h |
Updates Japanese MD2 doxygen prototypes to int return types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Retest this please Jenkins. FIPS-ready test shows as deleted. |
373f3f4 to
7e30aad
Compare
|
Retest this please Jenkins. multi-test failure but page not found when digging into the reason. |
This breaks API compatibility for MD4 and MD2 switching the public API from returning void to returning int.