? INSTALL ? Makefile.in ? aclocal.m4 ? autom4te.cache ? build ? build-aux ? config.h.in ? configure ? entropy_patch.diff ? device/entropy.c ? device/entropy.h ? doc/mach.info ? doc/mach.info-1 ? doc/mach.info-2 ? doc/stamp-vti ? doc/version.texi Index: Makefrag.am =================================================================== RCS file: /sources/hurd/gnumach/Attic/Makefrag.am,v retrieving revision 1.1.2.12 diff -u -r1.1.2.12 Makefrag.am --- Makefrag.am 2 Jun 2007 13:23:21 -0000 1.1.2.12 +++ Makefrag.am 12 Aug 2007 06:35:59 -0000 @@ -292,6 +292,14 @@ device/kmsg.h endif +# +# kernel entrophy generator device + +if enable_entropy +libkernel_a_SOURCES += \ + device/entropy.c + device/entropy.h +endif # # Version number. Index: configfrag.ac =================================================================== RCS file: /sources/hurd/gnumach/Attic/configfrag.ac,v retrieving revision 1.1.2.7 diff -u -r1.1.2.7 configfrag.ac --- configfrag.ac 4 Aug 2007 18:50:19 -0000 1.1.2.7 +++ configfrag.ac 12 Aug 2007 06:35:59 -0000 @@ -129,10 +129,21 @@ AM_CONDITIONAL([enable_kmsg], [false]) [fi] + +AC_ARG_ENABLE([entropy], + AS_HELP_STRING([--disable-entropy], [disable use of entropy device])) +[if [ x"$enable_entropy" != xno ]; then] + AC_DEFINE([MACH_ENTROPY], [], [enable use of entropy device]) + AM_CONDITIONAL([enable_entropy], [true]) +[else] + AM_CONDITIONAL([enable_entropy], [false]) +[fi] + + # # Set up `SYSTYPE/SYSTYPE' and `SYSTYPE/include/mach/SYSTYPE' links. # - + # `${file}' and `$file' have different meanings here with respect to having the # files in the referenced directory considered for `make dist' or not. See # . Index: device/blkio.c =================================================================== RCS file: /sources/hurd/gnumach/device/Attic/blkio.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 blkio.c --- device/blkio.c 25 Feb 1997 21:28:13 -0000 1.1.1.1 +++ device/blkio.c 12 Aug 2007 06:35:59 -0000 @@ -36,7 +36,9 @@ #include #include - +#ifdef MACH_ENTROPY +#include +#endif io_return_t block_io(strat, max_count, ior) void (*strat)(); @@ -149,6 +151,10 @@ do { prev = next; next = prev->io_next; +#ifdef MACH_ENTROPY + /* Let's grab the cylinder numbers for entropy. */ + entropy_putdata (prev, sizeof(io_req_t), ENTROPY_HIGH_QUALITY); +#endif } while (next != 0 && prev->io_cylinder == next->io_cylinder); if (next == 0) { Index: device/cons.c =================================================================== RCS file: /sources/hurd/gnumach/device/Attic/cons.c,v retrieving revision 1.2.4.6 diff -u -r1.2.4.6 cons.c --- device/cons.c 13 Nov 2006 21:30:36 -0000 1.2.4.6 +++ device/cons.c 12 Aug 2007 06:35:59 -0000 @@ -44,6 +44,10 @@ #include #endif +#ifdef MACH_ENTROPY +#include +#endif + static int cn_inited = 0; static struct consdev *cn_tab = 0; /* physical console device info */ #ifndef MACH_KERNEL @@ -230,9 +234,19 @@ cngetc() { if (cn_tab) - return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1)); - if (romgetc) - return ((*romgetc)(1)); + { +#if defined(MACH_KERNEL) && defined(MACH_ENTROPY) + entropy_putchar (cn_tab->cn_dev, ENTROPY_MEDIUM_QUALITY); +#endif /* MACH_ENTROPY and MACH_ENTROPY */ + return ((*cn_tab->cn_getc)(cn_tab->cn_dev, 1)); + } + if (romgetc) + { +#if defined (MACH_KERNEL) && defined(MACH_ENTROPY) + entropy_putchar(*romgetc, ENTROPY_MEDIUM_QUALITY); +#endif /* MACH_KERNEL && MACH_ENTROPY */ + return ((*romgetc)(1)); + } return (0); } Index: i386/i386at/conf.c =================================================================== RCS file: /sources/hurd/gnumach/i386/i386at/Attic/conf.c,v retrieving revision 1.4.2.15 diff -u -r1.4.2.15 conf.c --- i386/i386at/conf.c 1 Apr 2007 22:10:40 -0000 1.4.2.15 +++ i386/i386at/conf.c 12 Aug 2007 06:35:59 -0000 @@ -61,6 +61,11 @@ extern int kmsgopen(), kmsgclose(), kmsgread(), kmsggetstat(); #define kmsgname "kmsg" +#ifdef MACH_ENTROPY +#define entropyname "entropy" +extern int entropyopen(), entropyclose(), entropyread(), entropygetstat(); +#endif + /* * List of devices - console must be at slot 0 */ @@ -120,6 +125,12 @@ nodev }, #endif +#ifdef MACH_ENTROPY + { entropyname, entropyopen, entropyclose, entropyread, + nodev, entropygetstat, nodev, nomap, + nodev, nulldev, nulldev, 0, + nodev }, +#endif }; int dev_name_count = sizeof(dev_name_list)/sizeof(dev_name_list[0]); Index: i386/i386at/kd.c =================================================================== RCS file: /sources/hurd/gnumach/i386/i386at/Attic/kd.c,v retrieving revision 1.5.2.13 diff -u -r1.5.2.13 kd.c --- i386/i386at/kd.c 7 May 2007 22:04:53 -0000 1.5.2.13 +++ i386/i386at/kd.c 12 Aug 2007 06:36:00 -0000 @@ -85,6 +85,11 @@ #include #include /* for struct uio (!) */ #include + +#if defined (MACH_KERNEL) && defined(MACH_ENTROPY) +#include +#endif /* MACH_KERNEL and MACH _ENTROPY */ + #include #include #include @@ -811,6 +816,16 @@ up = TRUE; scancode &= ~K_UP; } + +#ifdef MACH_KERNEL +#ifdef MACH_ENTROPY + /* Sune Kirkeby's entropy patch (which was a port of the + linux entropy drivers for GNU mach) placed the keyboard + entropy source here. I looked at that for an idea of where + how to do write this driver. */ + entropy_putchar(scancode | (up ? 0200 : 0), ENTROPY_LOW_QUALITY); +#endif /* MACH_ENTROPY */ +#endif /* MACH_KERNEL */ if (scancode < NUMKEYS) { /* Lookup in map, then process. */ char_idx = kdstate2idx(kd_state, kd_extended); Index: i386/i386at/kd_mouse.c =================================================================== RCS file: /sources/hurd/gnumach/i386/i386at/Attic/kd_mouse.c,v retrieving revision 1.3.2.8 diff -u -r1.3.2.8 kd_mouse.c --- i386/i386at/kd_mouse.c 13 Nov 2006 21:30:36 -0000 1.3.2.8 +++ i386/i386at/kd_mouse.c 12 Aug 2007 06:36:00 -0000 @@ -70,6 +70,9 @@ #ifdef MACH_KERNEL #include #include +#ifdef MACH_ENTROPY +#include +#endif /* MACH_ENTROPY */ #else /* MACH_KERNEL */ #include #include @@ -677,6 +680,11 @@ moved.mm_deltaX = (char)mousebuf[1] + (char)mousebuf[3]; moved.mm_deltaY = (char)mousebuf[2] + (char)mousebuf[4]; +#ifdef MACH_ENTROPY + /* Kick some mouse data to the entropy driver. */ + entropy_putchar((buttonchanges + moved.mm_deltaX + + moved.mm_deltaY), ENTROPY_HIGH_QUALITY); +#endif if (moved.mm_deltaX != 0 || moved.mm_deltaY != 0) mouse_moved(moved); Index: linux/configfrag.ac =================================================================== RCS file: /sources/hurd/gnumach/linux/Attic/configfrag.ac,v retrieving revision 1.1.2.6 diff -u -r1.1.2.6 configfrag.ac --- linux/configfrag.ac 4 Aug 2007 18:50:19 -0000 1.1.2.6 +++ linux/configfrag.ac 12 Aug 2007 06:36:00 -0000 @@ -605,6 +605,15 @@ [else] AM_CONDITIONAL([CODE_linux], [false]) [fi] +AC_ARG_ENABLE([entropy], + AS_HELP_STRING([--disable-entropy], [disable use of entropy device])) + [if [ x"$enable_entropy" != xno ]; then] + AC_DEFINE([MACH_ENTROPY], [], [enable use of entropy device]) + AM_CONDITIONAL([enable_entropy], [true]) + [else] + AM_CONDITIONAL([enable_entropy], [false]) +[fi] + dnl Local Variables: dnl mode: autoconf dnl End: Index: linux/dev/glue/misc.c =================================================================== RCS file: /sources/hurd/gnumach/linux/dev/glue/Attic/misc.c,v retrieving revision 1.2 diff -u -r1.2 misc.c --- linux/dev/glue/misc.c 18 Sep 2001 21:14:19 -0000 1.2 +++ linux/dev/glue/misc.c 12 Aug 2007 06:36:00 -0000 @@ -67,6 +67,10 @@ #include #include +#ifdef MACH_ENTROPY +#include +#endif + extern boolean_t vm_map_lookup_entry (register vm_map_t, register vm_offset_t, vm_map_entry_t *); extern int printf (const char *, ...); @@ -224,6 +228,15 @@ void add_blkdev_randomness (int major) { +#ifdef MACH_ENTROPY + /* This is useless for good quality, so we'll only use if it nothing + else is available - The problem is that mach only has 1 block + device, floppy (major 3 corresponds to Ctrl C) so this is useless + for entropic sources. If we ever get more block devices the + quality should be upped for additional entropy. */ + + entropy_putchar(major, ENTROPY_POOR_QUALITY); +#endif } void Index: linux/dev/glue/net.c =================================================================== RCS file: /sources/hurd/gnumach/linux/dev/glue/Attic/net.c,v retrieving revision 1.1.4.7 diff -u -r1.1.4.7 net.c --- linux/dev/glue/net.c 27 Mar 2007 22:47:11 -0000 1.1.4.7 +++ linux/dev/glue/net.c 12 Aug 2007 06:36:00 -0000 @@ -97,6 +97,11 @@ #include #include +#ifdef MACH_KERNEL +#ifdef MACH_ENTROPY +#include +#endif /* MACH_KERNEL */ +#endif /* MACH_ENTROPY */ extern int linux_intr_pri; /* One of these is associated with each instance of a device. */ @@ -299,6 +304,11 @@ ph->length = (skb->len - sizeof (struct ether_header) + sizeof (struct packet_header)); +#ifdef MACH_ENTROPY + /* Grab the packet for entropy purposes. */ + entropy_putdata(ph + 1, skb->len - sizeof(struct ether_header), ENTROPY_HIGH_QUALITY); +#endif + dev_kfree_skb (skb, FREE_READ); net_kmsg(kmsg)->sent = FALSE; /* Mark packet as received. */ Index: linux/dev/include/linux/blk.h =================================================================== RCS file: /sources/hurd/gnumach/linux/dev/include/linux/Attic/blk.h,v retrieving revision 1.2 diff -u -r1.2 blk.h --- linux/dev/include/linux/blk.h 5 Apr 2001 06:39:21 -0000 1.2 +++ linux/dev/include/linux/blk.h 12 Aug 2007 06:36:00 -0000 @@ -90,7 +90,7 @@ #endif /* CONFIG_BLK_DEV_MD */ extern void set_device_ro(kdev_t dev,int flag); -void add_blkdev_randomness(int major); +extern void add_blkdev_randomness(int major); extern int floppy_init(void); extern void rd_load(void); @@ -136,7 +136,10 @@ #define DEVICE_NR(device) (MINOR(device)) #define DEVICE_ON(device) #define DEVICE_OFF(device) + +#ifndef MACH_ENTROPY #define DEVICE_NO_RANDOM +#endif #elif (MAJOR_NR == FLOPPY_MAJOR)