Add tests for invalid paramters
Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
parent
c3048b3eea
commit
2468ad10d7
2 changed files with 24 additions and 0 deletions
|
@ -2410,3 +2410,7 @@ sha3_reuse:"41":"15000d20f59aa483b5eac0a1f33abe8e09dea1054d173d3e7443c68035b9924
|
||||||
SHA-3 Selftest
|
SHA-3 Selftest
|
||||||
depends_on:MBEDTLS_SELF_TEST:MBEDTLS_SHA3_C
|
depends_on:MBEDTLS_SELF_TEST:MBEDTLS_SHA3_C
|
||||||
sha3_selftest:
|
sha3_selftest:
|
||||||
|
|
||||||
|
SHA-3 invalid param
|
||||||
|
depends_on:MBEDTLS_SHA3_C
|
||||||
|
sha3_invalid_param
|
||||||
|
|
|
@ -166,6 +166,26 @@ exit:
|
||||||
}
|
}
|
||||||
/* END_CASE */
|
/* END_CASE */
|
||||||
|
|
||||||
|
/* BEGIN_CASE */
|
||||||
|
void sha3_invalid_param()
|
||||||
|
{
|
||||||
|
unsigned char output[32];
|
||||||
|
mbedtls_sha3_context ctx;
|
||||||
|
|
||||||
|
mbedtls_sha3_init(&ctx);
|
||||||
|
TEST_EQUAL(mbedtls_sha3_starts(&ctx, MBEDTLS_SHA3_NONE), MBEDTLS_ERR_SHA3_BAD_INPUT_DATA);
|
||||||
|
|
||||||
|
TEST_EQUAL(mbedtls_sha3_starts(&ctx, MBEDTLS_SHA3_256), 0);
|
||||||
|
|
||||||
|
TEST_EQUAL(mbedtls_sha3_finish(&ctx, output, 0), MBEDTLS_ERR_SHA3_BAD_INPUT_DATA);
|
||||||
|
TEST_EQUAL(mbedtls_sha3_finish(&ctx, output, 31), MBEDTLS_ERR_SHA3_BAD_INPUT_DATA);
|
||||||
|
TEST_EQUAL(mbedtls_sha3_finish(&ctx, output, 32), 0);
|
||||||
|
|
||||||
|
exit:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* END_CASE */
|
||||||
|
|
||||||
/* BEGIN_CASE depends_on:MBEDTLS_SHA3_C */
|
/* BEGIN_CASE depends_on:MBEDTLS_SHA3_C */
|
||||||
void mbedtls_sha3_multi(int family, data_t *in, data_t *hash)
|
void mbedtls_sha3_multi(int family, data_t *in, data_t *hash)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue