Skip to content

Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460

Open
JacobBarthelmeh wants to merge 10 commits into
wolfSSL:masterfrom
JacobBarthelmeh:static_analysis
Open

Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2#10460
JacobBarthelmeh wants to merge 10 commits into
wolfSSL:masterfrom
JacobBarthelmeh:static_analysis

Conversation

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

This breaks API compatibility for MD4 and MD2 switching the public API from returning void to returning int.

@JacobBarthelmeh JacobBarthelmeh self-assigned this May 11, 2026
Copilot AI review requested due to automatic review settings May 11, 2026 23:06
@JacobBarthelmeh JacobBarthelmeh changed the title Static analysis fixes/improvements for SECO, decrypto, ARIA, MD4, MD2 Static analysis fixes/improvements for SECO, devcrypto, ARIA, MD4, MD2 May 11, 2026
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #10460

Scan targets checked: wolfcrypt-bugs, wolfcrypt-port-bugs, wolfcrypt-src

No new issues found in the changed files. ✅

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) from void to int and 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.

Comment thread wolfcrypt/src/port/devcrypto/devcrypto_aes.c Outdated
Comment thread doc/dox_comments/header_files/md4.h
Comment thread doc/dox_comments/header_files/md2.h
Comment thread doc/dox_comments/header_files-ja/md4.h
Comment thread doc/dox_comments/header_files-ja/md2.h
@github-actions
Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Comment thread wolfcrypt/src/port/aria/aria-cryptocb.c
Comment thread wolfcrypt/src/port/aria/aria-cryptocb.c
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Comment thread tests/api/test_md4.c
@@ -37,29 +37,51 @@
/* Unit test for wc_InitMd4() and wc_InitMd4_ex() */
Comment thread tests/api/test_md2.c
@@ -37,29 +37,51 @@
/* Unit test for wc_InitMd2() and wc_InitMd2_ex() */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants