golioth / golioth-zephyr-sdk

Golioth SDK For Zephyr
https://www.golioth.io
Apache License 2.0
67 stars 19 forks source link

kconfig: add options for maximum PSK-ID and PSK lengths #394

Closed mniestroj closed 1 year ago

mniestroj commented 1 year ago

PSK-ID length was always hardcoded to maximum 64 characters. As a result long project names with long PSK-IDs (due to long-device-id@long-project-name PSK-ID format) would not be supported.

PSK had the same issue, but only when used with NCS.

Introduce options for both, PSK-ID and PSK, so that long credentials can be supported without changing SDK codebase.

Alternative to: #359

github-actions[bot] commented 1 year ago

Visit the preview URL for this PR (updated for commit 9c8a387):

https://golioth-zephyr-sdk-doxygen-dev--pr394-psk-max-len-tih5dwpl.web.app

(expires Thu, 20 Jul 2023 14:51:11 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a389eefadf4b4b68a539327b3459dd66c142cf49

mniestroj commented 1 year ago

FYI: @danyocom

sam-golioth commented 1 year ago

@ChrisGammell ran into the same problem and it took him a while to figure out what the issue was. It looks like it wasn't immediately obvious to @danyocom either. @mniestroj can we also add an error message to the console if the length exceeds the configured value? That way it should be pretty straightforward for users who encounter this issue to determine what caused it and how to fix it.

szczys commented 1 year ago

@mniestroj can we also add an error message to the console if the length exceeds the configured value? That way it should be pretty straightforward for users who encounter this issue to determine what caused it and how to fix it.

I agree with this. I tested a psk-id that was 148 chars long with the limit set to 128. The credential save succeeded without error messages but the device failed to connect.

mniestroj commented 1 year ago

Added a commit with error message, as requested.