mirror of
https://github.com/espressif/esp-idf.git
synced 2025-12-15 19:34:03 +00:00
Fix libcoap building with various MbedTLS compile time options
components/coap/port/coap_mbedtls.c: Add in additional compile time check wrappers for different MbedTLS configurations. components/coap/CMakeLists.txt: components/coap/component.mk: components/coap/port/coap_notls.c: components/coap/port/include/coap_config_posix.h: Add in the ability to compile and run if MbedTLS does not have any TLS mode enabled. examples/protocols/coap_client/main/coap_client_example_main.c: Inform user that MbedTLS Client Mode is required for DTLS if not enabled, and coaps:// has been requested. [Lower libcoap library will still error and report this condition] examples/protocols/coap_server/main/coap_server_example_main.c: Inform user that MbedTLS Server Mode is required for DTLS if not enabled. [Lower libcoap library will still error and report this condition] Closes https://github.com/espressif/esp-idf/issues/3961 Closes https://github.com/espressif/esp-idf/issues/3971 Closes https://github.com/espressif/esp-idf/pull/3977
This commit is contained in:
committed by
Mahavir Jain
parent
61442cdcbb
commit
430b737760
@@ -219,9 +219,12 @@ static void coap_example_client(void *p)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((uri.scheme == COAP_URI_SCHEME_COAPS && !coap_dtls_is_supported()) ||
|
||||
(uri.scheme == COAP_URI_SCHEME_COAPS_TCP && !coap_tls_is_supported())) {
|
||||
ESP_LOGE(TAG, "CoAP server uri scheme is not supported");
|
||||
if (uri.scheme == COAP_URI_SCHEME_COAPS && !coap_dtls_is_supported()) {
|
||||
ESP_LOGE(TAG, "MbedTLS (D)TLS Client Mode not configured");
|
||||
break;
|
||||
}
|
||||
if (uri.scheme == COAP_URI_SCHEME_COAPS_TCP && !coap_tls_is_supported()) {
|
||||
ESP_LOGE(TAG, "CoAP server uri coaps+tcp:// scheme is not supported");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -308,6 +311,10 @@ static void coap_example_client(void *p)
|
||||
* but the code is left in for completeness.
|
||||
*/
|
||||
if (uri.scheme == COAP_URI_SCHEME_COAPS || uri.scheme == COAP_URI_SCHEME_COAPS_TCP) {
|
||||
#ifndef CONFIG_MBEDTLS_TLS_CLIENT
|
||||
ESP_LOGE(TAG, "MbedTLS (D)TLS Client Mode not configured");
|
||||
goto clean_up;
|
||||
#endif /* CONFIG_MBEDTLS_TLS_CLIENT */
|
||||
#ifdef CONFIG_COAP_MBEDTLS_PSK
|
||||
session = coap_new_client_session_psk(ctx, NULL, &dst_addr,
|
||||
uri.scheme == COAP_URI_SCHEME_COAPS ? COAP_PROTO_DTLS : COAP_PROTO_TLS,
|
||||
|
||||
Reference in New Issue
Block a user