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
@@ -252,12 +252,20 @@ static void coap_example_server(void *p)
|
||||
}
|
||||
#if defined(CONFIG_COAP_MBEDTLS_PSK) || defined(CONFIG_COAP_MBEDTLS_PKI)
|
||||
if (coap_dtls_is_supported()) {
|
||||
#ifndef CONFIG_MBEDTLS_TLS_SERVER
|
||||
/* This is not critical as unencrypted support is still available */
|
||||
ESP_LOGI(TAG, "MbedTLS (D)TLS Server Mode not configured");
|
||||
#else /* CONFIG_MBEDTLS_TLS_SERVER */
|
||||
serv_addr.addr.sin.sin_port = htons(COAPS_DEFAULT_PORT);
|
||||
ep = coap_new_endpoint(ctx, &serv_addr, COAP_PROTO_DTLS);
|
||||
if (!ep) {
|
||||
ESP_LOGE(TAG, "dtls: coap_new_endpoint() failed");
|
||||
goto clean_up;
|
||||
}
|
||||
#endif /* CONFIG_MBEDTLS_TLS_SERVER */
|
||||
} else {
|
||||
/* This is not critical as unencrypted support is still available */
|
||||
ESP_LOGI(TAG, "MbedTLS (D)TLS Server Mode not configured");
|
||||
}
|
||||
#endif /* CONFIG_COAP_MBEDTLS_PSK CONFIG_COAP_MBEDTLS_PKI */
|
||||
resource = coap_resource_init(coap_make_str_const("Espressif"), 0);
|
||||
|
||||
Reference in New Issue
Block a user