• 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 __CRYPTO_INNER_WRAPPER_H__
13 #define __CRYPTO_INNER_WRAPPER_H__
14 
15 #include <stdint.h>
16 #include <tee_defines.h>
17 
18 /*
19  * Get common name from certificate.
20  *
21  * @param name      [OUT]    The common name buffer
22  * @param name_size [IN/OUT] The length of common name buffer
23  * @param cert      [IN]     The certificate buffer
24  * @param cert_len  [IN]     The length of certificate buffer
25  *
26  * @return -1: Get common name failed
27  * @return  others: Get common name success
28  */
29 int32_t get_subject_CN(uint8_t *name, uint32_t name_size, const uint8_t *cert, uint32_t cert_len);
30 
31 /*
32  * Get organization name from certificate.
33  *
34  * @param name      [OUT]    The organization name buffer
35  * @param name_size [IN/OUT] The length of organization name buffer
36  * @param cert      [IN]     The certificate buffer
37  * @param cert_len  [IN]     The length of certificate buffer
38  *
39  * @return -1: Get organization name failed
40  * @return  others: Get organization name success
41  */
42 int32_t get_subject_OU(uint8_t *name, uint32_t name_size, const uint8_t *cert, uint32_t cert_len);
43 
44 #endif
45