Add entropy-harvesting calls.
/dev/random now has new-and-improved entropy!
This commit is contained in:
parent
89ca691934
commit
f0aab2e149
@ -47,6 +47,7 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/cons.h>
|
||||
#include <sys/random.h>
|
||||
|
||||
#include <machine/clock.h>
|
||||
#include <machine/console.h>
|
||||
@ -2955,6 +2956,9 @@ scgetc(sc_softc_t *sc, u_int flags)
|
||||
if (!(c & RELKEY))
|
||||
sc_touch_scrn_saver();
|
||||
|
||||
/* do the /dev/random device a favour */
|
||||
random_harvest((u_int64_t)c, 1, 0, RANDOM_KEYBOARD);
|
||||
|
||||
if (scp->kbd_mode != K_XLATE)
|
||||
return KEYCHAR(c);
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/random.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
@ -333,6 +334,11 @@ sysmouse_event(mouse_info_t *info)
|
||||
sysmouse_tty);
|
||||
}
|
||||
|
||||
/* do the /dev/random device a favour */
|
||||
/* The nasty-looking cast is to force treatment of 8 u_chars */
|
||||
/* in buf as a u_int64_t */
|
||||
random_harvest(*((u_int64_t *)buf), 2, 0, RANDOM_MOUSE);
|
||||
|
||||
return mouse_status.flags;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user