mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-21 10:12:04 +02:00
util/nvmutil: improved entropy in fallback_rand
Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -1036,6 +1036,14 @@ fallback_rand(void)
|
|||||||
^ (unsigned long)&mix
|
^ (unsigned long)&mix
|
||||||
^ counter++;
|
^ counter++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Stack addresses can vary between
|
||||||
|
* calls, thus increasing entropy.
|
||||||
|
*/
|
||||||
|
mix ^= (unsigned long)&mix;
|
||||||
|
mix ^= (unsigned long)&tv;
|
||||||
|
mix ^= (unsigned long)&counter;
|
||||||
|
|
||||||
return (uint16_t)(mix & 0xf);
|
return (uint16_t)(mix & 0xf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user