summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2022-04-21 17:13:44 +0200
committerTomas Mraz <tomas@openssl.org>2022-04-27 10:05:03 +0200
commit4b694f29ea78ab8a94e67c89d4d81df18c5e3bf1 (patch)
treec196bed6964e8558a0963bd8d4f0b5185af2bd6e
parentsiphash: Properly set mac size in sipcopy (diff)
downloadopenssl-4b694f29ea78ab8a94e67c89d4d81df18c5e3bf1.tar.xz
openssl-4b694f29ea78ab8a94e67c89d4d81df18c5e3bf1.zip
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)
-rw-r--r--test/siphash_internal_test.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/siphash_internal_test.c b/test/siphash_internal_test.c
index 03824ea8ec..7626bab98c 100644
--- a/test/siphash_internal_test.c
+++ b/test/siphash_internal_test.c
@@ -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)