• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3  * Licensed under the Mulan PSL v2.
4  * You can use this software according to the terms and conditions of the Mulan PSL v2.
5  * You may obtain a copy of Mulan PSL v2 at:
6  *     http://license.coscl.org.cn/MulanPSL2
7  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
8  * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
9  * PURPOSE.
10  * See the Mulan PSL v2 for more details.
11  */
12 #ifndef PERM_SRV_TA_CTRL_H
13 #define PERM_SRV_TA_CTRL_H
14 
15 #include <dlist.h>
16 #include <tee_defines.h>
17 #include <pthread.h>
18 
19 #define PADDING_SIZE          7
20 #define TA_CTRL_LIST_MAX_SIZE 8192
21 #define RSA2048_SIGNATURE_LEN 256
22 #define CERT_MAX_SIZE         2048
23 #define CERT_UNIVERSAL_LEN    64
24 #define TA_CTRL_MAGIC_NUM     0x12361215
25 #define TA_CTRL_CHIP_LEN      4
26 
27 struct padding {
28     uint16_t reserved[PADDING_SIZE];
29 };
30 
31 struct ta_ctrl_node {
32     struct dlist_node head;
33     TEE_UUID uuid;
34     uint16_t version;
35     struct padding pad;
36 };
37 
38 struct ta_ctrl_config_t {
39     struct dlist_node ctrl_list;
40     const char *file_name;
41     uint16_t count;
42     pthread_mutex_t lock;
43 };
44 
45 struct ta_ctrl_list_hd_t {
46     uint32_t magic_num;
47     uint32_t version;
48     uint32_t body_len;
49     uint32_t signature_len;
50     uint32_t cert_len;
51 };
52 
53 TEE_Result perm_srv_global_ta_ctrl_list_loading(bool check_empty);
54 TEE_Result perm_srv_check_ta_deactivated(const TEE_UUID *uuid, uint16_t version);
55 TEE_Result perm_srv_ta_ctrl_buff_process(const uint8_t *ctrl_buff, uint32_t ctrl_buff_size);
56 #endif
57