@@ -81,20 +81,35 @@ endif()
81
81
# Add port files to mbedtls targets
82
82
target_sources (mbedtls PRIVATE ${mbedtls_target_sources} )
83
83
84
+ target_sources (mbedcrypto PRIVATE "${COMPONENT_DIR} /port/esp_hardware.c"
85
+ "${COMPONENT_DIR} /port/esp_mem.c"
86
+ "${COMPONENT_DIR} /port/esp_timing.c"
87
+ "${COMPONENT_DIR} /port/esp_sha.c"
88
+ "${COMPONENT_DIR} /port/esp_aes_xts.c"
89
+ "${COMPONENT_DIR} /port/${idf_target} /aes.c"
90
+ "${COMPONENT_DIR} /port/${idf_target} /sha.c"
91
+ )
92
+
93
+ # Note: some mbedTLS hardware acceleration can be enabled/disabled by config.
94
+ #
95
+ # We don't need to filter aes.c as this uses a different prefix (esp_aes_x) and the
96
+ # config option only changes the prefixes in the header so mbedtls_aes_x compiles to esp_aes_x
97
+ #
98
+ # The other port-specific files don't override internal mbedTLS functions, they just add new functions.
99
+
100
+ if (CONFIG_MBEDTLS_HARDWARE_MPI )
101
+ target_sources (mbedcrypto PRIVATE "${COMPONENT_DIR} /port/esp_bignum.c"
102
+ "${COMPONENT_DIR} /port/${idf_target} /bignum.c"
103
+ )
104
+ endif ()
84
105
106
+ if (CONFIG_MBEDTLS_HARDWARE_SHA )
107
+ target_sources (mbedcrypto PRIVATE "${COMPONENT_DIR} /port/${idf_target} /esp_sha1.c"
108
+ "${COMPONENT_DIR} /port/${idf_target} /esp_sha256.c"
109
+ "${COMPONENT_DIR} /port/${idf_target} /esp_sha512.c"
110
+ )
111
+ endif ()
85
112
86
- target_sources (mbedcrypto PRIVATE "${COMPONENT_DIR} /port/esp_hardware.c"
87
- "${COMPONENT_DIR} /port/esp_mem.c"
88
- "${COMPONENT_DIR} /port/esp_timing.c"
89
- "${COMPONENT_DIR} /port/esp_sha.c"
90
- "${COMPONENT_DIR} /port/esp_bignum.c"
91
- "${COMPONENT_DIR} /port/esp_aes_xts.c"
92
- "${COMPONENT_DIR} /port/${idf_target} /bignum.c"
93
- "${COMPONENT_DIR} /port/${idf_target} /aes.c"
94
- "${COMPONENT_DIR} /port/${idf_target} /sha.c"
95
- "${COMPONENT_DIR} /port/${idf_target} /esp_sha1.c"
96
- "${COMPONENT_DIR} /port/${idf_target} /esp_sha256.c"
97
- "${COMPONENT_DIR} /port/${idf_target} /esp_sha512.c" )
98
113
99
114
foreach (target ${mbedtls_targets} )
100
115
target_compile_definitions (${target} PUBLIC -DMBEDTLS_CONFIG_FILE= "mbedtls/esp_config.h" )
0 commit comments