From 4fa180975c78aa94e82b11320ca5a7f621bfa272 Mon Sep 17 00:00:00 2001 From: aoyama Date: Sat, 31 Dec 2022 02:42:01 +0000 Subject: [PATCH] Let luna88k's bootloader pass RB_GOODRANDOM to the kernel. Current bootloader can pass boothowto information to the kernel. It also has the capability to load random seed data from /etc/random.seed already. So set RB_GOODRANDOM at the bootloader when loadrandom() has been finished successfully. Now the kernel says "random: good seed from bootblocks". Tested by LUNA-88K2 and nono emulator, "Absolutely!" ok miod@ --- sys/arch/luna88k/stand/boot/boot.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/arch/luna88k/stand/boot/boot.c b/sys/arch/luna88k/stand/boot/boot.c index d6d384b2f0f..71142096733 100644 --- a/sys/arch/luna88k/stand/boot/boot.c +++ b/sys/arch/luna88k/stand/boot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.11 2022/10/14 20:53:18 aoyama Exp $ */ +/* $OpenBSD: boot.c,v 1.12 2022/12/31 02:42:01 aoyama Exp $ */ /* $NetBSD: boot.c,v 1.3 2013/03/05 15:34:53 tsutsui Exp $ */ /* @@ -99,8 +99,8 @@ static int get_boot_device(const char *, int *, int *, int *); void (*cpu_boot)(uint32_t, uint32_t, uint32_t, uint32_t); uint32_t cpu_bootarg1; uint32_t cpu_bootarg2; -uint32_t cpu_bootarg3; -uint32_t cpu_bootarg4; +uint32_t cpu_bootarg3; /* set at devopen() */ +uint32_t cpu_bootarg4 = RB_AUTOBOOT; char rnddata[BOOTRANDOM_MAX]; struct rc4_ctx randomctx; @@ -199,6 +199,8 @@ bootunix(char *line) strlcpy(rndpath, BOOTRANDOM, sizeof rndpath); rnd_loaded = loadrandom(rndpath, rnddata, sizeof(rnddata)); + if (rnd_loaded == 0) + cpu_bootarg4 |= RB_GOODRANDOM; } rc4_keysetup(&randomctx, rnddata, sizeof rnddata); @@ -217,8 +219,6 @@ bootunix(char *line) cpu_bootarg1 = BOOT_MAGIC; cpu_bootarg2 = (uint32_t)marks[MARK_END]; - /* cpu_bootarg3 is set in devopen() */ - cpu_bootarg4 = RB_AUTOBOOT; #ifdef DEBUG printf("bootarg: 0x%08x, 0x%08x, 0x%08x, 0x%08x\n", cpu_bootarg1, cpu_bootarg2, cpu_bootarg3, cpu_bootarg4); -- 2.20.1