Module Name:    src
Committed By:   martin
Date:           Mon Jan  3 11:44:03 UTC 2022

Modified Files:
        src/usr.sbin/sysinst: util.c

Log Message:
Now that (semi-)manual entropy setup may happen outside of the main
install/upgrade path, we need to (re-)write the entropy seed file
afterwards - the earlier written one would not have an entropy estimate
if we get here.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/usr.sbin/sysinst/util.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.62 src/usr.sbin/sysinst/util.c:1.63
--- src/usr.sbin/sysinst/util.c:1.62	Fri Oct  8 15:59:55 2021
+++ src/usr.sbin/sysinst/util.c	Mon Jan  3 11:44:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.62 2021/10/08 15:59:55 martin Exp $	*/
+/*	$NetBSD: util.c,v 1.63 2022/01/03 11:44:02 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1353,9 +1353,12 @@ do_add_entropy(void)
 {
 	int rv;
 
+	if (entropy_needed() == 0)
+		return true;
+
 	for (;;) {
 		if (entropy_needed() == 0)
-			return true;
+			break;
 
 		msg_clear();
 		rv = 0;
@@ -1387,6 +1390,15 @@ do_add_entropy(void)
 			}
 		}
 	}
+
+	/*
+	 * Save entropy (maybe again) to give the seed file a good
+	 * entropy estimate.
+	 */
+	run_program(RUN_SILENT | RUN_CHROOT | RUN_ERROR_OK,
+	    "/etc/rc.d/random_seed stop");
+
+	return true;
 }
 #endif
 

Reply via email to