util/nvmutil: improved entropy in fallback_rand

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 14:32:46 +00:00
parent 1cee54ee2b
commit 38c3889f67
+8
View File
@@ -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);
}