fix(esp-tls): Use TLS 1.2 and TLS 1.3 simultaneously

This commit fixes the issue with TLS 1.2 connection when TLS 1.3 is
enabled in config.
This commit is contained in:
Harshit Malpani
2023-10-04 12:19:43 +05:30
parent ff03fd934a
commit 07f2cbeb0c
6 changed files with 72 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2015-2024 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -78,6 +78,16 @@ typedef enum {
HTTP_TRANSPORT_OVER_SSL, /*!< Transport over ssl */
} esp_http_client_transport_t;
/*
* @brief TLS Protocol version
*/
typedef enum {
ESP_HTTP_CLIENT_TLS_VER_ANY = 0, /* No preference */
ESP_HTTP_CLIENT_TLS_VER_TLS_1_2 = 0x1, /* (D)TLS 1.2 */
ESP_HTTP_CLIENT_TLS_VER_TLS_1_3 = 0x2, /* (D)TLS 1.3 */
ESP_HTTP_CLIENT_TLS_VER_MAX, /* to indicate max */
} esp_http_client_proto_ver_t;
typedef esp_err_t (*http_event_handle_cb)(esp_http_client_event_t *evt);
/**
@@ -133,6 +143,7 @@ typedef struct {
size_t client_key_len; /*!< Length of the buffer pointed to by client_key_pem. May be 0 for null-terminated pem */
const char *client_key_password; /*!< Client key decryption password string */
size_t client_key_password_len; /*!< String length of the password pointed to by client_key_password */
esp_http_client_proto_ver_t tls_version; /*!< TLS protocol version of the connection, e.g., TLS 1.2, TLS 1.3 (default - no preference) */
#ifdef CONFIG_MBEDTLS_HARDWARE_ECDSA_SIGN
bool use_ecdsa_peripheral; /*!< Use ECDSA peripheral to use private key. */
uint8_t ecdsa_key_efuse_blk; /*!< The efuse block where ECDSA key is stored. */