Repository navigation
Conversation
aes_check_mech_param() accepts a null parameter pointer. Without a context template, aes_common_init_ctx() then allocates a key schedule before rejecting the missing CCM or GCM parameters. That early return bypasses key-schedule cleanup, leaking the allocation on both encrypt and decrypt calls. Reject a missing parameter at the existing mechanism validation boundary, before context initialization allocates the key schedule. Exercise null parameters with zero and expected parameter lengths in the crypto test driver. Signed-off-by: Kamil Monicz <kamil@monicz.dev>
Zaczero
force-pushed
the
fix/aes-null-parameters
branch
from
October 15, 2026 12:22
53c3314 to
5f974a2
Compare
Zaczero
marked this pull request as ready for review
October 15, 2026 12:51
Contributor
|
I'll review in couple of days. |
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.
Motivation and Context
AES mechanism validation accepts a null parameter pointer. Without a context template, context initialization then allocates a key schedule before rejecting the missing CCM or GCM parameters. That early return bypasses cleanup, leaking the schedule on both encrypt and decrypt calls.
Description
Reject missing parameters at the existing validation boundary, before allocating the key schedule. The crypto test driver checks rejection and preservation of output bytes, length and offset with both zero and expected parameter lengths.
How Has This Been Tested?
A Linux x86-64 native allocation observer measured a 512-byte leak per rejected call before the change and no allocation afterward, across all eight combinations of CCM/GCM, encrypt/decrypt and zero/expected parameter lengths.
These valid-key calls retain
CRYPTO_MECHANISM_PARAM_INVALIDand leave output unchanged. Debug and release builds passed the null-parameter cases and existing GCM/CCM known-answer suites. Both corresponding functional ZTS scripts passed.Types of Changes
Checklist
Signed-off-by.