golioth / golioth-zephyr-sdk

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

system_client: check mbedTLS PSK length at build time and use it for runtime (config) buffer length #79

Closed mniestroj closed 2 years ago

mniestroj commented 2 years ago

Check PSK length at build time, so user will be notified early about PSK being too big for use with mbedTLS.

So far we are fixed on using mbedTLS, so use configured PSK length as the length of buffer for storing PSK for Golioth.

0Grit commented 2 years ago

Does any documentation need updated as a result?

0Grit commented 2 years ago

I think the way we may end up maintaining docs is for us to keep rough readme's internal to the sdk repository. Then those will be consumed by DevRel and or (Vance + Me) in order to create guides for our documentation site.

mniestroj commented 2 years ago

Does any documentation need updated as a result?

I think that after this PR it is straightforward to figure out why 64 byte PSK will not work, because either user will use Kconfig and there will be build error right away with line of code specified what did not pass, or alternatively there will be error when trying to set too long PSK in which case user can check what is the buffer size.

If anything, I would rather add warning/error message in the second case (configuring PSK via settings subsystem), so that developers with logging enabled will see what is going wrong.