Add extra check to one-shot operation results

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2023-07-28 16:17:38 +01:00
parent ce14124f7c
commit fbe742b2d0

View file

@ -148,7 +148,7 @@ int main(void)
return EXIT_FAILURE; return EXIT_FAILURE;
} }
if (memcmp(hash, sample_hash, sample_hash_len) != 0) if (memcmp(hash, sample_hash, sample_hash_len) != 0 || hash_length != sample_hash_len)
{ {
mbedtls_printf("One-shot hash operation gave the wrong result!\n\n"); mbedtls_printf("One-shot hash operation gave the wrong result!\n\n");
psa_hash_abort(&hash_operation); psa_hash_abort(&hash_operation);