• 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_CERT_H
13 #define PERM_SRV_TA_CERT_H
14 
15 #include <tee_defines.h>
16 #include <crypto_wrapper.h>
17 #include <ta_config_builder.h>
18 
19 #define MAX_CERT_LEN 2048
20 #define MAX_PUBKEY_LEN 1024
21 
22 TEE_Result perm_srv_export_cert_from_storage(uint8_t *dst, uint32_t *dst_len, uint32_t limit);
23 TEE_Result perm_srv_import_cert_to_storage(const uint8_t *src, size_t len);
24 TEE_Result perm_srv_remove_cert_from_storage(void);
25 
26 void perm_srv_cert_expiration_alarm(const TEE_Date_Time *time1, const TEE_Date_Time *time2);
27 TEE_Result perm_srv_get_imported_cert_pubkey(uint8_t *dst, uint32_t *len);
28 TEE_Result perm_srv_check_cert_import_enable(const struct config_info *config, uint32_t cmd,
29                                              bool *is_cert_import_enable);
30 
31 TEE_Result perm_srv_cert_expiration_date_check(const validity_period_t *valid_date);
32 TEE_Result perm_srv_cert_expiration_check(const uint8_t *cert, uint32_t cert_size);
33 TEE_Result perm_srv_cert_validation_check(const uint8_t *cert, uint32_t cert_size,
34                                           const uint8_t *parent_key, uint32_t parent_key_len);
35 #endif
36