wolfSSL / wolfMQTT

wolfMQTT is a small, fast, portable MQTT client implementation, including support for TLS 1.3.
https://www.wolfssl.com
GNU General Public License v2.0
528 stars 157 forks source link

Zephyr RTOS: TLS connection fails. #409

Closed BlimbBoat closed 3 hours ago

BlimbBoat commented 4 hours ago

Hi all,

Goal and working status

I am using Zephyr RTOS and would like to use WolfMQTT to communicate to a MQTT broker using TLS v1.3 and MQTT 5. I managed to communicate using MQTTv3.1.1 and without TLS with the broker.

Current situation

Currently I am trying to communicate with TLSv1.2 and MQTTv3.1.1, using mqttclient_test for now. With some minor changes I managed to get to the point that TLS Setup is successful and a Client Hello has been succesfully send and received by the MQTT broker.

While debugging I can see that the code fails at case FINISHED_DONE while trying to process a reply.

My output from my terminal can be seen below (without WOLFSSL_DEBUG as quite some messages are dropped).

MQTT TLS Setup (1)
MQTT TLS Verify Callback for mqttclient: PreVerify 0, Error -150 (no support for error strings built in)
  Subject's domain name is test.com
  Allowing cert anyways
MQTT TLS Verify Callback for mqttclient: PreVerify 0, Error -150 (no support for error strings built in)
  Subject's domain name is TST intermediate
  Allowing cert anyways
MQTT TLS Verify Callback for mqttclient: PreVerify 0, Error -155 (no support for error strings built in)
  Subject's domain name is *.test.com
  Allowing cert anyways
NetRead: Error 116
MQTT Socket Connect: Error (TLS Connect) (-6)

Also attached a Wireshark image. {F3874D2B-B775-4FB7-BD4B-E30B0FF9314A}

Any insight is greatly appreciated. Thanks!

BlimbBoat commented 3 hours ago

Noticed that I was missing the CONFIG_NET_LOG=y. Figured out how to solve the NetRead error by increasing my CONFIG_NET_BUF_DATA_SIZE= 4096.

Still have an issue with the Socket Connect. But have to find some information about it first.

Edit: seems to be -313