1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-28 22:21:15 -07:00

Additional tests for BLAKE2b

This commit is contained in:
Frank Denis 2016-03-24 21:57:33 +01:00
parent 7a08f643bf
commit 71a548ac10
2 changed files with 31 additions and 0 deletions

View File

@ -1366,6 +1366,17 @@ main(void)
printf("%02x", (unsigned int) out[j]); printf("%02x", (unsigned int) out[j]);
} }
printf("\n"); 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_min() > 0U);
assert(crypto_generichash_bytes_max() > 0U); assert(crypto_generichash_bytes_max() > 0U);
assert(crypto_generichash_bytes() > 0U); assert(crypto_generichash_bytes() > 0U);

View File

@ -130,6 +130,19 @@ main(void)
} }
printf("\n"); 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, crypto_generichash_blake2b_init_salt_personal(&st, NULL, 0U, crypto_generichash_BYTES,
NULL, personal); NULL, personal);
crypto_generichash_blake2b_update(&st, in, MAXLEN); crypto_generichash_blake2b_update(&st, in, MAXLEN);
@ -148,6 +161,13 @@ main(void)
} }
printf("\n"); 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, assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES,
NULL, personal) == 0); NULL, personal) == 0);
assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES, assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES,