From 87b0ff5a36ae291b7392b5d6c7e1169e84ce17cb Mon Sep 17 00:00:00 2001 From: pennam Date: Thu, 8 Aug 2024 08:40:36 +0200 Subject: [PATCH] ESP32: fix certificate bundle loading using core >= 3.0.4 --- src/tls/utility/TLSClientMqtt.cpp | 6 +++++- src/tls/utility/TLSClientOta.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/tls/utility/TLSClientMqtt.cpp b/src/tls/utility/TLSClientMqtt.cpp index 37461816..831f31cf 100644 --- a/src/tls/utility/TLSClientMqtt.cpp +++ b/src/tls/utility/TLSClientMqtt.cpp @@ -60,7 +60,11 @@ void TLSClientMqtt::begin(ConnectionHandler & connection) { */ (void)connection; #elif defined(ARDUINO_ARCH_ESP32) - setCACertBundle(x509_crt_bundle); + #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4)) + setCACertBundle(x509_crt_bundle); + #else + setCACertBundle(x509_crt_bundle, sizeof(x509_crt_bundle)); + #endif #elif defined(ARDUINO_ARCH_ESP8266) setInsecure(); #endif diff --git a/src/tls/utility/TLSClientOta.cpp b/src/tls/utility/TLSClientOta.cpp index 77096b6f..f03af769 100644 --- a/src/tls/utility/TLSClientOta.cpp +++ b/src/tls/utility/TLSClientOta.cpp @@ -56,7 +56,11 @@ void TLSClientOta::begin(ConnectionHandler &connection) { */ (void)connection; #elif defined(ARDUINO_ARCH_ESP32) - setCACertBundle(x509_crt_bundle); + #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4)) + setCACertBundle(x509_crt_bundle); + #else + setCACertBundle(x509_crt_bundle, sizeof(x509_crt_bundle)); + #endif #elif defined(ARDUINO_ARCH_ESP8266) setInsecure(); #endif