-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[zephyr] Added random module seed initialization. #8989
[zephyr] Added random module seed initialization. #8989
Conversation
It seems that currently random module seed for Zephyr platform is not properly initialized, as on every boot rand methods return the same values. Added getting entropy source and initializing srand seed with it.
Size increase report for "nrfconnect-example-build" from 1c1e161
Full report output
|
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.
This is OK as far as it goes, but do other platforms ever call srand
? As in, is this a Zephyr bug, or is it a cross-platform bug to do with the (mis?)use of RandUtils
to generate things?
I filed #9017 to track figuring out what should be going on here.
@bzbarsky-apple I don't know the status of other platforms. I haven't seen other problems reported regarding that, so I assumed that it's a Zephyr platform bug. But you might be right that it's something wider, so thanks for creating an issue. |
It seems that currently random module seed for Zephyr platform is not properly initialized, as on every boot rand methods return the same values. Added getting entropy source and initializing srand seed with it.
Problem
It seems that currently random module seed for Zephyr platform is not properly initialized, as on every boot rand methods return
the same values.
Change overview
Added getting entropy source and initializing srand seed with it.
Testing
Small change, verified manually that
GetRandU64()
method used for generating commissionable advertising service instance name returns pseudo-random value on every attempt.Fixes: #8931