Add tests for invalid generichash parameters
This commit is contained in:
parent
0ec5a25c88
commit
dc49ae0491
@ -22,6 +22,12 @@ int main(void)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
assert(crypto_generichash(out, 0U, in, sizeof in, k, sizeof k) == -1);
|
||||
assert(crypto_generichash(out, crypto_generichash_BYTES_MAX + 1U, in, sizeof in,
|
||||
k, sizeof k) == -1);
|
||||
assert(crypto_generichash(out, sizeof out, in, sizeof in,
|
||||
k, crypto_generichash_KEYBYTES_MAX + 1U) == -1);
|
||||
|
||||
assert(crypto_generichash_bytes_min() > 0U);
|
||||
assert(crypto_generichash_bytes_max() > 0U);
|
||||
assert(crypto_generichash_bytes() > 0U);
|
||||
|
@ -27,5 +27,11 @@ int main(void)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
assert(crypto_generichash_init(&st, k, sizeof k, 0U) == -1);
|
||||
assert(crypto_generichash_init(&st, k, sizeof k,
|
||||
crypto_generichash_BYTES_MAX + 1U) == -1);
|
||||
assert(crypto_generichash_init(&st, k, crypto_generichash_KEYBYTES_MAX + 1U,
|
||||
sizeof out) == -1);
|
||||
return 0;
|
||||
}
|
||||
|
@ -32,5 +32,13 @@ int main(void)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, 0U,
|
||||
salt, personal) == -1);
|
||||
assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k,
|
||||
crypto_generichash_BYTES_MAX + 1U,
|
||||
salt, personal) == -1);
|
||||
assert(crypto_generichash_blake2b_init_salt_personal(&st, k,
|
||||
crypto_generichash_KEYBYTES_MAX + 1U,
|
||||
sizeof out, salt, personal) == -1);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user