From 760538885a0c6d07f67c98b11e8a15b8d5f8bfc5 Mon Sep 17 00:00:00 2001 From: Thomas Daubney Date: Tue, 10 Oct 2023 17:38:53 +0100 Subject: [PATCH] Inform user when unknown hash algorithm supplied Excplictly inform the user that their hash algorithm selection is invalid. Signed-off-by: Thomas Daubney --- programs/psa/psa_hash.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/psa/psa_hash.c b/programs/psa/psa_hash.c index b3f3597f0..fc39849cc 100644 --- a/programs/psa/psa_hash.c +++ b/programs/psa/psa_hash.c @@ -84,7 +84,11 @@ int main(void) /* Compute hash using multi-part operation */ status = psa_hash_setup(&hash_operation, HASH_ALG); - if (status != PSA_SUCCESS) { + if (status == PSA_ERROR_NOT_SUPPORTED){ + mbedtls_printf("unknown hash algorithm supplied\n"); + return EXIT_FAILURE; + } + else if (status != PSA_SUCCESS) { mbedtls_printf("psa_hash_setup failed\n"); return EXIT_FAILURE; }