summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/apm.c4
-rw-r--r--sys/arch/loongson/dev/apm.c4
-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
-rw-r--r--sys/kern/subr_hibernate.c8
-rw-r--r--sys/sys/hibernate.h3
8 files changed, 28 insertions, 14 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index ff4454a8f5f..c6b8a21d9d3 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.112 2014/12/18 17:02:35 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.113 2015/02/07 01:19:40 deraadt Exp $ */
/*-
* Copyright (c) 1998-2001 Michael Shalayeff. All rights reserved.
@@ -278,7 +278,7 @@ apm_suspend(int state)
enable_intr();
splx(s);
- resume_randomness(); /* force RNG upper level reseed */
+ resume_randomness(NULL, 0); /* force RNG upper level reseed */
bufq_restart();
config_suspend_all(DVACT_WAKEUP);
diff --git a/sys/arch/loongson/dev/apm.c b/sys/arch/loongson/dev/apm.c
index 149e22b72b4..f04599fcc98 100644
--- a/sys/arch/loongson/dev/apm.c
+++ b/sys/arch/loongson/dev/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.27 2014/12/19 14:15:50 deraadt Exp $ */
+/* $OpenBSD: apm.c,v 1.28 2015/02/07 01:19:40 deraadt Exp $ */
/*-
* Copyright (c) 2001 Alexander Guy. All rights reserved.
@@ -418,7 +418,7 @@ apm_suspend(int state)
(void)enableintr();
splx(s);
- resume_randomness(); /* force RNG upper level reseed */
+ resume_randomness(NULL, 0); /* force RNG upper level reseed */
bufq_restart();
config_suspend_all(DVACT_WAKEUP);
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
diff --git a/sys/kern/subr_hibernate.c b/sys/kern/subr_hibernate.c
index fe9bf799a38..8ea0c5c0985 100644
--- a/sys/kern/subr_hibernate.c
+++ b/sys/kern/subr_hibernate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_hibernate.c,v 1.113 2015/02/06 05:17:48 mlarkin Exp $ */
+/* $OpenBSD: subr_hibernate.c,v 1.114 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -249,6 +249,12 @@ hib_alloc(struct hiballoc_arena *arena, size_t alloc_sz)
return hib_entry_to_addr(new_entry);
}
+void
+hib_getentropy(char **bufp, size_t *bufplen)
+{
+ /* fill in */
+}
+
/*
* Free a pointer previously allocated from this arena.
*
diff --git a/sys/sys/hibernate.h b/sys/sys/hibernate.h
index a5da16e91be..318dd4df7fb 100644
--- a/sys/sys/hibernate.h
+++ b/sys/sys/hibernate.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: hibernate.h,v 1.38 2014/10/09 00:42:05 mlarkin Exp $ */
+/* $OpenBSD: hibernate.h,v 1.39 2015/02/07 01:19:40 deraadt Exp $ */
/*
* Copyright (c) 2011 Ariane van der Steldt <ariane@stack.nl>
@@ -144,6 +144,7 @@ void hibernate_unpack_image(union hibernate_info *);
void hibernate_populate_resume_pt(union hibernate_info *, paddr_t, paddr_t);
int hibernate_alloc(void);
void hibernate_free(void);
+void hib_getentropy(char **, size_t *);
void hibernate_sort_ranges(union hibernate_info *);
void hibernate_suspend_bufcache(void);