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 MBEDTLS_AES_192_HARD_KEY_SUPPORT 43 44 #define DRV_PKE_LEN_1024_SUPPORT 45 46 #define HARDWARE_521_ALIGN_576_LEN 47 48 #define MAX_HASH_HARD_CTX_NUM 4 49 50 #ifndef CONFIG_SUPPORT_HILINK 51 #undef MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED 52 53 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED 54 55 #undef MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED 56 #endif 57 /*******************************************alternative macro*********************************************/ 58 59 #define MBEDTLS_ENTROPY_HARDWARE_ALT 60 61 #define MBEDTLS_AES_ALT 62 63 // #define MBEDTLS_CMAC_ALT 64 65 // #define MBEDTLS_ECDH_COMPUTE_SHARED_ALT 66 67 // #define MBEDTLS_ECDSA_VERIFY_ALT 68 69 // #define MBEDTLS_ECDSA_SIGN_ALT 70 71 #define MBEDTLS_ECC_GEN_KEY_ALT 72 73 #define MBEDTLS_SHA1_ALT 74 75 #define MBEDTLS_SHA256_ALT 76 77 #define MBEDTLS_SHA512_ALT 78 79 #define MBEDTLS_HKDF_ALT 80 81 #define MBEDTLS_PBKDF2_HMAC_ALT 82 83 // #define MBEDTLS_ECDSA_GENKEY_ALT 84 85 #define MBEDTLS_ECP_RESTARTABLE 86 87 // #define MBEDTLS_ECP_MUL_ALT 88 89 // #define MBEDTLS_INNER_ECDSA_VERIFY_RESTARTABLE_ALT 90 91 #define MBEDTLS_SHA1_C 92 #define MBEDTLS_SHA224_C 93 #define MBEDTLS_SHA256_C 94 #define MBEDTLS_SHA384_C 95 #define MBEDTLS_SHA512_C 96 97 #ifndef CONFIG_SUPPORT_HILINK 98 #ifndef CONFIG_NOT_SUPPORT_RSA_ALT 99 #define MBEDTLS_RSA_ALT 100 #define MBEDTLS_RSA_NO_CRT 101 #define MBEDTLS_RSA_ALT_MAX_SIZE 512 102 #endif 103 #endif 104 105 /*******************************************alternative macro*********************************************/ 106 107 /*******************************************algorithm cfg macro*******************************************/ 108 109 #define MBEDTLS_SECP192R1_USE_HARDWARE 110 #define MBEDTLS_SECP224R1_USE_HARDWARE 111 #define MBEDTLS_SECP256R1_USE_HARDWARE 112 #define MBEDTLS_SECP384R1_USE_HARDWARE 113 #define MBEDTLS_SECP521R1_USE_HARDWARE 114 #define MBEDTLS_BP256R1_USE_HARDWARE 115 #define MBEDTLS_BP384R1_USE_HARDWARE 116 #define MBEDTLS_BP512R1_USE_HARDWARE 117 #define MBEDTLS_CURVE25519_USE_HARDWARE 118 #define MBEDTLS_CURVE448_USE_HARDWARE 119 120 #define MBEDTLS_SHA1_USE_HARDWARE 121 #define MBEDTLS_SHA224_USE_HARDWARE 122 #define MBEDTLS_SHA256_USE_HARDWARE 123 #define MBEDTLS_SHA384_USE_HARDWARE 124 #define MBEDTLS_SHA512_USE_HARDWARE 125 126 #define MBEDTLS_BIGNUM_EXP_MOD_USE_HARDWARE 127 #define MBEDTLS_BIGNUM_MOD_USE_HARDWARE 128 129 #define MBEDTLS_NO_PLATFORM_ENTROPY 130 /*******************************************algorithm cfg macro*******************************************/ 131 132 #ifdef __cplusplus 133 } 134 #endif 135 136 #endif /* MBEDTLS_PLATFORM_USER_CONFIG_H */