diff mbox series

[1/1] arm-bsp/recipes-security: Add protobuf interface to crypto-sp in corstone1000

Message ID 20250113163427.564404-2-philip.puk@arm.com
State New
Headers show
Series arm-bsp/recipes-security: Add protobuf interface to crypto-sp in corstone1000 | expand

Commit Message

philip.puk@arm.com Jan. 13, 2025, 4:34 p.m. UTC
From: Philip Puk <philip.puk@arm.com>

Adds protobuf interface to se-proxy-sp as the main crypto-sp uses it and
parsec service 1.4 also switch using protobuf interface.

Signed-off-by: Philip Puk <philip.puk@arm.com>
---
 .../0020-se-proxy-protobuf-change.patch       | 65 +++++++++++++++++++
 .../trusted-services/ts-arm-platforms.inc     |  1 +
 2 files changed, 66 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-se-proxy-protobuf-change.patch
diff mbox series

Patch

diff --git a/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-se-proxy-protobuf-change.patch b/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-se-proxy-protobuf-change.patch
new file mode 100644
index 00000000..cfe0e693
--- /dev/null
+++ b/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0020-se-proxy-protobuf-change.patch
@@ -0,0 +1,65 @@ 
+From e5a4487e2b757d0063148691c7d06ae1c7e15b9a Mon Sep 17 00:00:00 2001
+From: Emekcan Aras <emekcan.aras@arm.com>
+Date: Tue, 18 Jun 2024 11:52:43 +0100
+Subject: [PATCH] protobuf fix
+
+Upstream-Status: Pending (not yet submitted to upstream)
+Signed-off-by: Emekcan Aras <emekcan.aras@arm.com>
+---
+ .../se-proxy/env/commonsp/se_proxy_sp.c       | 25 ++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/deployments/se-proxy/env/commonsp/se_proxy_sp.c b/deployments/se-proxy/env/commonsp/se_proxy_sp.c
+index a0eb03b6f..e2774c135 100644
+--- a/deployments/se-proxy/env/commonsp/se_proxy_sp.c
++++ b/deployments/se-proxy/env/commonsp/se_proxy_sp.c
+@@ -13,6 +13,7 @@
+ #include "trace.h"
+ #include "deployments/se-proxy/infra/service_proxy_factory.h"
+ #include "deployments/se-proxy/se_proxy_interfaces.h"
++#include <service/crypto/factory/crypto_provider_factory.h>
+ 
+ static bool sp_init(uint16_t *own_sp_id);
+ 
+@@ -39,7 +40,7 @@ void __noreturn sp_main(union ffa_boot_info *boot_info)
+ 		goto fatal_error;
+ 	}
+ 
+-	rpc_status = ts_rpc_endpoint_sp_init(&rpc_endpoint, 5, 16);
++	rpc_status = ts_rpc_endpoint_sp_init(&rpc_endpoint, 6, 16);
+ 	if (rpc_status != RPC_SUCCESS) {
+ 		EMSG("Failed to initialize RPC endpoint: %d", rpc_status);
+ 		goto fatal_error;
+@@ -129,6 +130,28 @@ void __noreturn sp_main(union ffa_boot_info *boot_info)
+ 		goto fatal_error;
+ 	}
+ 
++	struct rpc_service_interface *crypto_iface_protobuf = NULL;
++	struct crypto_provider *crypto_protobuf_provider = NULL;
++
++	crypto_protobuf_provider = crypto_protobuf_provider_factory_create();
++	if (!crypto_protobuf_provider) {
++		EMSG("Failed to create crypto protobuf provider factory");
++		goto fatal_error;
++	}
++
++	crypto_iface_protobuf = service_provider_get_rpc_interface(
++		&crypto_protobuf_provider->base_provider);
++	if (!crypto_iface_protobuf) {
++		EMSG("Failed to create service provider RPC interface");
++		goto fatal_error;
++	}
++
++	rpc_status = ts_rpc_endpoint_sp_add_service(&rpc_endpoint, crypto_iface_protobuf);
++	if (rpc_status != RPC_SUCCESS) {
++		EMSG("Failed to add service to RPC endpoint: %d", rpc_status);
++		goto fatal_error;
++	}
++
+	while (1) {
+		ts_rpc_endpoint_sp_receive(&rpc_endpoint, &req_msg, &resp_msg);
+
+-- 
+2.25.1
+
+
diff --git a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
index af313f44..770c47ab 100644
--- a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
+++ b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
@@ -21,6 +21,7 @@  SRC_URI:append:corstone1000  = " \
     file://0017-Implement-Private-Authenticated-Variable-verificatio.patch \
     file://0018-Make-RSS-and-MHU-sizes-compile-time-definitions-user.patch \
     file://0019-Align-PSA-Crypto-with-TF-Mv2.1.patch \
+    file://0020-se-proxy-protobuf-change.patch \
     "
 
 # The patches above introduce errors with GCC 14.1, silence them for now