Enforce a strict output length check in CRYPTO_ccm128_tag
authorGuido Vranken <guidovranken@gmail.com>
Mon, 22 Apr 2019 12:11:12 +0000 (14:11 +0200)
committerMatt Caswell <matt@openssl.org>
Thu, 25 Apr 2019 10:00:39 +0000 (11:00 +0100)
commitfc4c034ee823c18de34d72dc46da6aabbb6f551e
treebf636ae719b812c2822b5fe181ad095bd790752c
parent282360e6be8f0089470b38c07458c23564f5447f
Enforce a strict output length check in CRYPTO_ccm128_tag

Return error if the output tag buffer size doesn't match
the tag size exactly. This prevents the caller from
using that portion of the tag buffer that remains
uninitialized after an otherwise succesfull call to
CRYPTO_ccm128_tag.

Bug found by OSS-Fuzz.

Fix suggested by Kurt Roeckx.

Signed-off-by: Guido Vranken <guidovranken@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8810)

(cherry picked from commit 514c9da48b860153079748b0d588cd42191f0b6a)
crypto/modes/ccm128.c