Build: Decouple NS from config_impl.h/.cmake
config_impl.h and config_impl.cmake collect some SPM specific config
flags. Those config flags should be transparent to NS developers.
However, currently NS side relies on some of those config flags to
select interface files/functions. It requires TF-M to export
config_impl.h and config_impl.cmake. NS side shall explicitly include
them. It makes TF-M integration complex.
Collect PSA client APIs into a single interface file and therefore NS
doesn't rely on config_impl.cmake to select files. If psa_connect()
and psa_close() are not required in NS build, they will be dropped
automatically during linking.
Create dummy veneers for psa_connect() and psa_close() when connection
based API is not enabled. If NS side inovkes psa_connect()/close() when
no connection based API is implemented in secure side, TF-M will return
NOT_SUPPORTED error code. Therefore, NS side can get rid of
config_impl.h for connection based API flags.
Change-Id: I6d2c05fcd9880d3d2d408326b326b86774c8399f
Signed-off-by: David Hu <david.hu@arm.com>
diff --git a/interface/src/tfm_psa_ns_api.c b/interface/src/tfm_psa_ns_api.c
index 9743c27..c10baa6 100644
--- a/interface/src/tfm_psa_ns_api.c
+++ b/interface/src/tfm_psa_ns_api.c
@@ -52,3 +52,13 @@
(uint32_t)in_vec,
(uint32_t)out_vec);
}
+
+psa_handle_t psa_connect(uint32_t sid, uint32_t version)
+{
+ return tfm_ns_interface_dispatch((veneer_fn)tfm_psa_connect_veneer, sid, version, 0, 0);
+}
+
+void psa_close(psa_handle_t handle)
+{
+ (void)tfm_ns_interface_dispatch((veneer_fn)tfm_psa_close_veneer, (uint32_t)handle, 0, 0, 0);
+}