Skip to content

Fix EVP Cipher AES-CFB1 byte length - #12275

Merged
SparkiDev merged 2 commits into
wolfSSL:masterfrom
ageprocpp:fix/fenrir-19105
Nov 26, 2026
Merged

SparkiDev merged 2 commits into
wolfSSL:masterfrom
ageprocpp:fix/fenrir-19105

Conversation

@ageprocpp

@ageprocpp ageprocpp commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fixes Fenrir#19105 and zd#22879

Convert the byte length passed to the AES-CFB1 arm of wolfSSL_EVP_Cipher() to the bit length expected by wc_AesCfb1Encrypt() and wc_AesCfb1Decrypt(). Reject lengths above the safe word32 multiplication limit before processing.

Add known-answer coverage for one-shot AES-CFB1 encryption and decryption with separate and in-place buffers, plus the oversized-input boundary.

Testing

Configured a CMake build with WOLFSSL_OPENSSLEXTRA=yes and WOLFSSL_AESCFB=yes, then ran:

cmake --build /private/tmp/wolf19105-build --target wolfcrypttest -j 6
/private/tmp/wolf19105-build/wolfcrypt/test/testwolfcrypt

All wolfCrypt tests passed.

Checklist

  • added tests
  • updated/added doxygen (not applicable)
  • updated appropriate READMEs (not applicable)
  • Updated manual and documentation (not applicable)

Copilot AI balanced review requested due to automatic review settings November 25, 2026 23:43
@ageprocpp ageprocpp self-assigned this Nov 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues are reported for the AES-CFB1 length-handling fix.

No open issues 🎉

What changed in this PR

Fixes AES-CFB1 length handling in wolfSSL_EVP_Cipher() by converting byte counts to the bit counts required by wolfCrypt.

Changes:

  • Converts input lengths to bits for AES-CFB1 encryption and decryption, rejecting lengths that would overflow.
  • Adds known-answer tests for separate and in-place buffers, plus an oversized-input rejection test.
File Description
wolfcrypt/​test/​test.c Adds one-shot AES-CFB1 regression and oversized-input tests.
wolfcrypt/​src/​evp.c Corrects AES-CFB1 length conversion and guards against overflow.

Review effort: Balanced

@ageprocpp
ageprocpp marked this pull request as ready for review November 25, 2026 23:45
@github-actions

Copy link
Copy Markdown

retest this please

@ageprocpp
ageprocpp marked this pull request as draft November 25, 2026 23:48
@ageprocpp
ageprocpp marked this pull request as ready for review November 25, 2026 23:48
@github-actions

Copy link
Copy Markdown

retest this please

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

MemBrowse Memory Report · Explore what changed →

gcc-arm-cortex-m4-openssl-compat

  • FLASH: .text +64 B (+0.0%, 804,232 B / 1,048,576 B, total: 77% used)

zephyr-frdm_rw612

  • FLASH: datas +16 B, log_const_area -8 B, rodata +108 B, text +13,832 B (+4.9%, 296,412 B / 67,108,864 B, total: 0% used)
  • RAM: bss +49 B, datas +16 B (+0.1%, 58,423 B / 983,040 B, total: 6% used)

No memory changes detected for:


Catch memory regressions in CI with MemBrowse. Free for open source.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #12275

Scan targets checked: wolfcrypt-src, wolfcrypt-bugs
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

@ageprocpp ageprocpp assigned wolfSSL-Bot and unassigned ageprocpp Nov 26, 2026
@SparkiDev
SparkiDev merged commit 198b4f9 into wolfSSL:master Nov 26, 2026
470 of 473 checks passed
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.

5 participants