Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34
libraries/SocketWrapper: Fix agrs and improve error handling.#238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
iabdalkader commentedOct 30, 2025
- Fix socket timeout arg to use proper struct timeval
- Initialize addrinfo structs to prevent undefined behavior
- Add error checking for tls_credential_add() and setsockopt() calls
- Centralize socket cleanup in error path
- Change default return value to false for safer error handling
| Serial.println("Adding CA certificate..."); | ||
| // Add the ISRG Root X1 CA certificate | ||
| int ret =tls_credential_add(CA_CERTIFICATE_TAG, TLS_CREDENTIAL_CA_CERTIFICATE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would addsetCACert(const char *rootCA) toZephyrSSLClient instead of using directlytls_credential_add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actually,connectSSL(const char *host, uint16_t port, char *ca_certificate_pem = nullptr) already accepts a cert blob, I should just use that instead.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| } | ||
| #if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) | ||
| boolconnectSSL(constchar *host,uint16_t port,char *ca_certificate_pem =nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This should beconst char *ca_certificate_pem together with
int connectSSL(const char *host, uint16_t port, const char *cert) in ZephyrClient.h andint connect(const char *host, uint16_t port, const char *cert) in ZephyrSSLClient.h
or we need to cast the certificate blob
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Fixed. Can you test it again?
- Fix socket timeout arg to use proper struct timeval- Initialize addrinfo structs to prevent undefined behavior- Add error checking for tls_credential_add() and setsockopt() calls- Centralize socket cleanup in error path- Change default return value to false for safer error handling- Change cert args to constSigned-off-by: iabdalkader <i.abdalkader@gmail.com>
Signed-off-by: iabdalkader <i.abdalkader@gmail.com>
pennam commentedNov 5, 2025
works on
PR coming to enable MBEDTLS on GIGA R1 |
6847a9c intoarduino:mainUh oh!
There was an error while loading.Please reload this page.