summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpi.c7
-rw-r--r--sys/dev/rnd.c8
-rw-r--r--sys/dev/rndvar.h4
-rw-r--r--sys/dev/vmt.c4
4 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/acpi/acpi.c b/sys/dev/acpi/acpi.c
index 572faee5807..5129b4ac94b 100644
--- a/sys/dev/acpi/acpi.c
+++ b/sys/dev/acpi/acpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi.c,v 1.282 2015/02/06 05:17:48 mlarkin Exp $ */
+/* $OpenBSD: acpi.c,v 1.283 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -2163,6 +2163,8 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
extern int perflevel;
extern int lid_suspend;
int error = ENXIO;
+ size_t rndbuflen = 0;
+ char *rndbuf = NULL;
int s;
switch (state) {
@@ -2256,6 +2258,7 @@ acpi_sleep_state(struct acpi_softc *sc, int state)
if (state == ACPI_STATE_S4) {
uvm_pmr_dirty_everything();
uvm_pmr_zero_everything();
+ hib_getentropy(&rndbuf, &rndbuflen);
}
#endif /* HIBERNATE */
@@ -2277,7 +2280,7 @@ fail_suspend:
/* 3rd resume AML step: _TTS(runstate) */
aml_node_setval(sc, sc->sc_tts, sc->sc_state);
- resume_randomness(); /* force RNG upper level reseed */
+ resume_randomness(rndbuf, rndbuflen); /* force RNG upper level reseed */
#ifdef MULTIPROCESSOR
acpi_resume_mp();
diff --git a/sys/dev/rnd.c b/sys/dev/rnd.c
index 3605052b0fd..a01e491ad28 100644
--- a/sys/dev/rnd.c
+++ b/sys/dev/rnd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rnd.c,v 1.169 2015/01/27 03:17:35 dlg Exp $ */
+/* $OpenBSD: rnd.c,v 1.170 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 2011 Theo de Raadt.
@@ -246,6 +246,8 @@ int filt_randomread(struct knote *, long);
void filt_randomdetach(struct knote *);
int filt_randomwrite(struct knote *, long);
+static void _rs_seed(u_char *, size_t);
+
struct filterops randomread_filtops =
{ 1, NULL, filt_randomdetach, filt_randomread };
struct filterops randomwrite_filtops =
@@ -560,10 +562,12 @@ suspend_randomness(void)
}
void
-resume_randomness(void)
+resume_randomness(char *buf, size_t buflen)
{
struct timespec ts;
+ if (buf && buflen)
+ _rs_seed(buf, sizeof(buf));
getnanotime(&ts);
add_true_randomness(ts.tv_sec);
add_true_randomness(ts.tv_nsec);
diff --git a/sys/dev/rndvar.h b/sys/dev/rndvar.h
index 8f68e2afe15..024115491d7 100644
--- a/sys/dev/rndvar.h
+++ b/sys/dev/rndvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rndvar.h,v 1.35 2014/12/18 16:27:30 deraadt Exp $ */
+/* $OpenBSD: rndvar.h,v 1.36 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 1996,2000 Michael Shalayeff.
@@ -73,7 +73,7 @@ void random_start(void);
void enqueue_randomness(int, int);
void suspend_randomness(void);
-void resume_randomness(void);
+void resume_randomness(char *, size_t);
#endif /* _KERNEL */
diff --git a/sys/dev/vmt.c b/sys/dev/vmt.c
index 7753b4fe78a..dc4f0eaadd0 100644
--- a/sys/dev/vmt.c
+++ b/sys/dev/vmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmt.c,v 1.27 2014/12/20 11:27:18 reyk Exp $ */
+/* $OpenBSD: vmt.c,v 1.28 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 2007 David Crawshaw <david@zentus.com>
@@ -387,7 +387,7 @@ vmt_resume(void)
add_true_randomness(frame.esi.word);
add_true_randomness(frame.edx.word);
add_true_randomness(frame.ebx.word);
- resume_randomness();
+ resume_randomness(NULL, 0);
}
int