Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/random/random_harvestq.c
Show First 20 Lines • Show All 290 Lines • ▼ Show 20 Lines | for (i = 0; i < npools; i++) { | ||||
* ready for us. This isn't necessarily untrustworthy. | * ready for us. This isn't necessarily untrustworthy. | ||||
* We don't perform any other verification of an entropy | * We don't perform any other verification of an entropy | ||||
* source (i.e., length is allowed to be anywhere from 1 | * source (i.e., length is allowed to be anywhere from 1 | ||||
* to sizeof(entropy), quality is unchecked, etc), so | * to sizeof(entropy), quality is unchecked, etc), so | ||||
* don't balk verbosely at slow random sources either. | * don't balk verbosely at slow random sources either. | ||||
* There are reports that RDSEED on x86 metal falls | * There are reports that RDSEED on x86 metal falls | ||||
* behind the rate at which we query it, for example. | * behind the rate at which we query it, for example. | ||||
* But it's still a better entropy source than RDRAND. | * But it's still a better entropy source than RDRAND. | ||||
* | |||||
* If it does, just wait till the next time we poll. | |||||
*/ | */ | ||||
if (n == 0) | if (n == 0) | ||||
continue; | break; | ||||
markm: This may result in the lower-numbered pools being favoured, which is undesirable. All pools… | |||||
random_harvest_direct(entropy, n, rrs->rrs_source->rs_source); | random_harvest_direct(entropy, n, rrs->rrs_source->rs_source); | ||||
} | } | ||||
} | } | ||||
if (rse_warm) | if (rse_warm) | ||||
epoch_exit_preempt(rs_epoch, &et); | epoch_exit_preempt(rs_epoch, &et); | ||||
explicit_bzero(entropy, sizeof(entropy)); | explicit_bzero(entropy, sizeof(entropy)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 392 Lines • Show Last 20 Lines |
This may result in the lower-numbered pools being favoured, which is undesirable. All pools need an equal chance at this entropy. A fix may be to make i static, and simply increment it mod(npools), with the loop terminating at the point where it wraps.