-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cpu/esp_common: change esp_now key param #17419
base: master
Are you sure you want to change the base?
cpu/esp_common: change esp_now key param #17419
Conversation
7eebff0
to
b163768
Compare
The 128-bit key for encrypted ESP-NOW communication is defined by a 16-byte array of type `uint8_t [16]` specified by the `ESP_NOW_KEY' configuration parameter in RIOT. By default, this configuration parameter is specified as NULL (no encryption). While in C it is possible to simply define this configuration parameter by something like `#define ESP_NOW_KEY { 0x0f, 0x1e, ... }`, it is not possible in Kconfig to define such a static initializer. Therefore, in regard to the migration to Kconfig, the key is now defined as a string with hex values separated by spaces `#define ESP_NOW_KEY "0f 1e ..."`, which is easy to implement in Kconfig.
b163768
to
8ed75af
Compare
I guess we could also handle this like (I also assume this has the same issues wrt. key exchange as IEEE 802.15.4 security - #16844 They could probably use a common upper layer solution) |
But defining it as a string reduces the possible entropy a lot. The solution in this PR would allow to use the value range. OK, it makes the definition a bit more difficult, but not too much. |
Ok, but why the spaces? A hex byte is unambiguous with two characters, no need to separate them with spaces. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you want me to ignore this issue, please mark it with the "State: don't stale" label. Thank you for your contributions. |
I will continue to work on this in next few week. |
Contribution description
This PR changes the way the 128-bit key for encrypted ESP-NOW communication is defined.
The 128-bit key for encrypted ESP-NOW communication is defined by a 16-byte array of type
uint8_t [16]
specified by theESP_NOW_KEY
configuration parameter in RIOT. By default, this configuration parameter is specified asNULL
(no encryption). While it easy to define the key as static initializer in Cit is not possible to define such static initializer in
Kconfig
. Therefore, in regard to the migration to Kconfig, the key is now defined as a string with hex values separated by spaceswhich is easy to implement in Kconfig.
The documentation is updated accordingly as well as fixed and improved a bit.
The PR includes the fix in PR #17420 (commit 87a72e4) which is skipped once PR #17420 is merged and this PR is rebased.
Testing procedure
ENABLE_DEBUG
incpu/esp_common/esp_now_netdev.c
.example/gnrc_networking
for two nodes as follows:Issues/PRs references
Depends on PR #17420