@@ -34,6 +34,7 @@ Arduino_ESP32_OTA::Arduino_ESP32_OTA()
34
34
, _http_client(nullptr )
35
35
,_ca_cert{amazon_root_ca}
36
36
,_ca_cert_bundle{nullptr }
37
+ ,_ca_cert_budle_size(0 )
37
38
,_magic(0 )
38
39
{
39
40
@@ -76,12 +77,22 @@ void Arduino_ESP32_OTA::setCACert (const char *rootCA)
76
77
}
77
78
}
78
79
80
+ #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
79
81
void Arduino_ESP32_OTA::setCACertBundle (const uint8_t * bundle)
80
82
{
81
83
if (bundle != nullptr ) {
82
84
_ca_cert_bundle = bundle;
83
85
}
84
86
}
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
85
96
86
97
void Arduino_ESP32_OTA::setMagic (uint32_t magic)
87
98
{
@@ -115,7 +126,11 @@ int Arduino_ESP32_OTA::startDownload(const char * ota_url)
115
126
if (_ca_cert != nullptr ) {
116
127
static_cast <WiFiClientSecure*>(_client)->setCACert (_ca_cert);
117
128
} else if (_ca_cert_bundle != nullptr ) {
129
+ #if (ESP_ARDUINO_VERSION < ESP_ARDUINO_VERSION_VAL(3, 0, 4))
118
130
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
119
134
} else {
120
135
DEBUG_VERBOSE (" %s: CA not configured for download client" );
121
136
}
0 commit comments