diff options
-rw-r--r-- | sys/arch/octeon/octeon/machdep.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/arch/octeon/octeon/machdep.c b/sys/arch/octeon/octeon/machdep.c index a81815dd265..2359ed888b4 100644 --- a/sys/arch/octeon/octeon/machdep.c +++ b/sys/arch/octeon/octeon/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.119 2019/12/20 13:34:41 visa Exp $ */ +/* $OpenBSD: machdep.c,v 1.120 2020/05/25 12:56:03 visa Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -78,6 +78,7 @@ #include <machine/memconf.h> #include <dev/cons.h> +#include <dev/rndvar.h> #include <dev/ofw/fdt.h> #include <octeon/dev/cn30xxcorereg.h> @@ -249,6 +250,7 @@ mips_init(register_t a0, register_t a1, register_t a2, register_t a3) { uint prid; vaddr_t xtlb_handler; + size_t len; int i; struct boot_desc *boot_desc; struct boot_info *boot_info; @@ -500,6 +502,17 @@ mips_init(register_t a0, register_t a1, register_t a2, register_t a3) panic("cannot run without physical CPU 0"); /* + * Use bits of board information to improve initial entropy. + */ + enqueue_randomness((octeon_boot_info->board_type << 16) | + (octeon_boot_info->board_rev_major << 8) | + octeon_boot_info->board_rev_minor); + len = strnlen(octeon_boot_info->board_serial, + sizeof(octeon_boot_info->board_serial)); + for (i = 0; i < len; i++) + enqueue_randomness(octeon_boot_info->board_serial[i]); + + /* * Init message buffer. */ msgbufbase = (caddr_t)pmap_steal_memory(MSGBUFSIZE, NULL,NULL); |