1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* Copyright (c) 2018, Linaro Limited */ 3 #ifndef __MBEDTLS_CONFIG_KERNEL_H 4 #define __MBEDTLS_CONFIG_KERNEL_H 5 6 #ifdef ARM32 7 #define MBEDTLS_HAVE_INT32 8 #endif 9 #ifdef ARM64 10 #define MBEDTLS_HAVE_INT64 11 #endif 12 #define MBEDTLS_BIGNUM_C 13 #define MBEDTLS_GENPRIME 14 15 /* Test if Mbedtls is the primary crypto lib */ 16 #ifdef CFG_CRYPTOLIB_NAME_mbedtls 17 18 #if defined(CFG_CRYPTO_MD5) 19 #define MBEDTLS_MD5_C 20 #define MBEDTLS_MD_C 21 #endif 22 23 #if defined(CFG_CRYPTO_SHA1) 24 #define MBEDTLS_SHA1_C 25 #define MBEDTLS_MD_C 26 #if defined(CFG_CORE_CRYPTO_SHA1_ACCEL) 27 #define MBEDTLS_SHA1_PROCESS_ALT 28 #endif 29 #endif 30 31 #if defined(CFG_CRYPTO_SHA224) || defined(CFG_CRYPTO_SHA256) 32 #define MBEDTLS_SHA256_C 33 #define MBEDTLS_MD_C 34 #if defined(CFG_CRYPTO_SHA256_ACCEL) 35 #define MBEDTLS_SHA256_PROCESS_ALT 36 #endif 37 #endif 38 39 #if defined(CFG_CRYPTO_SHA384) || defined(CFG_CRYPTO_SHA512) 40 #define MBEDTLS_SHA512_C 41 #define MBEDTLS_MD_C 42 #endif 43 44 #if defined(CFG_CRYPTO_HMAC) 45 #define MBEDTLS_MD_C 46 #endif 47 48 #if defined(CFG_CRYPTO_AES) 49 #define MBEDTLS_AES_C 50 #define MBEDTLS_AES_ROM_TABLES 51 #if defined(CFG_CORE_CRYPTO_AES_ACCEL) 52 #define MBEDTLS_AES_ALT 53 #endif 54 #endif 55 56 #if defined(CFG_CRYPTO_DES) 57 #define MBEDTLS_DES_C 58 #endif 59 60 #if defined(CFG_CRYPTO_CBC) 61 #define MBEDTLS_CIPHER_MODE_CBC 62 #endif 63 64 #if defined(CFG_CRYPTO_CTR) 65 #define MBEDTLS_CIPHER_MODE_CTR 66 #endif 67 68 #if defined(CFG_CRYPTO_CMAC) 69 #define MBEDTLS_CMAC_C 70 #define MBEDTLS_CIPHER_C 71 #endif 72 73 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_DH) || defined(CFG_CRYPTO_ECC) 74 #define MBEDTLS_BIGNUM_C 75 #define MBEDTLS_OID_C 76 #define MBEDTLS_PKCS1_V15 77 #define MBEDTLS_PKCS1_V21 78 #define MBEDTLS_PK_C 79 #define MBEDTLS_GENPRIME 80 #define MBEDTLS_CTR_DRBG_C 81 #endif 82 83 #if defined(CFG_CRYPTO_RSA) 84 #define MBEDTLS_RSA_C 85 #define MBEDTLS_RSA_NO_CRT 86 #endif 87 88 #if defined(CFG_CRYPTO_RSA) || defined(CFG_CRYPTO_ECC) 89 #define MBEDTLS_ASN1_PARSE_C 90 #define MBEDTLS_ASN1_WRITE_C 91 #endif 92 93 #if defined(CFG_CRYPTO_DH) 94 #define MBEDTLS_DHM_C 95 #endif 96 97 #if defined(CFG_CRYPTO_ECC) 98 #define MBEDTLS_ECP_DP_SECP192R1_ENABLED 99 #define MBEDTLS_ECP_DP_SECP224R1_ENABLED 100 #define MBEDTLS_ECP_DP_SECP256R1_ENABLED 101 #define MBEDTLS_ECP_DP_SECP384R1_ENABLED 102 #define MBEDTLS_ECP_DP_SECP521R1_ENABLED 103 #define MBEDTLS_ECP_DP_SECP192K1_ENABLED 104 #define MBEDTLS_ECP_DP_SECP224K1_ENABLED 105 #define MBEDTLS_ECP_DP_SECP256K1_ENABLED 106 #define MBEDTLS_ECP_DP_BP256R1_ENABLED 107 #define MBEDTLS_ECP_DP_BP384R1_ENABLED 108 #define MBEDTLS_ECP_DP_BP512R1_ENABLED 109 #define MBEDTLS_ECP_DP_CURVE25519_ENABLED 110 #define MBEDTLS_ECP_C 111 #define MBEDTLS_ECDSA_C 112 #define MBEDTLS_ECDH_C 113 #define MBEDTLS_ECDH_LEGACY_CONTEXT 114 #if defined(CFG_CRYPTO_DSA) || defined(CFG_CRYPTO_SM2_PKE) || \ 115 defined(CFG_CRYPTO_SM2_KEP) 116 #define MBEDTLS_ECP_DP_SM2_ENABLED 117 #endif 118 #endif 119 120 #endif /*CFG_CRYPTOLIB_NAME_mbedtls*/ 121 122 #include <mbedtls/check_config.h> 123 124 #endif /* __MBEDTLS_CONFIG_KERNEL_H */ 125