ruuvi / ruuvi.gateway_esp.c

Ruuvi Gateway ESP32 code
BSD 3-Clause "New" or "Revised" License
24 stars 15 forks source link

[#967] Fix issues related to porting TLS v1.3 from ESP-IDF v5.1.2 #1013

Closed TheSomeMan closed 7 months ago

sonarcloud[bot] commented 7 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

ojousima commented 7 months ago

How much of the code is your original work and how much is ported from some external component? Especially in components/tcp_transport/transport_ssl.c? Is some of the work reasonable to contribute upstream, e.g. null ptr checkif (cfg && cfg->non_block)?

TheSomeMan commented 7 months ago

How much of the code is your original work and how much is ported from some external component? Especially in components/tcp_transport/transport_ssl.c? Is some of the work reasonable to contribute upstream, e.g. null ptr checkif (cfg && cfg->non_block)?

The changes in these components are quite large and it will be quite difficult to contribute them to upstream. As for the if (cfg && cfg->non_block), this part was added by me into esp_tls.c to track timeout expiration in asynchronous mode when establishing a connection. In the original implementation, even in asynchronous mode, execution was blocked for 10 seconds on the select call when establishing a connection, which resulted in task watchdog triggering.

In transport_ssl.c the main changes are as follows:

In esp_tls.c the changes are as follows:

TheSomeMan commented 7 months ago

To test it you need to configure various types of relaying: HTTP/HTTPS, MQTT/MQTTS/WS/WSS and check that it works as expected.

ojousima commented 6 months ago

WS/WSS not tested