esp-tls-mbedtls: mbedtls_ssl_setup returned -0x7F00
Posted: Mon Nov 28, 2022 10:20 am
Hi,
I am trying to build https communication alongwith an I2C based RTC. I have integrated custom .pem files for SSL certificate verification. When the sensor is plugged out on I2C driver, the SSL communication works fine and data is transmitted successfuly to the server.
I am getting below errors when I connect the sensor on I2C port. I tried to change the SDA and SCL pins, but the issue remains the same. I earched for this issue on different forums but could not get even a single clue.
The errors are
I have configured the HTTPs as below.
Any help would be much appreciated.
I am trying to build https communication alongwith an I2C based RTC. I have integrated custom .pem files for SSL certificate verification. When the sensor is plugged out on I2C driver, the SSL communication works fine and data is transmitted successfuly to the server.
I am getting below errors when I connect the sensor on I2C port. I tried to change the SDA and SCL pins, but the issue remains the same. I earched for this issue on different forums but could not get even a single clue.
The errors are
Code: Select all
W (93495) HTTP_CLIENT: Setting https configs.
W (93505) HTTP_CLIENT: Setting config->use_global_ca_store.
E (93555) esp-tls-mbedtls: mbedtls_ssl_setup returned -0x7F00
E (93555) esp-tls: create_ssl_handle failed
E (93555) esp-tls: Failed to open new connection
E (93565) TRANSPORT_BASE: Failed to open a new connection
E (93575) HTTP_CLIENT: Connection failed, sock < 0
I (93575) DataUploadClient: HTTP_EVENT_ERROR
E (93585) DataUploadClient: Error perform http request ESP_ERR_HTTP_CONNECT
I (93585) DataUploadClient: HTTP_EVENT_DISCONNECTED
Code: Select all
esp_http_client_config_t config = {
.url = host_url.c_str(),
.port = DEFAULT_SSL_PORT,
.cert_pem = (const char *)tls_certificate_bundle,
.cert_len = tls_certificate_bundle_size,
.method = HTTP_METHOD_POST,
.event_handler = _http_event_handler,
.transport_type = HTTP_TRANSPORT_OVER_SSL,
.use_global_ca_store = true,
};
esp_http_client_handle_t client = esp_http_client_init(&config);
esp_http_client_set_header(client, "content-type", "application/x-protobuf");
esp_http_client_set_post_field(client, post_data.c_str(), post_data.size());
esp_err_t err;
do
{
err = esp_http_client_perform(client);
} while (err == ESP_ERR_HTTP_EAGAIN);
if (err == ESP_OK)
{
ESP_LOGI(TAG, "HTTPS Status = %d, content_length = %d",
esp_http_client_get_status_code(client),
esp_http_client_get_content_length(client));
}
else
{
ESP_LOGE(TAG, "Error perform http request %s", esp_err_to_name(err));
}
esp_http_client_cleanup(client);