feat(psa): add interface with RSE for retrieving entropy
Add the AP/RSS interface for reading the entropy. And update the
document for the API.
Change-Id: I61492d6b5d824a01ffeadc92f9d41ca841ba3367
Signed-off-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Icen Zeyada <Icen.Zeyada2@arm.com>
diff --git a/lib/psa/rse_platform.c b/lib/psa/rse_platform.c
index 9ede8b4..ffa2f48 100644
--- a/lib/psa/rse_platform.c
+++ b/lib/psa/rse_platform.c
@@ -70,4 +70,27 @@
return status;
}
+
+psa_status_t
+rse_platform_get_entropy(uint8_t *data, size_t data_size)
+{
+ psa_status_t status;
+
+ struct rse_crypto_pack_iovec iov = {
+ .function_id = RSE_CRYPTO_GENERATE_RANDOM_SID,
+ };
+
+ psa_invec in_vec[] = {
+ {.base = &iov, .len = sizeof(struct rse_crypto_pack_iovec)},
+ };
+ psa_outvec out_vec[] = {
+ {.base = data, .len = data_size}
+ };
+
+ status = psa_call(RSE_CRYPTO_HANDLE, PSA_IPC_CALL,
+ in_vec, IOVEC_LEN(in_vec),
+ out_vec, IOVEC_LEN(out_vec));
+
+ return status;
+}
#endif