Skip to content

Commit 8925ac5

Browse files
committed
feat(tls): Modify tls component for building
1 parent fbed87b commit 8925ac5

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

components/esp-tls/esp_tls.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ static int esp_tls_low_level_conn(const char *hostname, int hostlen, int port, c
249249
return -1;
250250
}
251251
if (!cfg) {
252-
tls->read = tcp_read;
253-
tls->write = tcp_write;
252+
tls->_read = tcp_read;
253+
tls->_write = tcp_write;
254254
ESP_LOGD(TAG, "non-tls connection established");
255255
return 1;
256256
}
@@ -295,8 +295,8 @@ static int esp_tls_low_level_conn(const char *hostname, int hostlen, int port, c
295295
tls->conn_state = ESP_TLS_FAIL;
296296
return -1;
297297
}
298-
tls->read = _esp_tls_read;
299-
tls->write = _esp_tls_write;
298+
tls->_read = _esp_tls_read;
299+
tls->_write = _esp_tls_write;
300300
tls->conn_state = ESP_TLS_HANDSHAKE;
301301
/* falls through */
302302
case ESP_TLS_HANDSHAKE:

components/esp-tls/esp_tls.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ typedef struct esp_tls {
297297
#endif
298298
int sockfd; /*!< Underlying socket file descriptor. */
299299

300-
ssize_t (*read)(struct esp_tls *tls, char *data, size_t datalen); /*!< Callback function for reading data from TLS/SSL
300+
ssize_t (*_read)(struct esp_tls *tls, char *data, size_t datalen); /*!< Callback function for reading data from TLS/SSL
301301
connection. */
302302

303-
ssize_t (*write)(struct esp_tls *tls, const char *data, size_t datalen); /*!< Callback function for writing data to TLS/SSL
303+
ssize_t (*_write)(struct esp_tls *tls, const char *data, size_t datalen); /*!< Callback function for writing data to TLS/SSL
304304
connection. */
305305

306306
esp_tls_conn_state_t conn_state; /*!< ESP-TLS Connection state */
@@ -442,7 +442,7 @@ int esp_tls_conn_http_new_async(const char *url, const esp_tls_cfg_t *cfg, esp_t
442442
*/
443443
static inline ssize_t esp_tls_conn_write(esp_tls_t *tls, const void *data, size_t datalen)
444444
{
445-
return tls->write(tls, (char *)data, datalen);
445+
return tls->_write(tls, (char *)data, datalen);
446446
}
447447

448448
/**
@@ -462,7 +462,7 @@ static inline ssize_t esp_tls_conn_write(esp_tls_t *tls, const void *data, size_
462462
*/
463463
static inline ssize_t esp_tls_conn_read(esp_tls_t *tls, void *data, size_t datalen)
464464
{
465-
return tls->read(tls, (char *)data, datalen);
465+
return tls->_read(tls, (char *)data, datalen);
466466
}
467467

468468
/**

components/esp-tls/esp_tls_mbedtls.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,8 @@ int esp_mbedtls_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp
489489
tls->conn_state = ESP_TLS_FAIL;
490490
return -1;
491491
}
492-
tls->read = esp_mbedtls_read;
493-
tls->write = esp_mbedtls_write;
492+
tls->_read = esp_mbedtls_read;
493+
tls->_write = esp_mbedtls_write;
494494
int ret;
495495
while ((ret = mbedtls_ssl_handshake(&tls->ssl)) != 0) {
496496
if (ret != ESP_TLS_ERR_SSL_WANT_READ && ret != ESP_TLS_ERR_SSL_WANT_WRITE) {

components/esp-tls/esp_tls_wolfssl.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ static esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls
231231
}
232232

233233
if (!cfg->skip_common_name) {
234+
#ifdef HAVE_SNI
234235
char *use_host = NULL;
235236
if (cfg->common_name != NULL) {
236237
use_host = strdup(cfg->common_name);
@@ -248,6 +249,7 @@ static esp_err_t set_client_config(const char *hostname, size_t hostlen, esp_tls
248249
return ESP_ERR_WOLFSSL_SSL_SET_HOSTNAME_FAILED;
249250
}
250251
free(use_host);
252+
#endif /* HAVE_SNI */
251253
}
252254

253255
if (cfg->alpn_protos) {
@@ -438,8 +440,8 @@ int esp_wolfssl_server_session_create(esp_tls_cfg_server_t *cfg, int sockfd, esp
438440
tls->conn_state = ESP_TLS_FAIL;
439441
return -1;
440442
}
441-
tls->read = esp_wolfssl_read;
442-
tls->write = esp_wolfssl_write;
443+
tls->_read = esp_wolfssl_read;
444+
tls->_write = esp_wolfssl_write;
443445
int ret;
444446
while ((ret = wolfSSL_accept((WOLFSSL *)tls->priv_ssl)) != WOLFSSL_SUCCESS) {
445447
if (ret != ESP_TLS_ERR_SSL_WANT_READ && ret != ESP_TLS_ERR_SSL_WANT_WRITE) {

components/lwip/lwip/src/include/posix/sys/socket.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
#include "sdkconfig.h"
3434

3535
#include "lwip/sockets.h"
36-
36+
#include "freertos/FreeRTOS.h"
37+
#include "freertos/task.h"
3738
#if !LWIP_POSIX_SOCKETS_IO_NAMES
3839
#include <unistd.h>
3940
#include <fcntl.h>

0 commit comments

Comments
 (0)