[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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user