Test that SipHash_Final() fails on uninited context

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18142)
This commit is contained in:
Tomas Mraz 2022-04-21 17:13:44 +02:00
parent 905fec4f4d
commit 4b694f29ea

View File

@ -262,8 +262,10 @@ static int test_siphash_basic(void)
/* Use invalid hash size */
return TEST_int_eq(SipHash_set_hash_size(&siphash, 4), 0)
&& TEST_false(SipHash_Final(&siphash, output, 0))
/* Use hash size = 8 */
&& TEST_true(SipHash_set_hash_size(&siphash, 8))
&& TEST_false(SipHash_Final(&siphash, output, 8))
&& TEST_true(SipHash_Init(&siphash, key, 0, 0))
&& TEST_true(SipHash_Final(&siphash, output, 8))
&& TEST_int_eq(SipHash_Final(&siphash, output, 16), 0)