Test that SipHash_Final() fails on uninited context
authorTomas Mraz <tomas@openssl.org>
Thu, 21 Apr 2022 15:13:44 +0000 (17:13 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 27 Apr 2022 08:05:03 +0000 (10:05 +0200)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18142)

test/siphash_internal_test.c

index 03824ea8ec4820b45d1a9a419cfbabb9a739a9e3..7626bab98c29b3a0c988f07d43d01bdeca1f49de 100644 (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)