1 /*
2  * Copyright (c) 2021-2023, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #include <stdint.h>
9 #include "psa/client.h"
10 #include "psa/service.h"
11 #include "tfm_psa_call_pack.h"
12 
psa_call(psa_handle_t handle,int32_t type,const psa_invec * in_vec,size_t in_len,psa_outvec * out_vec,size_t out_len)13 psa_status_t psa_call(psa_handle_t handle,
14                       int32_t type,
15                       const psa_invec *in_vec,
16                       size_t in_len,
17                       psa_outvec *out_vec,
18                       size_t out_len)
19 {
20     if ((type    > PSA_CALL_TYPE_MAX) ||
21         (type    < PSA_CALL_TYPE_MIN) ||
22         (in_len  > PSA_MAX_IOVEC)     ||
23         (out_len > PSA_MAX_IOVEC)) {
24         psa_panic();
25     }
26 
27     return tfm_psa_call_pack(handle, PARAM_PACK(type, in_len, out_len),
28                              in_vec, out_vec);
29 }
30