Crypto: Add support for Hash functionalities

This patch introduces support for the Hash functionalities
exposed by the PSA Crypto API, and adds a set of tests to
the Regression test suite to validate the API functions.

Change-Id: I4169b7a1a7a04140d557edef4e9d86a9c6ae0f50
Signed-off-by: Antonio de Angelis <antonio.deangelis@arm.com>
diff --git a/interface/src/tfm_crypto_api.c b/interface/src/tfm_crypto_api.c
index d98f85f..dbeb6a8 100644
--- a/interface/src/tfm_crypto_api.c
+++ b/interface/src/tfm_crypto_api.c
@@ -188,3 +188,76 @@
 
     return TFM_CRYPTO_PSA_RETURN(err);
 }
+
+psa_status_t psa_hash_start(psa_hash_operation_t *operation,
+                            psa_algorithm_t alg)
+{
+    enum tfm_crypto_err_t err;
+
+    err = tfm_ns_lock_dispatch((veneer_fn)tfm_crypto_veneer_hash_start,
+                               (uint32_t)operation,
+                               (uint32_t)alg,
+                               0,
+                               0);
+
+    return TFM_CRYPTO_PSA_RETURN(err);
+}
+
+psa_status_t psa_hash_update(psa_hash_operation_t *operation,
+                             const uint8_t *input,
+                             size_t input_length)
+{
+    enum tfm_crypto_err_t err;
+
+    err = tfm_ns_lock_dispatch((veneer_fn)tfm_crypto_veneer_hash_update,
+                               (uint32_t)operation,
+                               (uint32_t)input,
+                               (uint32_t)input_length,
+                               0);
+
+    return TFM_CRYPTO_PSA_RETURN(err);
+}
+
+psa_status_t psa_hash_finish(psa_hash_operation_t *operation,
+                             uint8_t *hash,
+                             size_t hash_size,
+                             size_t *hash_length)
+{
+    enum tfm_crypto_err_t err;
+
+    err = tfm_ns_lock_dispatch((veneer_fn)tfm_crypto_veneer_hash_finish,
+                               (uint32_t)operation,
+                               (uint32_t)hash,
+                               (uint32_t)hash_size,
+                               (uint32_t)hash_length);
+
+    return TFM_CRYPTO_PSA_RETURN(err);
+}
+
+psa_status_t psa_hash_verify(psa_hash_operation_t *operation,
+                             const uint8_t *hash,
+                             size_t hash_length)
+{
+    enum tfm_crypto_err_t err;
+
+    err = tfm_ns_lock_dispatch((veneer_fn)tfm_crypto_veneer_hash_verify,
+                               (uint32_t)operation,
+                               (uint32_t)hash,
+                               (uint32_t)hash_length,
+                               0);
+
+    return TFM_CRYPTO_PSA_RETURN(err);
+}
+
+psa_status_t psa_hash_abort(psa_hash_operation_t *operation)
+{
+    enum tfm_crypto_err_t err;
+
+    err = tfm_ns_lock_dispatch((veneer_fn)tfm_crypto_veneer_hash_abort,
+                               (uint32_t)operation,
+                               0,
+                               0,
+                               0);
+
+    return TFM_CRYPTO_PSA_RETURN(err);
+}