Merge branch 'bugfix/mbedtls_client_only_config_build_failure' into 'master'
Fix build issues in coap library with mbedtls client only config See merge request espressif/esp-idf!5955
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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