blob: 80c3af880b663905f28fcc78555ed0ad60e782f4 [file] [log] [blame]
Miklos Balint87da2512018-04-19 13:45:50 +02001/*
2 * Copyright (c) 2018, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 */
7
8#include "interface/include/psa_client.h"
9#include "tfm_ns_lock.h"
10#include "tfm_api.h"
11
12/**** API functions ****/
13
14uint32_t psa_version(uint32_t sid)
15{
16 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_version_veneer,
17 sid,
18 0,
19 0,
20 0);
21}
22
23psa_handle_t psa_connect(uint32_t sid, uint32_t minor_version)
24{
25 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_connect_veneer,
26 sid,
27 minor_version,
28 0,
29 0);
30}
31
32psa_error_t psa_call(psa_handle_t handle,
33 const psa_invec *in_vec,
34 size_t in_len,
35 const psa_outvec *out_vec,
36 size_t out_len)
37{
38 /* Due to v8M restrictions, TF-M NS API needs to add another layer of
39 * serialization in order for NS to pass arguments to S
40 */
41 psa_invec in_vecs, out_vecs;
42 in_vecs.base = in_vec;
43 in_vecs.len = in_len;
44 out_vecs.base = out_vec;
45 out_vecs.len = out_len;
46 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_call_veneer,
47 (uint32_t)handle,
48 (uint32_t)&in_vecs,
49 (uint32_t)&out_vecs,
50 0);
51}
52
53void psa_close(psa_handle_t handle)
54{
55 tfm_ns_lock_dispatch((veneer_fn)tfm_psa_close_veneer,
56 (uint32_t)handle,
57 0,
58 0,
59 0);
60}
61