Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460
Open
JacobBarthelmeh wants to merge 10 commits into
Open
Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460JacobBarthelmeh wants to merge 10 commits into
JacobBarthelmeh 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. ✅
Contributor
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.
| @@ -37,29 +37,51 @@ | |||
| /* Unit test for wc_InitMd4() and wc_InitMd4_ex() */ | |||
| @@ -37,29 +37,51 @@ | |||
| /* Unit test for wc_InitMd2() and wc_InitMd2_ex() */ | |||
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.
This breaks API compatibility for MD4 and MD2 switching the public API from returning void to returning int.