Switch dice RNG - #2473
Conversation
|
Build size and comparison to main:
|
|
@mark9064 Could we just use BT chip RNG? InfiniTime/src/components/ble/NimbleController.cpp Lines 288 to 307 in 8d7a04e I think using BT chip's RNG would need very little code and also would provide a good (more secure) randomness. P.S. We could also XOR "in" the existing seeds from |
|
I don't think this complexity is at all required. I think you'll find that this RNG is perfectly fine Seriously, give it a go if you're worried :) Reaching out to hardware opens up the risk of more problems in terms of correctness, performance and error handling |
|
@mark9064 You are right that tightly-coupling Dice app to BT chip is a very counter-intuitive thing and has a potential of causing issues later (especially when adopting to new hardware). The thing that is worrying me when using a simple (non-secure) PRNG in such application is ability to gather enough data to reconstruct the internal state of PRNG (afaik Could it be possible to reinitialize the PRNG on every roll of the Dice app? It would not only prevent a security issue like this, but also have a pretty cool side effect - the Dice app acting more like a physical dice (being affected by how it is shaken, though in a very hard to predict manner). 😎 |
|
I'm not sure how worried we should be about state recovery attacks on a watch dice app. Isn't the goal to have randomly distributed outputs, not randomly distributed and mathematically unpredictable outputs? Like in any situation where the dice app is going to be used, I'm really struggling to think of a case where being able to predict the RNG is a problem I get it's nice to have things theoretically perfect, but it just seems like extra complexity to me |
The mersenne twister uses multiple KBs of state and is not needed for a dice app in terms of RNG quality
When we pick up GCC16, we can switch to
philox4x32This is an alternative to #2385: while I agree that PR is a better RNG than the one here, I don't think it's worth carrying a new dependency / implementation for it