diff --git a/components/esp-tls/CMakeLists.txt b/components/esp-tls/CMakeLists.txt index f626441cfd..e98f3fdeaf 100644 --- a/components/esp-tls/CMakeLists.txt +++ b/components/esp-tls/CMakeLists.txt @@ -9,23 +9,30 @@ if(CONFIG_ESP_TLS_USING_WOLFSSL) "esp_tls_wolfssl.c") endif() +set(priv_req http_parser) +if(NOT ${IDF_TARGET} STREQUAL "linux") + list(APPEND priv_req lwip) +endif() + idf_component_register(SRCS "${srcs}" INCLUDE_DIRS . esp-tls-crypto PRIV_INCLUDE_DIRS "private_include" # mbedtls is public requirements becasue esp_tls.h # includes mbedtls header files. REQUIRES mbedtls - PRIV_REQUIRES lwip http_parser) + PRIV_REQUIRES ${priv_req}) if(CONFIG_ESP_TLS_USING_WOLFSSL) idf_component_get_property(wolfssl esp-wolfssl COMPONENT_LIB) target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl}) endif() +if(NOT ${IDF_TARGET} STREQUAL "linux") # Increase link multiplicity to get some lwip symbols correctly resolved by the linker # due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls idf_component_get_property(lwip lwip COMPONENT_LIB) set_property(TARGET ${lwip} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 5) +endif() if(CONFIG_ESP_TLS_USE_SECURE_ELEMENT) idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib) diff --git a/components/esp-tls/esp_tls.c b/components/esp-tls/esp_tls.c index 428bdd68f4..bdd4d67856 100644 --- a/components/esp-tls/esp_tls.c +++ b/components/esp-tls/esp_tls.c @@ -17,6 +17,18 @@ #include "esp_tls_private.h" #include "esp_tls_error_capture_internal.h" #include + +#if CONFIG_IDF_TARGET_LINUX +#include +#include +#include +#include +#include + +#define ipaddr_ntoa(ipaddr) inet_ntoa(*ipaddr) +typedef struct in_addr ip_addr_t; +#endif + static const char *TAG = "esp-tls"; #ifdef CONFIG_ESP_TLS_USING_MBEDTLS diff --git a/components/esp-tls/esp_tls_error_capture.c b/components/esp-tls/esp_tls_error_capture.c index c8b046dfde..f91d22773e 100644 --- a/components/esp-tls/esp_tls_error_capture.c +++ b/components/esp-tls/esp_tls_error_capture.c @@ -7,6 +7,10 @@ #include "esp_tls.h" #include "esp_tls_error_capture_internal.h" +#if CONFIG_IDF_TARGET_LINUX +#include "esp_linux_helper.h" +#endif + typedef struct esp_tls_error_storage { struct esp_tls_last_error parent; /*!< standard esp-tls last error container */ int sock_errno; /*!< last socket error captured in esp-tls */