mbedtls: Add support to build for linux target

This commit is contained in:
Harshit Malpani 2022-11-08 16:30:32 +05:30
parent 0635dc36c1
commit e215ede439
No known key found for this signature in database
GPG Key ID: FF1193D150EF75C3
3 changed files with 12 additions and 3 deletions

View File

@ -1,11 +1,13 @@
idf_build_get_property(idf_target IDF_TARGET)
idf_build_get_property(python PYTHON)
if(NOT ${IDF_TARGET} STREQUAL "linux")
set(priv_requires soc esp_hw_support)
if(NOT BOOTLOADER_BUILD)
list(APPEND priv_requires esp_pm)
endif()
endif()
set(mbedtls_srcs "")
set(mbedtls_include_dirs "port/include" "mbedtls/include" "mbedtls/library")
@ -120,6 +122,10 @@ set(mbedtls_target_sources ${mbedtls_target_sources}
"${COMPONENT_DIR}/port/dynamic/esp_ssl_tls.c")
endif()
if(${IDF_TARGET} STREQUAL "linux")
set(mbedtls_target_sources ${mbedtls_target_sources} "${COMPONENT_DIR}/port/net_sockets.c")
endif()
# net_sockets.c should only be compiled if BSD socket functions are available.
# Do this by checking if lwip component is included into the build.
idf_build_get_property(build_components BUILD_COMPONENTS)
@ -180,7 +186,6 @@ endif()
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_hardware.c"
"${COMPONENT_DIR}/port/esp_mem.c"
"${COMPONENT_DIR}/port/esp_timing.c"
"${COMPONENT_DIR}/port/sha/esp_sha.c"
)
if(CONFIG_SOC_AES_SUPPORTED)
@ -191,7 +196,9 @@ if(CONFIG_SOC_AES_SUPPORTED)
endif()
if(CONFIG_SOC_SHA_SUPPORTED)
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/sha/${SHA_PERIPHERAL_TYPE}/sha.c")
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/sha/esp_sha.c"
"${COMPONENT_DIR}/port/sha/${SHA_PERIPHERAL_TYPE}/sha.c"
)
endif()
# CONFIG_ESP_TLS_USE_DS_PERIPHERAL can be enabled only for the supported targets.

View File

@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
#include <string.h>
#include <esp_system.h>
#include <stdbool.h>
#include "esp_crt_bundle.h"
#include "esp_log.h"

View File

@ -34,6 +34,8 @@
#include <stdio.h>
#include <time.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>
/*
* Prepare for using the sockets interface