From b9e1f06ba19b1c05557fd082ea8fa2f8f1b0c0a2 Mon Sep 17 00:00:00 2001
From: Antonio de Angelis <Antonio.deAngelis@arm.com>
Date: Thu, 21 Mar 2024 13:02:44 +0000
Subject: [PATCH 6/6] Enable psa_can_do_hash

CC312 driver want to use hash in md for entropy operations.
Enable psa_can_do_hash by directly returning 1.
This is a workaround for current cc312 driver. After switching
to new driver, this workaround is not needed.

Signed-off-by: Summer Qin <summer.qin@arm.com>
---
 library/psa_crypto.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index d3f729320..68895738e 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -288,7 +288,8 @@ static uint8_t psa_get_drivers_initialized(void)
 int psa_can_do_hash(psa_algorithm_t hash_alg)
 {
     (void) hash_alg;
-    return psa_get_drivers_initialized();
+    /* Workaround for the legacy CryptoCell driver requiring hash during init */
+    return 1; //psa_get_drivers_initialized();
 }
 
 int psa_can_do_cipher(psa_key_type_t key_type, psa_algorithm_t cipher_alg)
-- 
2.34.1

