Skip to content
Commit 88a2a7e5 authored by Eric Biggers's avatar Eric Biggers
Browse files

EntropyMixer: ensure new seed file is as good as old one

Generate the new seed by hashing the old seed together with some bytes
from /dev/urandom, rather than just using the bytes from /dev/urandom
alone.  This ensures that the new seed doesn't contain less entropy than
the old one, and follows the latest recommended best practices.

While doing this, also clean up various other things:

- Start using AtomicFile to update the seed file so that it won't be
  corrupted if the system crashes while it is being updated.
- Eliminate the RandomBlock class, as it isn't very useful.
- Send all the device-specific information to /dev/urandom in one write.
- Improve comments, variable names, and method names.
- Improve log messages, e.g. don't log a warning on every first boot.
- Improve the unit test.
- Use @VisibleForTesting rather than an ad-hoc comment.

Bug: 226608458
Test: atest EntropyMixerTest
Test: checked for expected log messages
Change-Id: Ief9485536cff50c07d4d920fa32e21dbde6dd245
parent cf13ba50
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment