summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkettenis <kettenis@openbsd.org>2018-04-08 13:24:36 +0000
committerkettenis <kettenis@openbsd.org>2018-04-08 13:24:36 +0000
commitd975447ccae4114c8837c6b794f3e6b51f8ad53b (patch)
tree8fc390ceef2aec8485d21588715cf2e406d733d7
parenttweak previous; (diff)
downloadwireguard-openbsd-d975447ccae4114c8837c6b794f3e6b51f8ad53b.tar.xz
wireguard-openbsd-d975447ccae4114c8837c6b794f3e6b51f8ad53b.zip
Add a hook to use a firmware-supplied random function in addition to the
MD-supplied random function to insert entropy into the kernel. ok deraadt@
-rw-r--r--sys/stand/boot/boot.c5
-rw-r--r--sys/stand/boot/bootarg.h5
2 files changed, 7 insertions, 3 deletions
diff --git a/sys/stand/boot/boot.c b/sys/stand/boot/boot.c
index fc8b0fc3095..39228d8a696 100644
--- a/sys/stand/boot/boot.c
+++ b/sys/stand/boot/boot.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: boot.c,v 1.44 2017/06/19 22:50:50 deraadt Exp $ */
+/* $OpenBSD: boot.c,v 1.45 2018/04/08 13:24:36 kettenis Exp $ */
/*
* Copyright (c) 2003 Dale Rahn
@@ -103,6 +103,9 @@ boot(dev_t bootdev)
#ifdef MDRANDOM
mdrandom(rnddata, sizeof(rnddata));
#endif
+#ifdef FWRANDOM
+ fwrandom(rnddata, sizeof(rnddata));
+#endif
st = 0;
bootprompt = 1; /* allow reselect should we fail */
diff --git a/sys/stand/boot/bootarg.h b/sys/stand/boot/bootarg.h
index 129fd5e1d5e..02f6f3f339a 100644
--- a/sys/stand/boot/bootarg.h
+++ b/sys/stand/boot/bootarg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bootarg.h,v 1.14 2015/09/02 01:52:26 yasuoka Exp $ */
+/* $OpenBSD: bootarg.h,v 1.15 2018/04/08 13:24:36 kettenis Exp $ */
/*
* Copyright (c) 1996-1999 Michael Shalayeff
@@ -50,7 +50,8 @@ extern bootarg_t *bootargp;
#endif
void loadrandom(char *name, char *buf, size_t buflen);
-int mdrandom(char *buf, size_t buflen);
+void mdrandom(char *buf, size_t buflen);
+void fwrandom(char *buf, size_t buflen);
#ifdef _STANDALONE
void addbootarg(int, size_t, void *);