@@ -34,6 +34,7 @@ Arduino_ESP32_OTA::Arduino_ESP32_OTA()
3434, _http_client(nullptr )
3535,_ca_cert{amazon_root_ca}
3636,_ca_cert_bundle{nullptr }
37+ ,_ca_cert_budle_size(0 )
3738,_magic(0 )
3839{
3940
@@ -76,12 +77,22 @@ void Arduino_ESP32_OTA::setCACert (const char *rootCA)
7677 }
7778}
7879
80+ #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
7981void Arduino_ESP32_OTA::setCACertBundle (const uint8_t * bundle)
8082{
8183 if (bundle != nullptr ) {
8284 _ca_cert_bundle = bundle;
8385 }
8486}
87+ #else
88+ void Arduino_ESP32_OTA::setCACertBundle (const uint8_t * bundle, size_t size)
89+ {
90+ if (bundle != nullptr && size != 0 ) {
91+ _ca_cert_bundle = bundle;
92+ _ca_cert_budle_size = size;
93+ }
94+ }
95+ #endif
8596
8697void Arduino_ESP32_OTA::setMagic (uint32_t magic)
8798{
@@ -115,7 +126,11 @@ int Arduino_ESP32_OTA::startDownload(const char * ota_url)
115126 if (_ca_cert != nullptr ) {
116127 static_cast <WiFiClientSecure*>(_client)->setCACert (_ca_cert);
117128 } else if (_ca_cert_bundle != nullptr ) {
129+ #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
118130 static_cast <WiFiClientSecure*>(_client)->setCACertBundle (_ca_cert_bundle);
131+ #else
132+ static_cast <WiFiClientSecure*>(_client)->setCACertBundle (_ca_cert_bundle, _ca_cert_budle_size);
133+ #endif
119134 } else {
120135 DEBUG_VERBOSE (" %s: CA not configured for download client" );
121136 }
0 commit comments