Skip to content

Fix fenrir security findings for wolfcrypt#9830

Merged
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
aidangarske:fix-wolfcrypt-fenrir
Feb 26, 2026
Merged

Fix fenrir security findings for wolfcrypt#9830
JacobBarthelmeh merged 1 commit intowolfSSL:masterfrom
aidangarske:fix-wolfcrypt-fenrir

Conversation

@aidangarske
Copy link
Copy Markdown
Member

@aidangarske aidangarske commented Feb 24, 2026

No description provided.

@aidangarske aidangarske self-assigned this Feb 24, 2026
Copilot AI review requested due to automatic review settings February 24, 2026 21:21
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 multiple Fenrir security findings in wolfCrypt by switching sensitive comparisons to constant-time operations and zeroizing secret material before freeing/returning.

Changes:

  • Replaced timing-sensitive XMEMCMP checks with ConstantCompare across several crypto paths.
  • Added ForceZero cleanups for sensitive buffers (HPKE, ML-KEM, PBKDF, ECIES, ChaCha20-Poly1305).
  • Fixed an allocation macro using an incorrect sizeof() type.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
wolfcrypt/src/wc_mlkem.c Zeroizes encaps/decaps key-derivation material before returning.
wolfcrypt/src/srp.c Uses constant-time proof comparison and clears proof digest after use.
wolfcrypt/src/sakke.c Uses constant-time authentication point comparison.
wolfcrypt/src/pwdbased.c Clears PBKDF intermediate digest/buffer before free/return.
wolfcrypt/src/pkcs12.c Uses constant-time MAC comparison and returns a defined error on mismatch.
wolfcrypt/src/hpke.c Zeroizes DH shared secret / KEM context / base context structures.
wolfcrypt/src/evp.c Uses constant-time HMAC verification comparison.
wolfcrypt/src/ecc.c Zeroizes ECIES shared secret/derived keys and uses constant-time HMAC tag compare.
wolfcrypt/src/chacha20_poly1305.c Zeroizes Poly1305 auth key, including early-return paths.
wolfcrypt/src/asn.c Fixes ALLOC_ASNSETDATA macro to allocate correct element size.
wolfcrypt/src/aes.c Uses constant-time compares for KeyWrap IV and AES-SIV tag verification.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfcrypt/src/hpke.c
Comment thread wolfcrypt/src/hpke.c
Comment thread wolfcrypt/src/hpke.c
Comment thread wolfcrypt/src/ecc.c
Comment thread wolfcrypt/src/pwdbased.c Outdated
Comment thread wolfcrypt/src/evp.c
Comment thread wolfcrypt/src/pkcs12.c Outdated
Copilot AI review requested due to automatic review settings February 24, 2026 22:18
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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 11 out of 11 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfcrypt/src/hpke.c
@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

Has performance before and after these additions been considered? I suspect it is not a large impact but would like to know if this causes performance decrease with the additional ForceZero's and buffer compare changes.

@aidangarske
Copy link
Copy Markdown
Member Author

Has performance before and after these additions been considered? I suspect it is not a large impact but would like to know if this causes performance decrease with the additional ForceZero's and buffer compare changes.

Honestly the performance impact is probably negligible the buffers are small 8-266 bytes. If you want I can run some comparison.

Copilot AI review requested due to automatic review settings February 25, 2026 01:56
@aidangarske aidangarske review requested due to automatic review settings February 25, 2026 01:56
Copilot AI review requested due to automatic review settings February 25, 2026 02:21
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 11 out of 11 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread wolfcrypt/src/srp.c
Comment thread wolfcrypt/src/sakke.c
Comment thread wolfcrypt/src/evp.c
Comment thread wolfcrypt/src/pkcs12.c Outdated
@aidangarske
Copy link
Copy Markdown
Member Author

Jenkins retest this please

@JacobBarthelmeh
Copy link
Copy Markdown
Contributor

Has performance before and after these additions been considered? I suspect it is not a large impact but would like to know if this causes performance decrease with the additional ForceZero's and buffer compare changes.

Honestly the performance impact is probably negligible the buffers are small 8-266 bytes. If you want I can run some comparison.

Yes please. Nothing crazy for benchmark comparison, but running the bundled benchmark application before and after and checking if there is a statistically significant impact on performance so that we are aware of it if there.

@aidangarske
Copy link
Copy Markdown
Member Author

Has performance before and after these additions been considered? I suspect it is not a large impact but would like to know if this causes performance decrease with the additional ForceZero's and buffer compare changes.

Honestly the performance impact is probably negligible the buffers are small 8-266 bytes. If you want I can run some comparison.

Yes please. Nothing crazy for benchmark comparison, but running the bundled benchmark application before and after and checking if there is a statistically significant impact on performance so that we are aware of it if there.

comparing master and this PR I cannot see any measurable differences running out of 3 runs only thing to note was I was experiencing thermal throttling differences on my PI device but swapping order reveals same pattern of one faster than the other after concurrent runs

@aidangarske aidangarske removed their assignment Feb 26, 2026
@JacobBarthelmeh JacobBarthelmeh merged commit 921ecf0 into wolfSSL:master Feb 26, 2026
445 of 449 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