mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-11 05:52:36 +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
|
||||
^ 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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user