blob: 159eef90888ee501eac69880971dcf405e0c95e5 [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
Edison Aib3e56962018-09-04 19:12:31 +080014uint32_t psa_framework_version(void)
15{
16 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_framework_version_veneer,
17 0,
18 0,
19 0,
20 0);
21}
22
Miklos Balint87da2512018-04-19 13:45:50 +020023uint32_t psa_version(uint32_t sid)
24{
25 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_version_veneer,
26 sid,
27 0,
28 0,
29 0);
30}
31
32psa_handle_t psa_connect(uint32_t sid, uint32_t minor_version)
33{
34 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_connect_veneer,
35 sid,
36 minor_version,
37 0,
38 0);
39}
40
Edison Aib3e56962018-09-04 19:12:31 +080041psa_status_t psa_call(psa_handle_t handle,
42 const psa_invec *in_vec,
43 size_t in_len,
44 psa_outvec *out_vec,
45 size_t out_len)
Miklos Balint87da2512018-04-19 13:45:50 +020046{
Miklos Balintdd1ea1c2018-08-03 15:48:48 +020047 /* FixMe: sanity check can be added to offload some NS thread checks from
48 * TFM secure API
49 */
50
Miklos Balint87da2512018-04-19 13:45:50 +020051 /* Due to v8M restrictions, TF-M NS API needs to add another layer of
52 * serialization in order for NS to pass arguments to S
53 */
54 psa_invec in_vecs, out_vecs;
Edison Aib3e56962018-09-04 19:12:31 +080055
Miklos Balint87da2512018-04-19 13:45:50 +020056 in_vecs.base = in_vec;
57 in_vecs.len = in_len;
58 out_vecs.base = out_vec;
59 out_vecs.len = out_len;
60 return tfm_ns_lock_dispatch((veneer_fn)tfm_psa_call_veneer,
61 (uint32_t)handle,
62 (uint32_t)&in_vecs,
63 (uint32_t)&out_vecs,
64 0);
65}
66
67void psa_close(psa_handle_t handle)
68{
69 tfm_ns_lock_dispatch((veneer_fn)tfm_psa_close_veneer,
70 (uint32_t)handle,
71 0,
72 0,
73 0);
74}
75