1 /*
2 * Copyright (C) 2022 Huawei Technologies Co., Ltd.
3 * Decription: exported funcs for teek client ext.
4 *
5 * This software is licensed under the terms of the GNU General Public
6 * License version 2, as published by the Free Software Foundation, and
7 * may be copied, distributed, and modified under those terms.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14 #include "teek_client_ext.h"
15 #include "smc_smp.h"
16 #include "mailbox_mempool.h"
17 #include "teek_client_constants.h"
18 #include "tz_update_crl.h"
19 #include "internal_functions.h"
20 #include "tc_client_driver.h"
21
22 #ifdef CONFIG_CMS_SIGNATURE
23 /* update crl */
teek_update_crl(uint8_t * crl,uint32_t crl_len)24 uint32_t teek_update_crl(uint8_t *crl, uint32_t crl_len)
25 {
26 if (!get_tz_init_flag()) return EFAULT;
27 if (crl == NULL || crl_len == 0 || crl_len > DEVICE_CRL_MAX) {
28 tloge("bad params\n");
29 return -EINVAL;
30 }
31
32 livepatch_down_read_sem();
33 int ret = send_crl_to_tee(crl, crl_len, NULL);
34 livepatch_up_read_sem();
35 if (ret != 0)
36 tloge("update crl failed, ret %d\n", ret);
37
38 return ret;
39 }
40 EXPORT_SYMBOL(teek_update_crl);
41 #endif