forked from espressif/esp-idf
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d42e1f731 |
@@ -282,9 +282,6 @@ typedef struct esp_tls_cfg_server {
|
|||||||
unsigned int cacert_pem_bytes; /*!< Size of client CA certificate legacy name */
|
unsigned int cacert_pem_bytes; /*!< Size of client CA certificate legacy name */
|
||||||
};
|
};
|
||||||
|
|
||||||
bool cacert_authmode_optional; /*!< Enable this option to set the authmode
|
|
||||||
to OPTIONAL (only useful when cacert is set) */
|
|
||||||
|
|
||||||
union {
|
union {
|
||||||
const unsigned char *servercert_buf; /*!< Server certificate in a buffer
|
const unsigned char *servercert_buf; /*!< Server certificate in a buffer
|
||||||
This buffer should be NULL terminated */
|
This buffer should be NULL terminated */
|
||||||
|
|||||||
@@ -694,8 +694,6 @@ static esp_err_t set_server_config(esp_tls_cfg_server_t *cfg, esp_tls_t *tls)
|
|||||||
if (esp_ret != ESP_OK) {
|
if (esp_ret != ESP_OK) {
|
||||||
return esp_ret;
|
return esp_ret;
|
||||||
}
|
}
|
||||||
if (cfg->cacert_authmode_optional)
|
|
||||||
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL
|
#ifdef CONFIG_ESP_TLS_SERVER_MIN_AUTH_MODE_OPTIONAL
|
||||||
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
|
mbedtls_ssl_conf_authmode(&tls->conf, MBEDTLS_SSL_VERIFY_OPTIONAL);
|
||||||
|
|||||||
@@ -556,6 +556,7 @@ int uart_write_bytes_with_break(uart_port_t uart_num, const void* src, size_t si
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief UART read bytes from UART buffer
|
* @brief UART read bytes from UART buffer
|
||||||
|
* Blocks until the buffer to fill is filled completely or timeout is expired
|
||||||
*
|
*
|
||||||
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
|
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
|
||||||
* @param buf pointer to the buffer.
|
* @param buf pointer to the buffer.
|
||||||
@@ -568,6 +569,21 @@ int uart_write_bytes_with_break(uart_port_t uart_num, const void* src, size_t si
|
|||||||
*/
|
*/
|
||||||
int uart_read_bytes(uart_port_t uart_num, void* buf, uint32_t length, TickType_t ticks_to_wait);
|
int uart_read_bytes(uart_port_t uart_num, void* buf, uint32_t length, TickType_t ticks_to_wait);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief UART read bytes from UART buffer
|
||||||
|
* Blocks until there is at least something to read (might be smaller than length!) or timeout is expired
|
||||||
|
*
|
||||||
|
* @param uart_num UART port number, the max port number is (UART_NUM_MAX -1).
|
||||||
|
* @param buf pointer to the buffer.
|
||||||
|
* @param length data length
|
||||||
|
* @param ticks_to_wait sTimeout, count in RTOS ticks
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* - (-1) Error
|
||||||
|
* - OTHERS (>=0) The number of bytes read from UART buffer
|
||||||
|
*/
|
||||||
|
int uart_read_some_bytes(uart_port_t uart_num, void* buf, uint32_t length, TickType_t ticks_to_wait);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Alias of uart_flush_input.
|
* @brief Alias of uart_flush_input.
|
||||||
* UART ring buffer flush. This will discard all data in the UART RX buffer.
|
* UART ring buffer flush. This will discard all data in the UART RX buffer.
|
||||||
|
|||||||
@@ -1653,6 +1653,34 @@ int uart_read_bytes(uart_port_t uart_num, void *buf, uint32_t length, TickType_t
|
|||||||
return copy_len;
|
return copy_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int uart_read_some_bytes(uart_port_t uart_num, void *buf, uint32_t length, TickType_t ticks_to_wait)
|
||||||
|
{
|
||||||
|
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), (-1), UART_TAG, "uart_num error");
|
||||||
|
ESP_RETURN_ON_FALSE((buf), (-1), UART_TAG, "uart data null");
|
||||||
|
ESP_RETURN_ON_FALSE((p_uart_obj[uart_num]), (-1), UART_TAG, "uart driver error");
|
||||||
|
uint8_t *data = NULL;
|
||||||
|
size_t size = 0;
|
||||||
|
if (xSemaphoreTake(p_uart_obj[uart_num]->rx_mux, (TickType_t)ticks_to_wait) != pdTRUE) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
data = (uint8_t *) xRingbufferReceiveUpTo(p_uart_obj[uart_num]->rx_ring_buf, &size, (TickType_t) ticks_to_wait, length);
|
||||||
|
if (!data) {
|
||||||
|
xSemaphoreGive(p_uart_obj[uart_num]->rx_mux);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memcpy((uint8_t *)buf, data, size);
|
||||||
|
UART_ENTER_CRITICAL(&(uart_context[uart_num].spinlock));
|
||||||
|
p_uart_obj[uart_num]->rx_buffered_len -= size;
|
||||||
|
uart_pattern_queue_update(uart_num, size);
|
||||||
|
UART_EXIT_CRITICAL(&(uart_context[uart_num].spinlock));
|
||||||
|
vRingbufferReturnItem(p_uart_obj[uart_num]->rx_ring_buf, data);
|
||||||
|
uart_check_buf_full(uart_num);
|
||||||
|
|
||||||
|
xSemaphoreGive(p_uart_obj[uart_num]->rx_mux);
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
|
esp_err_t uart_get_buffered_data_len(uart_port_t uart_num, size_t *size)
|
||||||
{
|
{
|
||||||
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
ESP_RETURN_ON_FALSE((uart_num < UART_NUM_MAX), ESP_FAIL, UART_TAG, "uart_num error");
|
||||||
|
|||||||
@@ -91,9 +91,6 @@ struct httpd_ssl_config {
|
|||||||
/** CA certificate byte length */
|
/** CA certificate byte length */
|
||||||
size_t cacert_len;
|
size_t cacert_len;
|
||||||
|
|
||||||
/** CA certificate verification optional */
|
|
||||||
bool cacert_authmode_optional;
|
|
||||||
|
|
||||||
/** Private key */
|
/** Private key */
|
||||||
const uint8_t *prvtkey_pem;
|
const uint8_t *prvtkey_pem;
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ static esp_err_t create_secure_context(const struct httpd_ssl_config *config, ht
|
|||||||
cfg->userdata = config->ssl_userdata;
|
cfg->userdata = config->ssl_userdata;
|
||||||
cfg->alpn_protos = config->alpn_protos;
|
cfg->alpn_protos = config->alpn_protos;
|
||||||
cfg->tls_handshake_timeout_ms = config->tls_handshake_timeout_ms;
|
cfg->tls_handshake_timeout_ms = config->tls_handshake_timeout_ms;
|
||||||
cfg->cacert_authmode_optional = config->cacert_authmode_optional;
|
|
||||||
|
|
||||||
#if defined(CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK)
|
#if defined(CONFIG_ESP_HTTPS_SERVER_CERT_SELECT_HOOK)
|
||||||
cfg->cert_select_cb = config->cert_select_cb;
|
cfg->cert_select_cb = config->cert_select_cb;
|
||||||
|
|||||||
Reference in New Issue
Block a user