Inform user when unknown hash algorithm supplied

Excplictly inform the user that their hash algorithm
selection is invalid.

Signed-off-by: Thomas Daubney <thomas.daubney@arm.com>
This commit is contained in:
Thomas Daubney 2023-10-10 17:38:53 +01:00
parent 86f9795b00
commit 760538885a

View file

@ -84,7 +84,11 @@ int main(void)
/* Compute hash using multi-part operation */ /* Compute hash using multi-part operation */
status = psa_hash_setup(&hash_operation, HASH_ALG); 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"); mbedtls_printf("psa_hash_setup failed\n");
return EXIT_FAILURE; return EXIT_FAILURE;
} }