plat_tc_mbedtls_config.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (c) 2022-2024, Arm Ltd. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef PLAT_TC_MBEDTLS_CONFIG_H
  7. #define PLAT_TC_MBEDTLS_CONFIG_H
  8. #include <export/lib/utils_def_exp.h>
  9. #include <mbedtls_config-3.h>
  10. #ifndef TF_MBEDTLS_HEAP_SIZE
  11. #error TF_MBEDTLS_HEAP_SIZE is not defined
  12. #else
  13. #define PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE (8 * 1024)
  14. /* Only change heap size if it is less then the minimum required. */
  15. #if TF_MBEDTLS_HEAP_SIZE < PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE
  16. #undef TF_MBEDTLS_HEAP_SIZE
  17. #define TF_MBEDTLS_HEAP_SIZE PLATFORM_TEST_MIN_MBEDTLS_HEAP_SIZE
  18. #endif
  19. #endif /* TF_MBEDTLS_HEAP_SIZE */
  20. /**
  21. * On Arm TC platforms, the ROTPK is always hashed using the SHA-256
  22. * algorithm.
  23. * TODO: Update to hash the ROTPK with the selected HASH_ALG to avoid
  24. * the need for explicitly enabling the SHA-256 configuration in mbedTLS.
  25. */
  26. #define MBEDTLS_SHA256_C
  27. /*
  28. * Use an implementation of SHA-256 with a smaller memory footprint
  29. * but reduced speed.
  30. */
  31. #define MBEDTLS_SHA256_SMALLER
  32. #define MBEDTLS_PSA_CRYPTO_C
  33. #define MBEDTLS_PSA_CRYPTO_EXTERNAL_RNG
  34. #define MBEDTLS_ECP_C
  35. #define MBEDTLS_ECP_DP_SECP384R1_ENABLED
  36. #define MBEDTLS_ECP_NO_INTERNAL_RNG
  37. #endif /* PLAT_TC_MBEDTLS_CONFIG_H */