This update supports DTLS, TLS is a future TODO components/coap/CMakeLists.txt: components/coap/component.mk: Add in the new files that have to be built Replace libcoap/src/coap_notls.c with libcoap/src/coap_mbedtls.c components/coap/libcoap: Update the version to include the current version for supporting MbedTLS components/coap/port/coap_debug.c: components/coap/port/coap_mbedtls.c: components/coap/port/include/coap/coap_dtls.h: New port files for DTLS components/coap/port/include/coap_config_posix.h: Include building with MbedTLS examples/protocols/coap_client/README.md: examples/protocols/coap_client/main/CMakeLists.txt: examples/protocols/coap_client/main/Kconfig.projbuild: examples/protocols/coap_client/main/coap_client_example_main.c: examples/protocols/coap_client/main/component.mk: Update CoAP client to support DTLS examples/protocols/coap_client/main/coap_ca.pem examples/protocols/coap_client/main/coap_client.crt examples/protocols/coap_client/main/coap_client.key New PKI Certs for CoAP client (copied from wpa2_enterprise example) examples/protocols/coap_server/README.md: examples/protocols/coap_server/main/CMakeLists.txt: examples/protocols/coap_server/main/Kconfig.projbuild: examples/protocols/coap_server/main/coap_server_example_main.c: examples/protocols/coap_server/main/component.mk: Update CoAP server to support DTLS Change "no data" to "Hello World!" to prevent confusion examples/protocols/coap_server/main/coap_ca.pem examples/protocols/coap_server/main/coap_server.crt examples/protocols/coap_server/main/coap_server.key New PKI Certs for CoAP server (copied from wpa2_enterprise example) Closes https://github.com/espressif/esp-idf/pull/3345 Closes https://github.com/espressif/esp-idf/issues/1379
40 lines
1.7 KiB
CMake
40 lines
1.7 KiB
CMake
idf_component_register(INCLUDE_DIRS "port/include" "mbedtls/include"
|
|
REQUIRES lwip)
|
|
|
|
# Only build mbedtls libraries
|
|
set(ENABLE_TESTING CACHE BOOL OFF)
|
|
set(ENABLE_PROGRAMS CACHE BOOL OFF)
|
|
|
|
# Needed to for include_next includes to work from within mbedtls
|
|
include_directories("${COMPONENT_DIR}/port/include")
|
|
|
|
# Import mbedtls library targets
|
|
add_subdirectory(mbedtls)
|
|
|
|
# Use port specific implementation of net_socket.c instead of one from mbedtls
|
|
get_target_property(src_tls mbedtls SOURCES)
|
|
list(REMOVE_ITEM src_tls net_sockets.c)
|
|
set_property(TARGET mbedtls PROPERTY SOURCES ${src_tls})
|
|
|
|
set(mbedtls_targets mbedtls mbedcrypto mbedx509)
|
|
|
|
# Add port files to mbedtls targets
|
|
target_sources(mbedtls PRIVATE "${COMPONENT_DIR}/port/esp_bignum.c"
|
|
"${COMPONENT_DIR}/port/esp_hardware.c"
|
|
"${COMPONENT_PATH}/port/esp_sha.c"
|
|
"${COMPONENT_DIR}/port/esp_sha1.c"
|
|
"${COMPONENT_DIR}/port/esp_sha256.c"
|
|
"${COMPONENT_DIR}/port/esp_sha512.c"
|
|
"${COMPONENT_DIR}/port/esp_timing.c"
|
|
"${COMPONENT_DIR}/port/mbedtls_debug.c"
|
|
"${COMPONENT_DIR}/port/net_sockets.c"
|
|
"${COMPONENT_DIR}/port/esp32/aes.c"
|
|
"${COMPONENT_DIR}/port/esp32/sha.c")
|
|
target_sources(mbedcrypto PRIVATE "${COMPONENT_DIR}/port/esp_mem.c")
|
|
|
|
foreach(target ${mbedtls_targets})
|
|
target_compile_definitions(${target} PUBLIC -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h")
|
|
endforeach()
|
|
|
|
# Link mbedtls libraries to component library
|
|
target_link_libraries(${COMPONENT_LIB} INTERFACE ${mbedtls_targets})
|