-
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
drivers/at86rf2xx: Switch SRT mode to get random values. #18290
Conversation
a8e7938
to
02e3fad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for PRing a fix. Some nitpicks inline.
Thanks for your suggestions @maribu, I applied your recommendations, this could be reviewed again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK. I tested on the samr21-xpro
and I can confirm that in master
0xff
bytes are returned:
> random
2022-07-02 10:05:56,785 # Random number for device 0 via native API: ffffffff
2022-07-02 10:05:56,789 # Random number for device 0 via netopt: 0
> 2022-07-02 10:05:58,269 # random
2022-07-02 10:05:58,274 # Random number for device 0 via native API: ffffffff
2022-07-02 10:05:58,278 # Random number for device 0 via netopt: 0
> 2022-07-02 10:05:58,893 # random
2022-07-02 10:05:58,898 # Random number for device 0 via native API: ffffffff
2022-07-02 10:05:58,902 # Random number for device 0 via netopt: 0
(the netopt version doesn't change the zero-initialized value as it is not implemented in master
)
but with this PR, the output appear to contain a high level of entropy:
> random
2022-07-02 10:04:52,783 # random
2022-07-02 10:04:52,788 # Random number for device 0 via native API: 2a613db0
2022-07-02 10:04:52,793 # Random number for device 0 via netopt: 38ec93e2
> random
2022-07-02 10:04:55,725 # random
2022-07-02 10:04:55,730 # Random number for device 0 via native API: dda44bc2
2022-07-02 10:04:55,735 # Random number for device 0 via netopt: 452e984d
> random
2022-07-02 10:04:57,700 # random
2022-07-02 10:04:57,705 # Random number for device 0 via native API: dff3f25d
2022-07-02 10:04:57,710 # Random number for device 0 via netopt: ca0be5c9
Thanks for addressing the issue!
25dee0b
to
66fde61
Compare
Hi, I've updated the PR with the new changes required, Thanks @maribu |
66fde61
to
72574f4
Compare
72574f4
to
0de24b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The shell command in the test is making use of the random function even when the driver is not providing, resulting in the remaining compilation errors. But that is quick to fix.
Please squash afterwards :)
Head branch was pushed to by a user without write access
0de24b7
to
e0c82fd
Compare
e0c82fd
to
e6a7039
Compare
Thanks for fixing the issue! |
I'm happy to contribute with RIOT, thanks for the help @maribu |
Contribution description
This Pr is dedicated to resolve the random generation numbers from at86rf233, this should establish the device in a basic operation mode states. also needs to the preamble detector is disabled (RX_PDT_DIS=1). Something else that should be considered is the state of Smart Receiver Technology (SRT), this is an element used to manage the Reception Power Consumption (RPC) and it's affecting the
random_number_generator()
of theat86rf2xx
. Well this Pull request add the functionality to disable temporarily thesmart_idle_mode
because the random number generator needs take values from RSSI register. When the SRT is active could won´t get the wished random values).Also to integrate the number generator by the driver implementation, also let's to manipulate the functionality by network options (
netopts
), adding support in theNETOPT_RANDOM
Testing procedure
run and falsh the test/driver_at86rf_2xx.
When it has loaded the shell type
random
( This is a command added only to the test ).Also try checking resetting the device to be sure that the self value is not repeating.
Issues/PRs references
Fix #18285
You can get more information about the SRT in the samr21-xpro-datasheet in the page 1034, section 40.10.