• 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 
13 #ifndef SECFILE_LOAD_AGENT_H
14 #define SECFILE_LOAD_AGENT_H
15 
16 #include <sys/ioctl.h>
17 #include "tee_default_path.h"
18 #include "tc_ns_client.h"
19 
20 #define SECFILE_LOAD_AGENT_ID 0x4c4f4144 // SECFILE-LOAD-AGENT
21 #define MAX_SEC_FILE_NAME_LEN 32
22 
23 typedef enum {
24     LOAD_TA_SEC = 0,
25     LOAD_SERVICE_SEC,
26     LOAD_LIB_SEC,
27 } SecAgentCmd;
28 
29 struct SecAgentControlType {
30     SecAgentCmd cmd;
31     uint32_t magic;
32     int32_t ret;
33     uint32_t error;
34     union {
35         struct {
36             TEEC_UUID uuid;
37         } TaSec;
38         struct {
39             TEEC_UUID uuid;
40             char serviceName[MAX_SEC_FILE_NAME_LEN];
41         } ServiceSec;
42         struct {
43             TEEC_UUID uuid;
44             char libName[MAX_SEC_FILE_NAME_LEN];
45         } LibSec;
46     };
47 };
48 
49 void *SecfileLoadAgentThread(void *control);
50 int32_t LoadSecFile(int tzFd, FILE *fp, enum SecFileType fileType, const TEEC_UUID *uuid);
51 int GetSecLoadAgentFd(void);
52 void SetSecLoadAgentFd(int secLoadAgentFd);
53 
54 #endif
55