diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-05-26 16:34:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2020-05-26 16:34:42 +0000 |
commit | d8faa36b4a67284892e4e4c6e4f90754f3975741 (patch) | |
tree | a03ff4bdacf1b29f671fb12ffab4d33fdb39aefa /sys/arch/sparc64/stand | |
parent | a9a178b0634d9dda42f352f2aa904bfe64c8ccaa (diff) |
/etc/random.seed reuse can now be detected. The stat +T bit marks the file
(fchmod +T by bootcode, chmod 600 by /etc/rc). If the seed is reused, and
HWRNG isn't available, the kernel won't get RB_GOODSEED indication...
ok kettenis
Diffstat (limited to 'sys/arch/sparc64/stand')
-rw-r--r-- | sys/arch/sparc64/stand/ofwboot/boot.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/boot.c b/sys/arch/sparc64/stand/ofwboot/boot.c index 8357c7652a5..316f8c09c4b 100644 --- a/sys/arch/sparc64/stand/ofwboot/boot.c +++ b/sys/arch/sparc64/stand/ofwboot/boot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: boot.c,v 1.34 2020/05/25 15:49:42 deraadt Exp $ */ +/* $OpenBSD: boot.c,v 1.35 2020/05/26 16:34:41 deraadt Exp $ */ /* $NetBSD: boot.c,v 1.3 2001/05/31 08:55:19 mrg Exp $ */ /* * Copyright (c) 1997, 1999 Eduardo E. Horvath. All rights reserved. @@ -300,6 +300,12 @@ loadrandom(char *path, char *buf, size_t buflen) error = -1; goto done; } + if (sb.st_mode & S_ISTXT) { + printf("NOTE: random seed is being reused.\n"); + error = -1; + goto done; + } + fchmod(fd, sb.st_mode | S_ISTXT); done: close(fd); return (error); |