diff --git a/programs/psa/psa_hash.c b/programs/psa/psa_hash.c index ae4e9a5d2b..f73e1f3ab7 100644 --- a/programs/psa/psa_hash.c +++ b/programs/psa/psa_hash.c @@ -148,7 +148,7 @@ int main(void) 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"); psa_hash_abort(&hash_operation);