Test: Add erpc test case
Add psa_hash_compute test case.
Signed-off-by: Summer Qin <summer.qin@arm.com>
Change-Id: I210a4799846b7a825ee994ae6e1ecce4baa04c30
diff --git a/erpc/host_example/main.c b/erpc/host_example/main.c
index b46ab27..ddf2665 100644
--- a/erpc/host_example/main.c
+++ b/erpc/host_example/main.c
@@ -5,10 +5,33 @@
*
*/
+#include <stdint.h>
#include <stdio.h>
+#include <string.h>
#include "erpc_port.h"
#include "erpc_client_start.h"
#include "tfm_erpc_psa_client_api.h"
+#include "tfm_crypto_defs.h"
+#include "psa/client.h"
+#include "psa/crypto.h"
+
+static void test_call(void)
+{
+ psa_status_t status;
+ uint8_t hash[PSA_HASH_LENGTH(PSA_ALG_SHA_256)] = {0};
+ size_t hash_size = sizeof(hash);
+ const uint8_t *msg = "test";
+
+ status = psa_hash_compute(PSA_ALG_SHA_256, msg, strlen(msg), hash, hash_size, &hash_size);
+
+ printf("psa_hash_compute: %d\r\n", status);
+ printf("> hash_size = %zu\r\n", hash_size);
+ printf("> hash = ");
+ for (size_t i = 0; i < sizeof(hash); ++i) {
+ printf("%02hhX", hash[i]);
+ }
+ printf("\r\n");
+}
int main(int argc, char *argv[])
{
@@ -31,5 +54,7 @@
printf("psa_framework_version: %d\r\n", psa_framework_version());
+ test_call();
+
return 0;
}