golioth / docs

Creative Commons Attribution Share Alike 4.0 International
6 stars 10 forks source link

64 character PSK: <wrn> golioth_hello: Failed to send hello! #73

Closed ghost closed 2 years ago

ghost commented 2 years ago

The getting started 'hello' example fails when using a 64 character PSK, but succeeds with a 20 character PSK. Suggest updating the docs to include a character limit, or update the software to accept longer PSK text.

I followed the tutorial using an ESP32 and provisioned via command-line per https://docs.golioth.io/services/getting-started/authorize-devices.

I provisioned a device as follows (MAC and name substituted here. These were unique as used). goliothctl provision --hwId "de:ad:be:ef" --name "my-unique-device-name" --credId "de:ad:be:ef-id" --psk "9dzgfAYsV6LUcWHq8pT5ZOddofNigSIEzpSU1lU8JmxjrLIVMc7aL1fua7hEZngb"

When using a 64 character PSK, the device console repeatedly reports <wrn> golioth_hello: Failed to send hello!, and no log or device connection history is visible on the web GUI.

After deleting the device via the GUI and then re-provisioning and building/flashing with a 20 character PSK, the device succeeds in sending hello starting with index 1, and generates logs on the web GUI.

ChrisGammell commented 2 years ago

@mniestroj is this tied to the allotted memory on the ESP32?

mniestroj commented 2 years ago

Problem is related to mbedTLS maximum PSK length (MBEDTLS_PSK_MAX_LEN), which is configured by default to 32. I am working already on providing Kconfig option for that and checking that value at build time.

mniestroj commented 2 years ago

@ghost see https://github.com/golioth/zephyr-sdk/pull/79. It is now possible to increase PSK length with CONFIG_MBEDTLS_PSK_MAX_LEN.

szczys commented 2 years ago

I'm closing this issue since there has been no activity since the proposed fix. Please reopen it if you are still having an issue with the PSK length.