• 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 
19 #ifndef MBEDTLS_PLATFORM_HARDWARE_CONFIG_H
20 #define MBEDTLS_PLATFORM_HARDWARE_CONFIG_H
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 #define MBEDTLS_HARDEN_SUCCESS           TD_SUCCESS
27 #define MBEDTLS_HARDEN_TRUE              TD_TRUE
28 #define MBEDTLS_HARDEN_FALSE             TD_FALSE
29 
30 #define MAX_AES_HARD_CTX_NUM  4
31 
32 #define MAX_AES_XTS_TWEAK_SIZE   256
33 
34 #define MAX_GCM_HARD_CTX_NUM   2
35 
36 #define MBEDTLS_CIPHER_MAX_ADD_LEN   128
37 
38 #define MAX_CCM_HARD_CTX_NUM   2
39 
40 #define MAX_CMAC_HARD_CTX_NUM   4
41 
42 #define HARDWARE_521_ALIGN_576_LEN
43 
44 #define MAX_HASH_HARD_CTX_NUM   4
45 
46 /*******************************************alternative macro*********************************************/
47 
48 #define MBEDTLS_ENTROPY_HARDWARE_ALT
49 
50 // #define MBEDTLS_AES_ALT
51 
52 // #define MBEDTLS_CMAC_ALT
53 
54 #define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
55 
56 #define MBEDTLS_ECDSA_VERIFY_ALT
57 
58 #define MBEDTLS_ECDSA_SIGN_ALT
59 
60 #define MBEDTLS_ECC_GEN_KEY_ALT
61 
62 #define MBEDTLS_ECDSA_GENKEY_ALT
63 
64 #define MBEDTLS_SHA256_ALT
65 
66 #define MBEDTLS_SHA512_ALT
67 
68 #define MBEDTLS_PBKDF2_HMAC_ALT
69 
70 /*******************************************alternative macro*********************************************/
71 
72 /*******************************************algorithm cfg macro*******************************************/
73 
74 #define MBEDTLS_BP256R1_USE_HARDWARE
75 #define MBEDTLS_BP384R1_USE_HARDWARE
76 #define MBEDTLS_BP512R1_USE_HARDWARE
77 #define MBEDTLS_CURVE25519_USE_HARDWARE
78 
79 #define MBEDTLS_SHA256_USE_HARDWARE
80 #define MBEDTLS_SHA384_USE_HARDWARE
81 #define MBEDTLS_SHA512_USE_HARDWARE
82 
83 #define MBEDTLS_BIGNUM_EXP_MOD_USE_HARDWARE
84 #define MBEDTLS_BIGNUM_MOD_USE_HARDWARE
85 #define MBEDTLS_NO_PLATFORM_ENTROPY
86 /*******************************************algorithm cfg macro*******************************************/
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* MBEDTLS_PLATFORM_USER_CONFIG_H */