Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@graydon for issue #4709.
The first change (commit 294b4a9) is straightforward. It adds a new
isaac_reseed()
function and uninlinesisaac_seed()
andisaac_init()
.The second change (commit 2ef8a32) is more questionable. It adds a
rust_sched_loop::idle()
function, which is called whenrust_sched_driver::start_main_loop()
has no runnable tasks.idle()
checks whetherrctx
has drained its entropy pool, i.e. generated more than 256 randomuint32_t
s. If not reseeded,rctx
will be stirring the same entropy bits to generate new random numbers.Possible improvements:
idle()
. For example, Schneier and Ferguson's Fortuna PRNG doesn't reseed more often 10 times per second.RANDSIZ
)?This change also adds a fast path to
rust_sched_loop::schedule_task()
when there is only 1 runnable task to avoid depletingtask_rng
's precious entropy.