-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
SSLClient with W5500 not working (works well with WiFi and TinyGSM) #85
Comments
Hi @SunandMittal I have just add an issue template to this repo so we can get all the required information to help solve issues just like this one! Please use the template located here as the basis for adding a comment here. Once I have the extra information I will try to assist you. Cheers. |
The problem is now resolved after adjusting return values in base Client of W5500. Closing this request. |
Hey @SunandMittal Great news. Any chance you could post a short description of what you did and I'll to a READMe.md as a note. You are the second person to mention W5500. |
Within perform_ssl_handshake of library, following workaround has been put: W5500 Client return -1 when there is no data, while mdebtls_ssl_handshake expects MBEDTLS_ERR_SSL_WANT_READ/WRITE.
Similar change is done in data read and send function. Basic functionality worked with this for now. Doing more trials/testing. |
Hey @SunandMittal Have re-opened this as they may be a case for a permanent workaround here. Just leaving some notes: Implication of the Workaround What are the integer equivalents of The integer equivalents of the mbedtls error codes for SSL operations are as follows: The human-readable integer equivalents for the mbedtls error codes are: Detailed Implication
Conclusion Possible code change while ((ret = mbedtls_ssl_handshake(&ssl_client->ssl_ctx)) != 0) {
loopCnt++;
#if defined(_W5500_H_) || defined(W5500_WORKAROUND)
if (ret == -1 && loopCnt < 200) {
continue; // Treat -1 as a non-error for up to 200 iterations
}
#endif
if (ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE) {
break; // Break on any other error
}
} Possible README.md update W5500 Workaround for SSL HandshakeWhen using the W5500 Ethernet module with SSLClient, the perform_ssl_handshake function may fail due to the W5500 client returning -1 when there is no data. To address this, apply the following workaround: Depending on your include order, the workaround may be automatically applied. If not, add the following line before the SSLClient include: #define W5500_WORKAROUND
#include <SSLClient.h> |
We are working on SSLclient library for TLS/SSL layer in Arduino/ESP32. It works very well over WiFi and TinyGSM for both MQTT and HTTP.
But it is failing when W5500 ethernet is used as base client. I am aware of increasing W5500 buffer size (by reducing maximum clients). We tried various combinations but none of them worked. The initial handshake of HTTP/MQTT fails. Same thing works without SSL layer.
Has anyone faced this issue earlier? Any workaround or pointer to look to.
It seems that some data-buffers are insufficient to complete SSL handshake calculations?
Best regards,
Sunand Mittal
The text was updated successfully, but these errors were encountered: