Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/amd64/stand/prekern prekern: add warnings upon prob...
details: https://anonhg.NetBSD.org/src/rev/0281b84ecb63
branches: trunk
changeset: 983133:0281b84ecb63
user: khorben <khorben%NetBSD.org@localhost>
date: Tue May 04 21:13:38 2021 +0000
description:
prekern: add warnings upon problems collecting entropy
As submitted on port-amd64@ (part 3/3)
Tested on NetBSD/amd64.
diffstat:
sys/arch/amd64/stand/prekern/prng.c | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diffs (37 lines):
diff -r 66d4d2811cec -r 0281b84ecb63 sys/arch/amd64/stand/prekern/prng.c
--- a/sys/arch/amd64/stand/prekern/prng.c Tue May 04 21:10:25 2021 +0000
+++ b/sys/arch/amd64/stand/prekern/prng.c Tue May 04 21:13:38 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prng.c,v 1.4 2021/05/04 21:10:25 khorben Exp $ */
+/* $NetBSD: prng.c,v 1.5 2021/05/04 21:13:38 khorben Exp $ */
/*
* Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -84,6 +84,7 @@
uint8_t digest[SHA1_DIGEST_LENGTH];
rndsave_t *rndsave;
SHA1_CTX sig;
+ size_t count = 0;
biml =
(struct btinfo_modulelist *)prng_lookup_bootinfo(BTINFO_MODULELIST);
@@ -117,7 +118,10 @@
}
SHA512_Update(ctx, rndsave->data, sizeof(rndsave->data));
+ count++;
}
+ if (count == 0)
+ print_state(STATE_WARNING, "No entropy file could be loaded");
}
/*
@@ -168,6 +172,8 @@
cpuid(0x01, 0x00, descs);
has_rdrand = (descs[2] & CPUID2_RDRAND) != 0;
}
+ if (!has_rdseed && !has_rdrand)
+ print_state(STATE_WARNING, "No CPU entropy feature detected");
SHA512_Init(&ctx);
prng_get_entropy_file(&ctx);
Home |
Main Index |
Thread Index |
Old Index