CVSROOT:        /cvs
Module name:    src
Changes by:     [email protected]    2026/08/27 01:13:34

Modified files:
        lib/libcrypto/cms: cms_kari.c 

Log message:
libcrypto: harden cms_kek_cipher() a bit

When AES key unwrap with padding is in use, the EVP interface breaks its
contract and writes more than the outlen it initially reports to the output
buffer. This is an old, sneaky trap that the muppet set eons ago and many
victims walked right into it, including the muppet himself.

If inlen is larger than outlen, allocate inlen bytes to unwrap with padding
to avoid a buffer overwrite. This is a variant of OpenSSL's fix. Since we
do not support AES keywrap with padding no actual bufer overwrite occurs
here at the moment, but if we ever chose to do so (unlikely) this trap
would be avoided. There's plenty more traps that the next round of scas
will surely find in this absolute trashfire of CMS support code.

ok kenjiro

Reply via email to