mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-12 00:54:37 +02:00
esp-tls: update esp-tls to support linux build
This commit is contained in:
@@ -9,23 +9,30 @@ if(CONFIG_ESP_TLS_USING_WOLFSSL)
|
|||||||
"esp_tls_wolfssl.c")
|
"esp_tls_wolfssl.c")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
set(priv_req http_parser)
|
||||||
|
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
||||||
|
list(APPEND priv_req lwip)
|
||||||
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS "${srcs}"
|
idf_component_register(SRCS "${srcs}"
|
||||||
INCLUDE_DIRS . esp-tls-crypto
|
INCLUDE_DIRS . esp-tls-crypto
|
||||||
PRIV_INCLUDE_DIRS "private_include"
|
PRIV_INCLUDE_DIRS "private_include"
|
||||||
# mbedtls is public requirements becasue esp_tls.h
|
# mbedtls is public requirements becasue esp_tls.h
|
||||||
# includes mbedtls header files.
|
# includes mbedtls header files.
|
||||||
REQUIRES mbedtls
|
REQUIRES mbedtls
|
||||||
PRIV_REQUIRES lwip http_parser)
|
PRIV_REQUIRES ${priv_req})
|
||||||
|
|
||||||
if(CONFIG_ESP_TLS_USING_WOLFSSL)
|
if(CONFIG_ESP_TLS_USING_WOLFSSL)
|
||||||
idf_component_get_property(wolfssl esp-wolfssl COMPONENT_LIB)
|
idf_component_get_property(wolfssl esp-wolfssl COMPONENT_LIB)
|
||||||
target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl})
|
target_link_libraries(${COMPONENT_LIB} PUBLIC ${wolfssl})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT ${IDF_TARGET} STREQUAL "linux")
|
||||||
# Increase link multiplicity to get some lwip symbols correctly resolved by the linker
|
# 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
|
# due to cyclic dependencies present in IDF for lwip/esp_netif/mbedtls
|
||||||
idf_component_get_property(lwip lwip COMPONENT_LIB)
|
idf_component_get_property(lwip lwip COMPONENT_LIB)
|
||||||
set_property(TARGET ${lwip} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 5)
|
set_property(TARGET ${lwip} APPEND PROPERTY LINK_INTERFACE_MULTIPLICITY 5)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CONFIG_ESP_TLS_USE_SECURE_ELEMENT)
|
if(CONFIG_ESP_TLS_USE_SECURE_ELEMENT)
|
||||||
idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib)
|
idf_component_optional_requires(PRIVATE espressif__esp-cryptoauthlib esp-cryptoauthlib)
|
||||||
|
@@ -17,6 +17,18 @@
|
|||||||
#include "esp_tls_private.h"
|
#include "esp_tls_private.h"
|
||||||
#include "esp_tls_error_capture_internal.h"
|
#include "esp_tls_error_capture_internal.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
|
#if CONFIG_IDF_TARGET_LINUX
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <linux/if.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#define ipaddr_ntoa(ipaddr) inet_ntoa(*ipaddr)
|
||||||
|
typedef struct in_addr ip_addr_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "esp-tls";
|
static const char *TAG = "esp-tls";
|
||||||
|
|
||||||
#ifdef CONFIG_ESP_TLS_USING_MBEDTLS
|
#ifdef CONFIG_ESP_TLS_USING_MBEDTLS
|
||||||
|
@@ -7,6 +7,10 @@
|
|||||||
#include "esp_tls.h"
|
#include "esp_tls.h"
|
||||||
#include "esp_tls_error_capture_internal.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 {
|
typedef struct esp_tls_error_storage {
|
||||||
struct esp_tls_last_error parent; /*!< standard esp-tls last error container */
|
struct esp_tls_last_error parent; /*!< standard esp-tls last error container */
|
||||||
int sock_errno; /*!< last socket error captured in esp-tls */
|
int sock_errno; /*!< last socket error captured in esp-tls */
|
||||||
|
Reference in New Issue
Block a user