1 /** @file
2  * Copyright (c) 2018-2022, Arm Limited or its affiliates. All rights reserved.
3  * SPDX-License-Identifier : Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16 **/
17 
18 
19 #include "val_framework.h"
20 #include "val_interfaces.h"
21 #include "val_peripherals.h"
22 #include "val_target.h"
23 #include "val_crypto.h"
24 #include "val_storage.h"
25 #include "val_attestation.h"
26 
27 /*VAL APIs to be used by test */
28 const val_api_t val_api = {
29     .print                     = val_print,
30     .set_status                = val_set_status,
31     .get_status                = val_get_status,
32     .test_init                 = val_test_init,
33     .test_exit                 = val_test_exit,
34     .err_check_set             = val_err_check_set,
35     .target_get_config         = val_target_get_config,
36     .execute_non_secure_tests  = val_execute_non_secure_tests,
37 #ifdef IPC
38     .switch_to_secure_client   = val_switch_to_secure_client,
39     .execute_secure_test_func  = val_execute_secure_test_func,
40     .get_secure_test_result    = val_get_secure_test_result,
41     .ipc_connect               = val_ipc_connect,
42     .ipc_call                  = val_ipc_call,
43     .ipc_close                 = val_ipc_close,
44 #else
45     .switch_to_secure_client   = NULL,
46     .execute_secure_test_func  = NULL,
47     .get_secure_test_result    = NULL,
48     .ipc_connect               = NULL,
49     .ipc_call                  = NULL,
50     .ipc_close                 = NULL,
51 #endif
52     .nvmem_read                = val_nvmem_read,
53     .nvmem_write               = val_nvmem_write,
54     .wd_timer_init             = val_wd_timer_init,
55     .wd_timer_enable           = val_wd_timer_enable,
56     .wd_timer_disable          = val_wd_timer_disable,
57     .wd_reprogram_timer        = val_wd_reprogram_timer,
58     .set_boot_flag             = val_set_boot_flag,
59     .get_boot_flag             = val_get_boot_flag,
60 	.set_test_data             = val_set_test_data,
61 	.get_test_data             = val_get_test_data,
62     .crypto_function           = val_crypto_function,
63     .storage_function          = val_storage_function,
64     .attestation_function      = val_attestation_function,
65 };
66 
67 const psa_api_t psa_api = {
68 #ifdef IPC
69     .framework_version     = psa_framework_version,
70     .version               = psa_version,
71     .connect               = psa_connect,
72     .call                  = psa_call,
73     .close                 = psa_close,
74 #else
75     .framework_version     = NULL,
76     .version               = NULL,
77     .connect               = NULL,
78     .call                  = NULL,
79     .close                 = NULL,
80 #endif
81 };
82