[openssl/openssl] 0c0c96: EVP_CTRL_AEAD_SET_IV_FIXED: reject arg values belo...
"'fedman0' via openssl-commits" <[email protected]>
| Newsgroups | gmane.comp.encryption.openssl.cvs |
|---|---|
| Message-ID | <openssl/openssl/push/refs/heads/master/[email protected]> |
Branch: refs/heads/master
Home: https://github.com/openssl/openssl
Commit: 0c0c96c2a37f57c92129a8aa7fc46b7a4703983a
https://github.com/openssl/openssl/commit/0c0c96c2a37f57c92129a8aa7fc46b7a4703983a
Author: Mohammad Hossein Abedini <[email protected]>
Date: 2026-08-18 (Tue, 18 Aug 2026)
Changed paths:
M crypto/evp/evp_enc.c
M providers/implementations/ciphers/ciphercommon_gcm.c
Log Message:
-----------
EVP_CTRL_AEAD_SET_IV_FIXED: reject arg values below -1
EVP_CIPHER_CTX_ctrl() casts the signed int arg to size_t before
dispatching. For EVP_CTRL_AEAD_SET_IV_FIXED the value -1 is an
intentional sentinel ("copy full IV"), so it must be preserved, but
any value below -1 wraps to a near-SIZE_MAX size_t. The two guards
inside gcm_tls_iv_set_fixed() both fail to catch this:
* the sentinel check tests for SIZE_MAX (i.e. (size_t)-1), not
SIZE_MAX-1 or lower;
* the bounds check back-casts len to int, undoing the wrap and
making the comparison evaluate to false.
The result is memcpy(ctx->iv, iv, SIZE_MAX-1) — a heap overflow.
Fix the root cause in EVP_CIPHER_CTX_ctrl() by rejecting any arg
below -1 for EVP_CTRL_AEAD_SET_IV_FIXED, consistent with the guards
already present for EVP_CTRL_SET_KEY_LENGTH, EVP_CTRL_AEAD_SET_IVLEN,
EVP_CTRL_GCM_SET_IV_INV and others.
As a defense-in-depth measure, also replace the (int) back-cast in
gcm_tls_iv_set_fixed() with a safe size_t upper-bound check so that
the provider itself rejects any out-of-range length independently of
the caller.
Co-authored-by: Tomáš Mráz <[email protected]> (comment fix)
Reviewed-by: Jakub Zelenka <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
Reviewed-by: Richard Levitte <[email protected]>
Merge-date: Tue Aug 18 07:41:57 2026
Merged-from: https://github.com/openssl/openssl/pull/31879
To unsubscribe from these emails, change your notification settings at https://github.com/openssl/openssl/settings/notifications
--
You received this message because you are subscribed to the Google Groups "openssl-commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/a/openssl.org/d/msgid/openssl-commits/openssl/openssl/push/refs/heads/master/93a175-0c0c96%40github.com.