From fbe742b2d0ffe63ea3443b198e96b685bf388ba5 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Fri, 28 Jul 2023 16:17:38 +0100 Subject: [PATCH] Add extra check to one-shot operation results Signed-off-by: Thomas Daubney --- programs/psa/psa_hash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/psa/psa_hash.c b/programs/psa/psa_hash.c index ae4e9a5d2..f73e1f3ab 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);