Fenrir fixes: buffer frees, struct resets, Gradle distribution SHA-256#210
Merged
rlm2002 merged 11 commits intowolfSSL:masterfrom Apr 6, 2026
Merged
Fenrir fixes: buffer frees, struct resets, Gradle distribution SHA-256#210rlm2002 merged 11 commits intowolfSSL:masterfrom
rlm2002 merged 11 commits intowolfSSL:masterfrom
Conversation
…ents throwing extraneous exception (F-1933)
…nts throwing extraneous exception (F-1934)
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Addresses Fenrir findings by adding explicit cleanup of sensitive JNI buffers/structs and improving Android Gradle Wrapper integrity verification.
Changes:
- Zeroize temporary buffers before freeing (RSA, DH, ChaCha, Curve25519, Ed25519, PEM/DER conversions).
- Add missing frees/reset behavior for cryptographic structs (e.g., GMAC AES context).
- Add
distributionSha256Sumto the Android Gradle wrapper configuration.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| jni/jni_wolfcrypt.c | Zeroizes DER buffer before free in PEM->DER conversion cleanup. |
| jni/jni_rsa.c | Zeroizes RSA temporary output buffer before free. |
| jni/jni_hmac.c | Attempts to wipe HMAC temp buffer after logging. |
| jni/jni_ed25519.c | Adds output buffer size tracking and wipes exported key buffer before free. |
| jni/jni_dh.c | Improves DH encode logging/return handling and wipes DER buffers on cleanup. |
| jni/jni_curve25519.c | Adds buffer size tracking and wipes shared secret buffer before free (but one cleanup call looks incorrect). |
| jni/jni_chacha.c | Wipes ChaCha output buffer before free. |
| jni/jni_aesgmac.c | Frees GMAC AES context before returning. |
| jni/jni_aescmac.c | Attempts to wipe CMAC temp buffer after use. |
| IDE/Android/gradle/wrapper/gradle-wrapper.properties | Adds SHA-256 checksum for Gradle distribution download verification. |
Comments suppressed due to low confidence (1)
jni/jni_ed25519.c:1
outpuBufSzappears to be a typo, andoutputBufSzis used/assigned without being declared in this function, which should cause a compile error. Rename the declared variable tooutputBufSz(or consistently useoutpuBufSz) and update all references so the buffer-size tracking variable is declared and used consistently.
/* jni_ed25519.c
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… and wc_RsaPrivateDecrypt_ex() before free (F-1948, F-1949)
…ate() and wc_ed25519_export_private_only() before free (F-1950, F-1951)
…rivate_raw() and wc_curve25519_shared_secret() before free (F-1952, F-1953)
…fore free (F-1954)
…nerate() (F-1958, F-1959)
rlm2002
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses 15 Fenrir reports for zeroing out buffers, resetting structs, and adding a SHA-256 hash to very the Gradle distribution in the Android Studio example project.