diff options
author | Summer Qin <summer.qin@arm.com> | 2018-09-29 15:01:49 +0800 |
---|---|---|
committer | Edison Ai <edison.ai@arm.com> | 2019-01-26 10:31:44 +0800 |
commit | c74f11c251c9b69db22694c45320158fc176717b (patch) | |
tree | d100f8045f0684b2421dca1c0652adf2e16e0e70 | |
parent | 3349c94c5cfd992ec107965b19dbcfb452b2040b (diff) | |
download | trusted-firmware-m-c74f11c251c9b69db22694c45320158fc176717b.tar.gz |
Core: Adapt PSA API veneer with implemented handler
PSA API handler is implemented. Adapt veneer of non-secure PSA API with
implemented handler instead of dummy handler.
Change-Id: If51ae1882cbf630511db7f94c9555615bb3b2e4c
Signed-off-by: Summer Qin <summer.qin@arm.com>
-rw-r--r-- | secure_fw/core/tfm_psa_api_client.c | 58 | ||||
-rw-r--r-- | test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c | 4 |
2 files changed, 13 insertions, 49 deletions
diff --git a/secure_fw/core/tfm_psa_api_client.c b/secure_fw/core/tfm_psa_api_client.c index af6089eedd..4b35c58e7f 100644 --- a/secure_fw/core/tfm_psa_api_client.c +++ b/secure_fw/core/tfm_psa_api_client.c @@ -5,12 +5,14 @@ * */ +#include <stdbool.h> #include <stdio.h> #include "psa_client.h" #include "psa_service.h" #include "secure_utilities.h" #include "tfm_secure_api.h" #include "tfm_api.h" +#include "tfm_svcalls.h" /* FixMe: check if this is really needed */ extern int32_t tfm_secure_lock; @@ -76,48 +78,21 @@ int32_t tfm_core_ns_ipc_request(void *fn, int32_t arg1, int32_t arg2, __tfm_secure_gateway_attributes__ uint32_t tfm_psa_framework_version_veneer(void) { - return PSA_FRAMEWORK_VERSION; -} - -uint32_t tfm_psa_version_handler(uint32_t sid) -{ - /* perform sanity check */ - /* return version number registered in manifest for given SID */ - return PSA_VERSION_NONE; + TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_framework_version, 0, 0, + 0, 0); } __tfm_secure_gateway_attributes__ uint32_t tfm_psa_version_veneer(uint32_t sid) { - TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_psa_version_handler, sid, 0, 0, 0); -} - -psa_handle_t tfm_psa_connect_handler(uint32_t sid, uint32_t minor_version) -{ - /* perform sanity check */ - /* decide whether a connection can be established to a given SID. - * In case of library model, this function always returns a valid handle. - * In thread model, it needs to perform the procedures outlined in PSA IPC - */ - return PSA_SUCCESS; + TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_version, sid, 0, 0, 0); } __tfm_secure_gateway_attributes__ psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t minor_version) { - TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_psa_connect_handler, sid, minor_version, - 0, 0); -} - -psa_status_t tfm_psa_call_handler(psa_handle_t handle, - const psa_invec *in_vecs, - const psa_invec *out_vecs) -{ - /* perform sanity check */ - /* In case of library model, call the function referenced by the handle - * In thread model, it needs to perform the procedures outlined in PSA IPC - */ - return PSA_SUCCESS; + TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_connect, sid, + minor_version, 0, 0); } __tfm_secure_gateway_attributes__ @@ -125,21 +100,14 @@ psa_status_t tfm_psa_call_veneer(psa_handle_t handle, const psa_invec *in_vecs, const psa_invec *out_vecs) { - TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_psa_call_handler, handle, in_vecs, + TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_call, handle, in_vecs, out_vecs, 0); } -psa_status_t tfm_psa_close_handler(psa_handle_t handle) -{ - /* perform sanity check */ - /* Close connection referenced by handle */ - return PSA_SUCCESS; -} - __tfm_secure_gateway_attributes__ psa_status_t tfm_psa_close_veneer(psa_handle_t handle) { - TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_psa_close_handler, handle, 0, 0, 0); + TFM_CORE_NS_IPC_REQUEST_VENEER(tfm_svcall_psa_close, handle, 0, 0, 0); } void tfm_psa_ipc_request_handler(uint32_t svc_ctx[]) @@ -156,10 +124,10 @@ void tfm_psa_ipc_request_handler(uint32_t svc_ctx[]) } /* Store SVC return value in stacked r0 */ - *r0_ptr = desc_ptr->sfn(desc_ptr->args[0], - desc_ptr->args[1], - desc_ptr->args[2], - desc_ptr->args[3]); + *r0_ptr = desc_ptr->sfn((int32_t)desc_ptr->args, + desc_ptr->ns_caller, + 0, + 0); return; } diff --git a/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c index 8621318972..ad86b95c7d 100644 --- a/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c +++ b/test/suites/ipc/non_secure/ipc_ns_interface_testsuite.c @@ -49,8 +49,6 @@ void register_testsuite_ns_ipc_interface(struct test_suite_t *p_test_suite) */ static void tfm_ipc_test_1001(struct test_result_t *ret) { -/* FixMe: uncomment this when psa_framework is implemented. */ -#if 0 uint32_t version; version = psa_framework_version(); @@ -60,8 +58,6 @@ static void tfm_ipc_test_1001(struct test_result_t *ret) TEST_FAIL("The version of the PSA Framework API is not valid!\r\n"); return; } -#endif - TEST_FAIL("psa_framework is not implemented now!\r\n"); } /** |