[libc] fix the extension routine that adds entropy to the random pool

Worked for short entropy but actually would end up zeroing out the new
entropy word.
This commit is contained in:
Travis Geiselbrecht
2021-05-26 02:06:16 -07:00
parent 2c28605d0d
commit 08aeb5a6ad

View File

@@ -20,7 +20,8 @@ void rand_add_entropy(const void *buf, size_t len) {
uint32_t enp = 0;
for (size_t i = 0; i < len; i++) {
enp ^= ((enp << 8) | (enp >> 24)) ^ ((const uint8_t *)buf)[i];
uint32_t c = ((const uint8_t *)buf)[i];
enp = ((enp << 8) | (enp >> 24)) ^ c;
}
randseed ^= enp;