Skip to content

fix: zero-initialize s2n_tls13_keys in PSK binder functions - #6048

Open
jouho wants to merge 1 commit into
aws:mainfrom
jouho:fix/psk-keys-uninit-defer-cleanup
Open

fix: zero-initialize s2n_tls13_keys in PSK binder functions#6048
jouho wants to merge 1 commit into
aws:mainfrom
jouho:fix/psk-keys-uninit-defer-cleanup

Conversation

@jouho

@jouho jouho commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Goal

Zero-initialize the s2n_tls13_keys stack variables in s2n_psk_calculate_binder and s2n_psk_verify_binder.

Why

Without = { 0 }, a partial-init failure in s2n_tls13_keys_init (e.g. an allocation failure in s2n_hmac_new) leaves the deferred s2n_tls13_keys_free operating on a partially-initialized struct, dereferencing an uninitialized hash_impl pointer.

How

Added = { 0 } to both DEFER_CLEANUP declarations so cleanup on the error path is safe-by-construction.

Callouts

Matches the existing s2n_tls13_connection_keys safety pattern.

Testing

Existing tests pass

Related

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions Bot added the s2n-core team label Aug 18, 2026
@jouho
jouho marked this pull request as ready for review August 18, 2026 23:01
@jouho
jouho requested review from jmayclin and maddeleine August 18, 2026 23:03
@jouho
jouho enabled auto-merge August 19, 2026 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants