Skip to content

Fix conflict with ESP-IDF's esp_crt_bundle #7560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Dec 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/WiFiClientSecure/src/WiFiClientSecure.cpp
Original file line number Diff line number Diff line change
@@ -264,10 +264,10 @@ void WiFiClientSecure::setCACert (const char *rootCA)
{
if (bundle != NULL)
{
esp_crt_bundle_set(bundle);
arduino_esp_crt_bundle_set(bundle);
_use_ca_bundle = true;
} else {
esp_crt_bundle_detach(NULL);
arduino_esp_crt_bundle_detach(NULL);
_use_ca_bundle = false;
}
}
6 changes: 3 additions & 3 deletions libraries/WiFiClientSecure/src/esp_crt_bundle.c
Original file line number Diff line number Diff line change
@@ -176,7 +176,7 @@ static esp_err_t esp_crt_bundle_init(const uint8_t *x509_bundle)
return ESP_OK;
}

esp_err_t esp_crt_bundle_attach(void *conf)
esp_err_t arduino_esp_crt_bundle_attach(void *conf)
{
esp_err_t ret = ESP_OK;
// If no bundle has been set by the user then use the bundle embedded in the binary
@@ -199,7 +199,7 @@ esp_err_t esp_crt_bundle_attach(void *conf)
return ret;
}

void esp_crt_bundle_detach(mbedtls_ssl_config *conf)
void arduino_esp_crt_bundle_detach(mbedtls_ssl_config *conf)
{
free(s_crt_bundle.crts);
s_crt_bundle.crts = NULL;
@@ -208,7 +208,7 @@ void esp_crt_bundle_detach(mbedtls_ssl_config *conf)
}
}

void esp_crt_bundle_set(const uint8_t *x509_bundle)
void arduino_esp_crt_bundle_set(const uint8_t *x509_bundle)
{
// Free any previously used bundle
free(s_crt_bundle.crts);
6 changes: 3 additions & 3 deletions libraries/WiFiClientSecure/src/esp_crt_bundle.h
Original file line number Diff line number Diff line change
@@ -36,7 +36,7 @@ extern "C" {
* - ESP_OK if adding certificates was successful.
* - Other if an error occured or an action must be taken by the calling process.
*/
esp_err_t esp_crt_bundle_attach(void *conf);
esp_err_t arduino_esp_crt_bundle_attach(void *conf);


/**
@@ -46,7 +46,7 @@ esp_err_t esp_crt_bundle_attach(void *conf);
*
* @param[in] conf The config struct for the SSL connection.
*/
void esp_crt_bundle_detach(mbedtls_ssl_config *conf);
void arduino_esp_crt_bundle_detach(mbedtls_ssl_config *conf);


/**
@@ -58,7 +58,7 @@ void esp_crt_bundle_detach(mbedtls_ssl_config *conf);
*
* @param[in] x509_bundle A pointer to the certificate bundle.
*/
void esp_crt_bundle_set(const uint8_t *x509_bundle);
void arduino_esp_crt_bundle_set(const uint8_t *x509_bundle);


#ifdef __cplusplus
2 changes: 1 addition & 1 deletion libraries/WiFiClientSecure/src/ssl_client.cpp
Original file line number Diff line number Diff line change
@@ -193,7 +193,7 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
}
} else if (useRootCABundle) {
log_v("Attaching root CA cert bundle");
ret = esp_crt_bundle_attach(&ssl_client->ssl_conf);
ret = arduino_esp_crt_bundle_attach(&ssl_client->ssl_conf);

if (ret < 0) {
return handle_error(ret);