Skip to content

Wipe and free previous EVP_PKEY DER cache on reassignment (F-8331) - #11965

Open
kojo1 wants to merge 2 commits into
wolfSSL:masterfrom
kojo1:fix/f-8331
Open

kojo1 wants to merge 2 commits into
wolfSSL:masterfrom
kojo1:fix/f-8331

Conversation

@kojo1

@kojo1 kojo1 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Description

Wipe and free previous EVP_PKEY DER cache on reassignment.

Fixes F-8331

Testing

Added test_wolfSSL_EVP_PKEY_reassign_der_cache.

Checklist

  • [ x] added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI balanced review requested due to automatic review settings November 3, 2026 00:32

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.

🟡 Changes recommended

The reassignment test checks only replacement-cache sizes, so it can still pass when outgoing DSA/DH buffers are not wiped or freed, leaving the intended regression undetected.

1 open issue
What changed in this PR

This PR addresses F-8331 by clearing previous DER key caches during reassignment in wolfSSL’s OpenSSL compatibility layer.

Changes:

  • Wipe and free cached DER data and reset cache metadata before DSA, DH, and RSA reassignment.
  • Clear temporary DER buffers before release on affected paths.
  • Add and register a regression test covering repeated and cross-key-type reassignment.
File Description
wolfcrypt/​src/​evp.c Adds DER cache cleanup and temporary-buffer wiping.
tests/​api/​test_evp_pkey.h Declares and registers the reassignment test.
tests/​api/​test_evp_pkey.c Adds reassignment checks for DSA, RSA, and DH caches.

Review effort: Balanced

Comment thread tests/api/test_evp_pkey.c Resolved
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

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.

2 participants