Skip to content

Fix PKCS11 object leak in Pkcs11ECDH#9780

Merged
SparkiDev merged 3 commits intowolfSSL:masterfrom
mattia-moffa:20260216-pkcs-ecdh-fixes
Feb 18, 2026
Merged

Fix PKCS11 object leak in Pkcs11ECDH#9780
SparkiDev merged 3 commits intowolfSSL:masterfrom
mattia-moffa:20260216-pkcs-ecdh-fixes

Conversation

@mattia-moffa
Copy link
Contributor

Description

Pkcs11ECDH leaked two PKCS11 objects per ECDH operation:

  • The derived secret via C_DeriveKey is never destroyed after its value is extracted via C_GetAttributeValue
  • Ephemeral private keys generated by Pkcs11EcKeyGen (e.g. for TLS ECDHE) is not cleaned up. Pkcs11EcKeyGen intentionally leaves the private key alive for the subsequent Pkcs11ECDH call, but Pkcs11ECDH only destroys private keys created from raw scalar data (if (sessionKey)), not keys found via Pkcs11FindEccKey.

Reported via ZD#20700

Testing

./configure --enable-pkcs11

@mattia-moffa mattia-moffa self-assigned this Feb 16, 2026
@dgarske dgarske self-requested a review February 16, 2026 18:18
@dgarske
Copy link
Contributor

dgarske commented Feb 16, 2026

Jenkins retest this please. FIPS v3 no history

dgarske
dgarske previously approved these changes Feb 16, 2026
@mattia-moffa mattia-moffa removed their assignment Feb 18, 2026
@SparkiDev SparkiDev merged commit 3a1aa83 into wolfSSL:master Feb 18, 2026
570 of 572 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

Comments