Zeroize sensitive stack buffers in DRBG, X25519, Ed25519, ECDSA, ECDH…#3121
Open
Zeroize sensitive stack buffers in DRBG, X25519, Ed25519, ECDSA, ECDH…#3121
Conversation
2337060 to
343d2e7
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3121 +/- ##
==========================================
- Coverage 78.22% 78.22% -0.01%
==========================================
Files 689 689
Lines 122294 122332 +38
Branches 17062 17074 +12
==========================================
+ Hits 95668 95697 +29
- Misses 25722 25730 +8
- Partials 904 905 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
justsmth
added a commit
to awslabs/aws-lc-verification
that referenced
this pull request
Mar 25, 2026
nebeid
approved these changes
Mar 25, 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.
Issues
Addresses: AWS-LC-1073
Related
Description of changes:
Several functions were leaving sensitive intermediate values on the stack after returning. This change adds
OPENSSL_cleansecalls to zeroize those buffers before they go out of scope:ctrdrbg.c): Zeroizeseed_material,temp,entropy_copy, and partial keystreamblock.ecdh.c): Zeroize the raw shared secretbufinECDH_compute_key_fips.ecdsa.c): Zeroizetmpafter it holds k⁻¹ inecdsa_sign_impl.curve25519_nohw.c): Zeroize clamped private scalars, Montgomery ladder intermediates, and nonce-derived values.curve25519_s2n_bignum_asm.c): Same treatment for the s2n-bignum code paths.gcm.c): Zeroize the GHASH hash keyH(derived fromAES_K(0^128)) andghash_key. The earlyreturnstatements inCRYPTO_ghash_initare refactored togoto outso all paths go through a single cleanup site.Call-outs:
The GCM change is the only one with a structural refactor — the
return→goto outconversion inCRYPTO_ghash_init. All other changes are purely additiveOPENSSL_cleansecalls at function exit points.Testing:
Existing tests cover the functional behavior of all affected code paths. These changes should be transparent since they only zero memory that is no longer used.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.