-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add random to ESP32-S2, fix it on STM32 #3324
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
Conversation
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.
Just a couple questions.
I don't know what the right answer is here, but pseudo-random is fine for many purposes other than cryptographic. Users can also seed with their own entropy. It would be a shame to disable |
Circuitpython's built in |
@anecdata are you using the random module? You should still be able to access pseudorandom numbers without this specific OS feature. I may have mistaken CIRCUITPY_RANDOM for standing in for the TRNG when it was actually a flag for both. If that's the case, once it's re-enabled you'll be able to get pseudorandom values even when TRNG is turned off. |
Sorry, yes, I conflated the two since the |
That was probably my fault, I removed CIRCUITPY_RANDOM because I thought it was the flag for the TRNG only. It must have also disabled the pseudorandom numbers, which I didn't intend. |
Merge conflicts here. Is this otherwise good to go? @tannewt did you have anything further? |
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.
Looks like it's all set.
Doesn't look like I can merge until @tannewt signs off. |
nevermind |
This PR adds the TRNG to ESP32-S2, based off the cxd56 implementation, which has a similar system call. This will enable use of
os.random()
.It also fixes a serious but overlooked issue with the STM32 os.random call where it would not supply values past the first 8 bit number. (Yikes!)