]> git.ipfire.org Git - thirdparty/openssl.git/commit
aes_wrap: prevent crash on update without a key master
author007bsd <22483432+007bsd@users.noreply.github.com>
Mon, 25 May 2026 21:10:43 +0000 (00:10 +0300)
committerNorbert Pocs <norbertp@openssl.org>
Wed, 3 Jun 2026 11:51:57 +0000 (13:51 +0200)
commitd099e33e5733bb9d3975fc4f3ac4a85b6ed1a4cb
tree182f420178ea6cfbb01b34b8877a6a22578f4c2a
parent14d4dedc2a98a393b1f3995f2be025f21984774c
aes_wrap: prevent crash on update without a key

EVP_CipherInit_ex2 with a NULL key followed by EVP_CipherUpdate
on AES-WRAP/WRAP-PAD/WRAP-INV ciphers dereferenced an uninitialised
function pointer because aes_wrap_init installs ctx->block only
when a key is supplied. aes_wrap_cipher_internal had no guard
before dispatching.

Track key state in ctx->key_set, matching OCB/CCM/GCM/Poly1305,
and refuse update if no key has been installed.

Added a regression test covering AES-256-WRAP, AES-256-WRAP-PAD
and AES-256-WRAP-INV.

CLA: trivial

Fixes: ca392b294359 "Add aes_wrap cipher to providers"
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Jun  3 11:52:05 2026
(Merged from https://github.com/openssl/openssl/pull/31292)
providers/implementations/ciphers/cipher_aes_wrp.c
test/aeswrap_test.c