Skip to content

Commit 759b1d5

Browse files
rtrbtMattiasTF
authored andcommitted
NetworkClientSecure: Don't break if PSK cyphersuites are disabled.
1 parent 2cb6fbc commit 759b1d5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

libraries/NetworkClientSecure/src/ssl_client.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
#include "ssl_client.h"
2020
#include "esp_crt_bundle.h"
2121

22-
#if !defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) && !defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
23-
#warning \
24-
"Please call `idf.py menuconfig` then go to Component config -> mbedTLS -> TLS Key Exchange Methods -> Enable pre-shared-key ciphersuites and then check `Enable PSK based ciphersuite modes`. Save and Quit."
25-
#else
26-
2722
const char *pers = "esp32-tls";
2823

2924
static int _handle_error(int err, const char *function, int line) {
@@ -217,6 +212,10 @@ int start_ssl_client(
217212
log_e("useRootCABundle is set, but attach_ssl_certificate_bundle(ssl, true); was not called!");
218213
}
219214
} else if (pskIdent != NULL && psKey != NULL) {
215+
#if !defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED) && !defined(MBEDTLS_KEY_EXCHANGE_SOME_PSK_ENABLED)
216+
log_e("PSK based cyphersuite modes not supported");
217+
return -1;
218+
#else
220219
log_v("Setting up PSK");
221220
// convert PSK from hex to binary
222221
if ((strlen(psKey) & 1) != 0 || strlen(psKey) > 2 * MBEDTLS_PSK_MAX_LEN) {
@@ -255,6 +254,7 @@ int start_ssl_client(
255254
log_e("mbedtls_ssl_conf_psk returned %d", ret);
256255
return handle_error(ret);
257256
}
257+
#endif
258258
} else {
259259
return -1;
260260
}
@@ -634,4 +634,3 @@ bool verify_ssl_dn(sslclient_context *ssl_client, const char *domain_name) {
634634

635635
return false;
636636
}
637-
#endif

0 commit comments

Comments
 (0)