• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  * Description: mbedtls harden adapt internal header file.
15  *
16  * Create: 2023-05-10
17 */
18 #ifndef MBEDTLS_ECC_COMMON_H
19 #define MBEDTLS_ECC_COMMON_H
20 
21 #include "cipher_adapt.h"
22 #include "mbedtls/ecp.h"
23 
24 void get_curve_type( mbedtls_ecp_group_id grp_id, drv_pke_ecc_curve_type *curve_type, unsigned int *klen );
25 
26 int check_ecc_harden_can_do( mbedtls_ecp_group *grp, int (*f_rng)(void *, unsigned char *, size_t) );
27 
28 int ecp_priv_key_alloc( const unsigned int klen, drv_pke_data *priv_key );
29 
30 void ecp_priv_key_free( drv_pke_data *priv_key );
31 
32 int ecp_pub_key_alloc( const unsigned int klen, drv_pke_ecc_point *pub_key );
33 
34 void ecp_pub_key_free( drv_pke_ecc_point *pub_key );
35 
36 int ecp_priv_key_create( drv_pke_ecc_curve_type ecc_type, unsigned int klen, const mbedtls_mpi *d,
37                          drv_pke_data *priv_key );
38 
39 int ecp_pub_key_create( drv_pke_ecc_curve_type ecc_type, unsigned int klen, const mbedtls_ecp_point *pub,
40                         drv_pke_ecc_point *pub_key );
41 
42 #endif /* MBEDTLS_ECC_COMMON_H */