eclipse-threadx / netxduo

Eclipse ThreadX - NetXDuo is an advanced, industrial-grade TCP/IP network stack designed specifically for deeply embedded real-time and IoT applications
https://github.com/eclipse-threadx/rtos-docs/blob/main/rtos-docs/netx-duo/index.md
MIT License
242 stars 137 forks source link

ISSUE : TLS client handshake with PSK #200

Open EdouardMALOT opened 11 months ago

EdouardMALOT commented 11 months ago

I'm trying to connect to an MQTT broker using TLS with a PSK key. Since the device is a client, I first configured the key with the nx_secure_tls_client_psk_set(), but the connection failed.

For this to work, I need to call the nx_secure_tls_psk_add() and the nx_secure_tls_client_pskset() to configure the PSK. (which doesn't seem right to me)_

image

The issue seems to be linked to the _nx_secure_tls_psk_find() function, which is called during the handshake.

image

This function searches for keys in the nx_secure_tls_psk_store[] array, but this array is not filled when nx_secure_tls_client_psk_set() is called. (But it is filled when nx_secure_tls_psk_add() is called).

image

It seems to me that the _nx_secure_tls_psk_find() function should look for the key in "nx_secure_tls_credentials.nx_secure_tls_client_psk.nx_secure_tls_psk_data" when the device make a client handshake :

image