1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-27 14:03:43 +03:00

random-seed: use SHA256_DIGEST_SIZE

This commit is contained in:
Lennart Poettering 2022-08-17 11:31:45 +02:00
parent 3c4d5f2ff5
commit 00b4663813

View File

@ -293,7 +293,7 @@ static int run(int argc, char *argv[]) {
* and replace the last 32 bytes of the seed with the hash output, so that the
* new seed file can't regress in entropy. */
if (hashed_old_seed) {
uint8_t hash[32];
uint8_t hash[SHA256_DIGEST_SIZE];
sha256_process_bytes(&k, sizeof(k), &hash_state); /* Hash length to distinguish from old seed. */
sha256_process_bytes(buf, k, &hash_state);
sha256_finish_ctx(&hash_state, hash);