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 TEE_AUTH_COMMON_H 14 #define TEE_AUTH_COMMON_H 15 16 #include <stdint.h> 17 #include <unistd.h> 18 #include <sys/types.h> 19 #include <sys/stat.h> 20 #include <stdbool.h> 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #define MAX_PATH_LENGTH 256 27 28 #define BUF_MAX_SIZE 4096 29 #define CMD_MAX_SIZE 1024 30 #define BACKLOG_LEN 10 31 32 typedef enum { 33 SYSTEM_CA = 1, 34 VENDOR_CA, 35 APP_CA, 36 SA_CA, 37 MAX_CA, 38 } CaType; 39 40 typedef struct { 41 uint8_t certs[BUF_MAX_SIZE]; /* for APP_CA\SA_CA */ 42 CaType type; 43 uid_t uid; 44 pid_t pid; 45 } CaAuthInfo; 46 47 int TeeGetPkgName(int caPid, char *path, size_t pathLen); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif 54