From 71a548ac10e1b06b45cb6893d4d87257a78768b7 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 24 Mar 2016 21:57:33 +0100 Subject: [PATCH] Additional tests for BLAKE2b --- test/default/generichash.c | 11 +++++++++++ test/default/generichash3.c | 20 ++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/test/default/generichash.c b/test/default/generichash.c index 056559ca..4e52ee5e 100644 --- a/test/default/generichash.c +++ b/test/default/generichash.c @@ -1366,6 +1366,17 @@ main(void) printf("%02x", (unsigned int) out[j]); } printf("\n"); + + assert(crypto_generichash(NULL, 0, + in, (unsigned long long) sizeof in, + k, sizeof k) == -1); + assert(crypto_generichash(NULL, crypto_generichash_BYTES_MAX + 1, + in, (unsigned long long) sizeof in, + k, sizeof k) == -1); + assert(crypto_generichash(NULL, (unsigned long long) sizeof in, + in, (unsigned long long) sizeof in, + k, crypto_generichash_KEYBYTES_MAX + 1) == -1); + assert(crypto_generichash_bytes_min() > 0U); assert(crypto_generichash_bytes_max() > 0U); assert(crypto_generichash_bytes() > 0U); diff --git a/test/default/generichash3.c b/test/default/generichash3.c index fa0045e2..d9646343 100644 --- a/test/default/generichash3.c +++ b/test/default/generichash3.c @@ -130,6 +130,19 @@ main(void) } printf("\n"); + assert(crypto_generichash_blake2b_salt_personal + (NULL, 0, + in, (unsigned long long) sizeof in, + k, sizeof k, NULL, NULL) == -1); + assert(crypto_generichash_blake2b_salt_personal + (NULL, crypto_generichash_BYTES_MAX + 1, + in, (unsigned long long) sizeof in, + k, sizeof k, NULL, NULL) == -1); + assert(crypto_generichash_blake2b_salt_personal + (NULL, (unsigned long long) sizeof in, + in, (unsigned long long) sizeof in, + k, crypto_generichash_KEYBYTES_MAX + 1, NULL, NULL) == -1); + crypto_generichash_blake2b_init_salt_personal(&st, NULL, 0U, crypto_generichash_BYTES, NULL, personal); crypto_generichash_blake2b_update(&st, in, MAXLEN); @@ -148,6 +161,13 @@ main(void) } printf("\n"); + assert(crypto_generichash_blake2b_init_salt_personal + (&st, k, sizeof k, 0, NULL, NULL) == -1); + assert(crypto_generichash_blake2b_init_salt_personal + (&st, k, sizeof k, crypto_generichash_blake2b_BYTES_MAX + 1, NULL, NULL) == -1); + assert(crypto_generichash_blake2b_init_salt_personal + (&st, k, crypto_generichash_blake2b_KEYBYTES_MAX + 1, sizeof out, NULL, NULL) == -1); + assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES, NULL, personal) == 0); assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES,