1 /* 2 * Copyright (c) 2019-2022, Arm Limited. All rights reserved. 3 * Copyright (c) 2021 STMicroelectronics. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 * 7 */ 8 9 #ifndef MBEDTLS_ACCELERATOR_CONF_H 10 #define MBEDTLS_ACCELERATOR_CONF_H 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif /* __cplusplus */ 15 16 /* RNG Config */ 17 #undef MBEDTLS_ENTROPY_NV_SEED 18 #undef MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES 19 #define MBEDTLS_ENTROPY_C 20 #define MBEDTLS_ENTROPY_HARDWARE_ALT 21 22 #undef MBEDTLS_AES_SETKEY_DEC_ALT 23 #undef MBEDTLS_AES_DECRYPT_ALT 24 25 /* specific Define for platform hardware accelerator */ 26 #define GENERATOR_HW_PKA_EXTENDED_API 27 #define GENERATOR_HW_CRYPTO_DPA_SUPPORTED 28 #define HW_CRYPTO_DPA_AES 29 #define HW_CRYPTO_DPA_GCM 30 31 /****************************************************************/ 32 /* Require built-in implementations based on PSA requirements */ 33 /****************************************************************/ 34 #if defined(MBEDTLS_PSA_CRYPTO_CONFIG) 35 36 #ifdef PSA_WANT_ALG_SHA_1 37 #define MBEDTLS_SHA1_ALT 38 #endif /* PSA_WANT_ALG_SHA_1 */ 39 40 #ifdef PSA_WANT_ALG_SHA_256 41 #define MBEDTLS_SHA256_ALT 42 #endif /* PSA_WANT_ALG_SHA_256 */ 43 44 #if defined(PSA_WANT_ALG_RSA_OAEP) || \ 45 defined(PSA_WANT_ALG_RSA_PKCS1V15_CRYPT) || \ 46 defined(PSA_WANT_ALG_RSA_PKCS1V15_SIGN) || \ 47 defined(PSA_WANT_ALG_RSA_PSS) || \ 48 defined(PSA_WANT_KEY_TYPE_RSA_KEY_PAIR) || \ 49 defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY) 50 #define MBEDTLS_RSA_ALT 51 #endif 52 53 #if defined(PSA_WANT_ALG_ECDH) || \ 54 defined(PSA_WANT_ALG_ECDSA) || \ 55 defined(PSA_WANT_KEY_TYPE_ECC_KEY_PAIR) || \ 56 defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY) 57 #define MBEDTLS_ECP_ALT 58 #undef MBEDTLS_ECP_NIST_OPTIM 59 #endif 60 61 #ifdef PSA_WANT_ALG_CCM 62 #define MBEDTLS_CCM_ALT 63 #endif /* PSA_WANT_ALG_CCM */ 64 65 #ifdef PSA_WANT_KEY_TYPE_AES 66 #define MBEDTLS_AES_ALT 67 #endif /* PSA_WANT_KEY_TYPE_AES */ 68 69 #ifdef PSA_WANT_ALG_GCM 70 #define MBEDTLS_GCM_ALT 71 #endif /* PSA_WANT_ALG_GCM */ 72 73 #if defined(PSA_WANT_ALG_ECDSA) || \ 74 defined(PSA_WANT_ALG_DETERMINISTIC_ECDSA) 75 #define MBEDTLS_ECDSA_VERIFY_ALT 76 #define MBEDTLS_ECDSA_SIGN_ALT 77 #endif 78 79 #else /* MBEDTLS_PSA_CRYPTO_CONFIG */ 80 /****************************************************************/ 81 /* Infer PSA requirements from Mbed TLS capabilities */ 82 /****************************************************************/ 83 84 #ifdef MBEDTLS_SHA1_C 85 #define MBEDTLS_SHA1_ALT 86 #endif /* MBEDTLS_SHA1_C */ 87 88 #ifdef MBEDTLS_SHA256_C 89 #define MBEDTLS_SHA256_ALT 90 #endif /* MBEDTLS_SHA256_C */ 91 92 #ifdef MBEDTLS_RSA_C 93 #define MBEDTLS_RSA_ALT 94 #endif /* MBEDTLS_RSA_C */ 95 96 #if defined(MBEDTLS_ECP_C) 97 #define MBEDTLS_ECP_ALT 98 #undef MBEDTLS_ECP_NIST_OPTIM 99 /*#define MBEDTLS_MD5_ALT*/ 100 #endif /* MBEDTLS_ECP_C && MBEDTLS_MD_C */ 101 102 #ifdef MBEDTLS_CCM_C 103 #define MBEDTLS_CCM_ALT 104 #endif /* MBEDTLS_CCM_C */ 105 106 #ifdef MBEDTLS_AES_C 107 #define MBEDTLS_AES_ALT 108 #endif /* MBEDTLS_AES_C */ 109 110 #ifdef MBEDTLS_GCM_C 111 #define MBEDTLS_GCM_ALT 112 #endif /* MBEDTLS_GCM_C */ 113 114 #ifdef MBEDTLS_ECDSA_C 115 #define MBEDTLS_ECDSA_VERIFY_ALT 116 #define MBEDTLS_ECDSA_SIGN_ALT 117 #endif /* MBEDTLS_ECDSA_C */ 118 119 #endif /* MBEDTLS_PSA_CRYPTO_CONFIG */ 120 121 #ifdef __cplusplus 122 } 123 #endif /* __cplusplus */ 124 125 #endif /* MBEDTLS_ACCELERATOR_CONF_H */ 126