-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MQTT Connection with BearSSL and TLS 1.2 results in exception 28 #6232
Comments
The problem looks to be here:
You're passing in stack local variables to the persistent connection. Those variables (cert, client_crt, key) cease to be valid the moment you exit the function, and they're needed later on as part of handshaking so that causes very bad things to happen. Move them to global space and all should be well. |
Thanks for your feedback @earlephilhower.
After this change, I get below errors
OR
Please let me know your inputs on this. |
@earlephilhower, I also tested this on core version 2.5.0 and I get below error
|
@vishalkothari, None of the traces you attached seem to have crashes in BearSSL. It looks like memory corruption somewhere, as you see lots of ROM code in the backtraces. I can't use the MCVE as it's obviously missing a valid keypair (you don't want to publish your AWS keys online!). Are there any public MQTT services you could connect to and report the error with (and share the pub/priv keys and cert)? |
@earlephilhower, Thanks. I tried to run the code against broker test.mosquitto.org with self signed certificates. Surprisingly, it worked well. I switched AWS rootCA from Verisign certificate which is marked as Legacy to new AWS Root CA 1 and regenerated Client cert and keys. This resulted in successful connection. Please note that verisign root CA still works ok with other MQTT clients like MQTT.fx but not from ESP. I am still getting disconnected from AWS every 20 seconds or so. But, since the connection is working fine on test.mosquitto.org, I will close this issue. |
Basic Infos
Platform
Settings in IDE
Problem Description
I am trying to connect to MQTT over TLS 1.2 using BearSSL. I am getting exception 28 when trying to connect.
I tried using web sockets API instead MQTT and it seems to work after some retries with exception 28.
I looked at #5347, and my rootCert seems to be ok as Websocket connection works.
I also looked at #4134, but latest version of umm_malloc doesnt seem to be compatible with ESP core 2.5.2
MCVE Sketch
Debug Messages
OR
OR
Any inputs on this will be very helpful. Thanks.
The text was updated successfully, but these errors were encountered: