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: do not choke on bad en...
details: https://anonhg.NetBSD.org/src/rev/e3bd3af0238b
branches: trunk
changeset: 1021053:e3bd3af0238b
user: khorben <khorben%NetBSD.org@localhost>
date: Tue May 04 21:10:25 2021 +0000
description:
prekern: do not choke on bad entropy files
As submitted on port-amd64@ (part 2/3)
Tested on NetBSD/amd64.
diffstat:
sys/arch/amd64/stand/prekern/prng.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diffs (31 lines):
diff -r 941c5be8a890 -r e3bd3af0238b sys/arch/amd64/stand/prekern/prng.c
--- a/sys/arch/amd64/stand/prekern/prng.c Tue May 04 21:09:16 2021 +0000
+++ b/sys/arch/amd64/stand/prekern/prng.c Tue May 04 21:10:25 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: prng.c,v 1.3 2020/05/21 08:20:25 maxv Exp $ */
+/* $NetBSD: prng.c,v 1.4 2021/05/04 21:10:25 khorben Exp $ */
/*
* Copyright (c) 2017-2020 The NetBSD Foundation, Inc. All rights reserved.
@@ -98,7 +98,9 @@
continue;
}
if (bi->len != sizeof(rndsave_t)) {
- fatal("rndsave_t size mismatch");
+ print_state(STATE_WARNING,
+ "size mismatch in entropy file");
+ continue;
}
rndsave = (rndsave_t *)(vaddr_t)bi->base;
@@ -109,7 +111,9 @@
SHA1Update(&sig, rndsave->data, sizeof(rndsave->data));
SHA1Final(digest, &sig);
if (memcmp(digest, rndsave->digest, sizeof(digest))) {
- fatal("bad SHA1 checksum");
+ print_state(STATE_WARNING,
+ "bad SHA1 checksum in entropy file");
+ continue;
}
SHA512_Update(ctx, rndsave->data, sizeof(rndsave->data));
Home |
Main Index |
Thread Index |
Old Index