Commit Graph

75 Commits

Author SHA1 Message Date
Alexey Lapshin 31810ae993 feat(esp_libc): make picolibc default libc 2025-12-03 13:31:42 +07:00
nilesh.kale dedc9889de feat: added config member to store block number for hign part of ecdsa key 2025-08-11 16:01:10 +05:30
nilesh.kale 08e781c876 feat: added new config member to provide ecdsa curve type 2025-08-11 16:01:09 +05:30
hrushikesh.bhosale 5928a87aa7 feat(mbedtls): Add configuration to control dynamic buffer strategy in mbedtls
Problem:
1. In low-memory scenarios, the dynamic buffer feature can fail due to memory fragmentation.
2. It requires a contiguous 16KB heap chunk, but continuous allocation and deallocation of
the RX buffer can lead to fragmentation.
3. If another component allocates memory between these operations, it can break up the
available 16KB block, causing allocation failure.

Solution:
1. Introduce configurable strategy for using dynamic buffers in TLS connections.
2. For example, convert RX buffers to static after the TLS handshake.
3. Allow users to select the strategy via a new field in the esp_http_client_cfg_t structure.
4. The strategy can be controlled independently for each TLS session.
2025-06-05 12:43:47 +05:30
Rocha Euripedes 061c05c88c Merge branch 'contrib/github_pr_15967' into 'master'
fix(tcp_transport): Silence recoverable read failures (GitHub PR)

Closes IDFGH-15309

See merge request espressif/esp-idf!39259
2025-05-20 17:02:17 +08:00
Richard Allen 7f982fa09d fix(tcp_transport): Silence recoverable read failures
In some applications, ESP_TLS_ERR_SSL_WANT_READ and
ESP_TLS_ERR_SSL_TIMEOUT are common results which
need handled at the next layer. Downgrade these
to debug.
2025-05-16 08:37:19 -05:00
dhb 141700ade5 feat(tcp_transport): add API to configure SSL cipher suites
Add new API esp_transport_ssl_set_ciphersuites_list() to allow configuring custom
TLS cipher suites in SSL transport layer. This enables users to:
- Set specific cipher suites for SSL/TLS connections
2025-04-28 16:10:56 +08:00
Xu Si Yu 4be36fdb8b feat(tcp_transport): add an api to configure the addr family 2025-01-16 10:44:33 +08:00
nilesh.kale 5db0c49b8c fix(tcp_tranport): Fix handling of select() return value
When both readset/writeset and errset are set for a single socket,
the HTTP client incorrectly handled the condition, causing premature termination.
Added a check to ensure readset/writeset is prioritized before errset.

Closes https://github.com/espressif/esp-idf/issues/14673
2024-11-27 13:19:13 +05:30
Alexey Lapshin ed6e497c6f feat(build): add COMPILER_STATIC_ANALYZER option 2024-06-18 14:25:37 +08:00
harshal.patil 343a6f47ab fix(mbedtls/aes-gcm): Fix null pointer derefernce coverity reports
- Also fixed a tcp_transport and https_server report
2024-03-12 12:36:00 +05:30
David Cermak 7e22a13afe feat(http_client): Add support for TLS session tickets 2023-11-29 20:48:35 +01:00
Harshit Malpani 27681a5073 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.
2023-10-23 16:23:10 +05:30
Harshit Malpani 692e1a9e61 feat: ECDSA peripheral while performing http connection with mutual auth 2023-09-08 12:22:41 +05:30
Euripedes Rocha d6db90a3cd [tcp_transport] - Adds Socks4 proxy transport
- Basic implementation of Socks4 protocol.
- Introduce basic host testing.
2023-03-27 14:46:40 +02:00
Harshit Malpani 0635dc36c1 tcp_transport: Update tcp_transport to support linux build 2023-01-04 11:17:29 +05:30
David Cermak dc1f6b3aef tcp_transport: Fix error propagation on tcp_read() 2022-11-02 18:43:57 +01:00
Euripedes Rocha 456d6a5d17 [tcp_transport] - Change log level on socket reading timeout
- Log level set to VERBOSE to reduce noise on debug.
2022-09-30 09:59:08 +02:00
Aditya Patwardhan ce32183749 tcp_transport: Add support of setting the common name fot the TLS
context
2022-09-13 05:31:43 +00:00
AndriiFilippov 0013ad5bb9 Replaced logging tags with lower case in tcp_transport component to unite all tags under common structure. 2022-08-16 08:38:57 +00:00
Euripedes Rocha 5778a7c726 [tcp_transport] Fix initialition of transport
- Foundation was initialized only for SSL.
- Removed base from list.
- Changed SSL and TCP initialition.
- Clean of state data structures.
2022-07-14 12:29:58 +00:00
Laukik Hase cc7c67ad4e tcp_transport: Fix error propogation
- Made tcp_transport_errors codes public to indicate
  TCP connection issues not covered in socket's errno
- Added API to translate tcp_transport_error codes
  to esp_err_t codes for TCP Transport

Co-authored-by: Shubham Kulkarni <shubham.kulkarni@espressif.com>
2022-05-31 15:04:21 +05:30
Aditya Patwardhan 434e74ff73 esp_tls: Make esp_tls_t as private structure. 2022-05-11 07:09:34 +00:00
Mahavir Jain e97b034b3e transport_ssl: use return value from close for non-TLS case
Also fix copyright header for this file
2022-02-07 17:17:16 +05:30
Dániel Buga 2ffa82a397 Set success when closing socket
Closes https://github.com/espressif/esp-idf/pull/8337
Closes IDFGH-6709
2022-02-07 17:16:36 +05:30
Axel Lin 9d07e89f13 tcp_transport: Fix NULL pointer dereference in esp_transport_esp_tls_create
Add missing NULL checking to prevent NULL pointer dereference if calloc failed.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
2021-09-08 11:04:08 +08:00
liuhan 37e08d38a4 tls: Modify tls optimize both mbedtls and wolfssl 2021-06-28 10:22:24 +08:00
David Cermak 1a7e75036b tcp_transport: Fix to cleanup esp-tls context on close 2021-06-20 21:21:22 +02:00
David Cermak f68d7d7023 esp_tls: Renamed public API to indicate the Plain TCP connection
Also added parameter checks if used from as a public API
and updated the `is_plein_tcp` description that it's possible to connect
directly using plain tcp transport with the new API.
2021-05-25 10:55:50 +02:00
David Cermak 38fd2ed10b tcp_transport: Rename common tcp/ssl internals to base-transport
Also uses INVALID_SOCKET macro instead of magic number (-1)
2021-05-25 10:55:45 +02:00
David Cermak 6cf077169e tcp_transport: Rework test to split test code and use fixtures 2021-05-25 07:04:02 +02:00
David Cermak f249ddd9ae esp_transport: Use tcp_connect from esp_tls for plain TCP
so we don't have to allocate esp_tls structure (~2KB) to save heap when using plain TCP connection

Closes https://github.com/espressif/esp-idf/issues/6940
2021-05-25 07:04:02 +02:00
Axel Lin aa333d4ab9 tcp_transport: Fix NULL pointer dereference if esp_transport_init returns NULL
Add missing NULL test for esp_transport_init() call.
Otherwise, it will hit NULL pointer dereference when assign t->_get_socket.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
2021-05-03 15:46:59 +08:00
Aditya Patwardhan d74f7d2d04 tcp_transport: Add option to enable crt_bundle for SSL connection 2021-04-07 05:31:21 +00:00
David Cermak 86bcd9fc21 tcp_transport: Fix error handling of esp_tls_init() 2021-03-24 12:24:23 +00:00
yuanjm c62cbd1254 transport: Support bind socket to specified interface in transport and esp-tls 2021-03-10 02:19:29 +00:00
David Cermak 1fa0db8d44 tcp_transport: Allow for using transport independently from list
For compatibility reasons, support also transports separately if the transport is used
before attaching to parent list. In this case we create an internal context which is
independent on the foundation transport and used preferably
2021-02-16 09:01:35 +01:00
David Cermak 6b318fe583 esp_tls: Updated connection method to use non-blocking connect
For better control over connection timeouts
To be in line with former tcp_transport, as esp-tls is not used for
plain tcp transports
2021-02-16 09:00:43 +01:00
David Cermak 2c28ffffee tcp_transport/esp_tls: Use common TCP transport to reduce code duplication
For high level review of the changes.
2021-02-16 09:00:43 +01:00
David Cermak 391d7bf271 tcp_transport: Add TCP transport connection errors
Transport's error_handle is used to capture different types of errors
including esp_err_t from esp-tls and socket/system errors.
This change adds the following error codes for TCP transport:
* connection closed by a FIN flag (clean closure from server)
* DNS resolution problem
* connection timeout
These errors are already defined in esp-tls component and since this
component will be used in the future for both TCP and SSL transport, we
currently report these issues in transport::error_handle::esp_tls_last_error
of standard esp error type (esp_err_t)

Closes https://github.com/espressif/esp-mqtt/issues/182
2021-02-16 09:00:43 +01:00
aditi_lonkar 7bf205162c tcp_transport: Fix some memory leak issues by coverity static analyzer. 2021-01-25 03:37:47 +00:00
yuanjm 044c3e3e74 Modify esp-tls and tcp_transport to support keep alive for tcp and ssl connection
Closes IDFGH-4543
2021-01-22 06:56:28 +00:00
David Cermak ce519ee783 tcp_transport: Extend transport error storage for socket error
Everytime we report error and log errno, we also capture the actual
errno to an internal storage so that user application can retrieve
its value.
2020-11-12 12:46:22 +00:00
Angus Gratton 66fb5a29bb Whitespace: Automated whitespace fixes (large commit)
Apply the pre-commit hook whitespace fixes to all files in the repo.

(Line endings, blank lines at end of file, trailing whitespace)
2020-11-11 07:36:35 +00:00
Aditya Patwardhan 91b88acaec tcp_transport: Added required API to support Digital Signature for SSL 2020-09-22 18:31:31 +05:30
xutao bd2daccb22 transport: fix transport ssl blocking
In SSL mode, if `esp_transport_poll_read` function is used, the cache data in mebdtls will be blocked
2020-09-02 07:01:01 +00:00
David Cermak 5e9f8b52e7 tcp_transport: Added internal API for underlying socket, used for custom select on connection end for WS
Internal tcp_transport functions could now use custom socket operations.
This is used for WebSocket transport, when we typically wait for clean
connection closure, i.e. selecting for read/error with expected errno or
recv size=0 while socket readable (=connection terminated by FIN flag)
2020-08-18 06:42:22 +00:00
Aditya Patwardhan 423e600d46 secure_element: atecc608_ecdsa example
* Replaced crypotoauthlib with esp-cryptoauthlib
* Added menuconfig option for esp-tls about using HSM
* Added error codes for HSM in esp-tls,
* Added support to select different type of ATECC608A chips
* Added README, updated docs
* tcp_transport: Added option to enable secure_element for ssl

Closes https://github.com/espressif/esp-idf/issues/4432
2020-05-21 13:08:30 +05:30
David Cermak 6182e6f303 tcp_transport: close to return error only for socket error or invalid args
Closes https://github.com/espressif/esp-idf/issues/4872
2020-05-05 15:53:09 +02:00
Mahavir Jain 49ce8d3fe5 transport_ssl: reset state on connection closure
For url redirection cases (HTTP status 301/302), internal
transport ssl connection state must be reinitialized for
successful (new) connection on updated url.

Closes https://github.com/espressif/esp-idf/issues/4598
2020-04-15 15:22:32 +05:30