1e656c62eSopenharmony_ci/* 2e656c62eSopenharmony_ci * Copyright (C) 2022 Huawei Technologies Co., Ltd. 3e656c62eSopenharmony_ci * Licensed under the Mulan PSL v2. 4e656c62eSopenharmony_ci * You can use this software according to the terms and conditions of the Mulan PSL v2. 5e656c62eSopenharmony_ci * You may obtain a copy of Mulan PSL v2 at: 6e656c62eSopenharmony_ci * http://license.coscl.org.cn/MulanPSL2 7e656c62eSopenharmony_ci * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR 8e656c62eSopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR 9e656c62eSopenharmony_ci * PURPOSE. 10e656c62eSopenharmony_ci * See the Mulan PSL v2 for more details. 11e656c62eSopenharmony_ci */ 12e656c62eSopenharmony_ci 13e656c62eSopenharmony_ci#ifndef TEE_AUTH_COMMON_H 14e656c62eSopenharmony_ci#define TEE_AUTH_COMMON_H 15e656c62eSopenharmony_ci 16e656c62eSopenharmony_ci#include <stdint.h> 17e656c62eSopenharmony_ci#include <unistd.h> 18e656c62eSopenharmony_ci#include <sys/types.h> 19e656c62eSopenharmony_ci#include <sys/stat.h> 20e656c62eSopenharmony_ci#include <stdbool.h> 21e656c62eSopenharmony_ci 22e656c62eSopenharmony_ci#ifdef __cplusplus 23e656c62eSopenharmony_ciextern "C" { 24e656c62eSopenharmony_ci#endif 25e656c62eSopenharmony_ci 26e656c62eSopenharmony_ci#define MAX_PATH_LENGTH 256 27e656c62eSopenharmony_ci 28e656c62eSopenharmony_ci#define BUF_MAX_SIZE 4096 29e656c62eSopenharmony_ci#define CMD_MAX_SIZE 1024 30e656c62eSopenharmony_ci#define BACKLOG_LEN 10 31e656c62eSopenharmony_ci 32e656c62eSopenharmony_citypedef enum { 33e656c62eSopenharmony_ci SYSTEM_CA = 1, 34e656c62eSopenharmony_ci VENDOR_CA, 35e656c62eSopenharmony_ci APP_CA, 36e656c62eSopenharmony_ci SA_CA, 37e656c62eSopenharmony_ci MAX_CA, 38e656c62eSopenharmony_ci} CaType; 39e656c62eSopenharmony_ci 40e656c62eSopenharmony_citypedef struct { 41e656c62eSopenharmony_ci uint8_t certs[BUF_MAX_SIZE]; /* for APP_CA\SA_CA */ 42e656c62eSopenharmony_ci CaType type; 43e656c62eSopenharmony_ci uid_t uid; 44e656c62eSopenharmony_ci pid_t pid; 45e656c62eSopenharmony_ci} CaAuthInfo; 46e656c62eSopenharmony_ci 47e656c62eSopenharmony_ciint TeeGetPkgName(int caPid, char *path, size_t pathLen); 48e656c62eSopenharmony_ci 49e656c62eSopenharmony_ci#ifdef __cplusplus 50e656c62eSopenharmony_ci} 51e656c62eSopenharmony_ci#endif 52e656c62eSopenharmony_ci 53e656c62eSopenharmony_ci#endif 54