Add extra check to one-shot operation results

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
diff --git a/programs/psa/psa_hash.c b/programs/psa/psa_hash.c
index ae4e9a5..f73e1f3 100644
--- a/programs/psa/psa_hash.c
+++ b/programs/psa/psa_hash.c
@@ -148,7 +148,7 @@
         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);