blob: d2f4b4b0eee2104e6d3ae1567da01615bc464bed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/*
* Copyright (c) 2018-2020, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#include <stdbool.h>
#include <stdio.h>
#include "psa/client.h"
#include "psa/service.h"
#include "tfm_arch.h"
#include "tfm_secure_api.h"
#include "tfm_api.h"
#include "tfm_svcalls.h"
/* Veneer implementation */
/*
* SVC to core directly before touch stack due to:
* - Re-entrant detection bases on stack information.
* - SVC here stores the current xPSR into stack and recover it back while
* exception returns, no leakage of secure state information and no
* interference between two sides.
*/
__tfm_psa_secure_gateway_attributes__
uint32_t tfm_psa_framework_version_veneer(void)
{
__ASM volatile("SVC %0 \n"
"BXNS LR \n"
: : "I" (TFM_SVC_PSA_FRAMEWORK_VERSION));
}
__tfm_psa_secure_gateway_attributes__
uint32_t tfm_psa_version_veneer(uint32_t sid)
{
__ASM volatile("SVC %0 \n"
"BXNS LR \n"
: : "I" (TFM_SVC_PSA_VERSION));
}
__tfm_psa_secure_gateway_attributes__
psa_handle_t tfm_psa_connect_veneer(uint32_t sid, uint32_t version)
{
__ASM volatile("SVC %0 \n"
"BXNS LR \n"
: : "I" (TFM_SVC_PSA_CONNECT));
}
__tfm_psa_secure_gateway_attributes__
psa_status_t tfm_psa_call_veneer(psa_handle_t handle,
const struct tfm_control_parameter_t *ctrl_param,
const psa_invec *in_vec,
psa_outvec *out_vec)
{
__ASM volatile("SVC %0 \n"
"BXNS LR \n"
: : "I" (TFM_SVC_PSA_CALL));
}
__tfm_psa_secure_gateway_attributes__
void tfm_psa_close_veneer(psa_handle_t handle)
{
__ASM volatile("SVC %0 \n"
"BXNS LR \n"
: : "I" (TFM_SVC_PSA_CLOSE));
}
|