[Prev][Next][Index][Thread]

random sources interface




Hi,

I'm trying to create and implement a general interface for randomness
sources.  I've been talking about this a bit on the debian-hurd list.
Roland pointed out that the NetBSD sys/rnd.h header would be a good
place to start and that I'd need to implement something of that sort
as a COM interface.  He also said I should be using this list and not
debian-hurd.

I think the most relevent part of that file is this stuff:

typedef struct {
	char		name[16];	/* device name */
	u_int32_t	last_time;	/* last time recorded */
	u_int32_t	last_delta;	/* last delta value */
	u_int32_t	last_delta2;	/* last delta2 value */
	u_int32_t	total;		/* entropy from this source */
	u_int32_t	type;		/* type */
	u_int32_t	flags;		/* flags */
	void		*state;		/* state informaiton */
} rndsource_t;

/*
 * Flags to control the source.  Low byte is type, upper bits are flags.
 */
#define	RND_FLAG_NO_ESTIMATE	0x00000100	/* don't estimate entropy */
#define	RND_FLAG_NO_COLLECT	0x00000200	/* don't collect entropy */

#define	RND_TYPE_UNKNOWN	0	/* unknown source */
#define	RND_TYPE_DISK		1	/* source is physical disk */
#define	RND_TYPE_NET		2	/* source is a network device */
#define	RND_TYPE_TAPE		3	/* source is a tape drive */
#define	RND_TYPE_TTY		4	/* source is a tty device */
#define	RND_TYPE_RNG		5	/* source is a random number
					   generator */
#define	RND_TYPE_MAX		5	/* last type id used */

I thought I'd go and look at each of the OSKit drivers for DISK, NET,
TAPE, TTY and RNG (if there is one) and think about what I'd have to
do to get them to use a COMized "rndsource_t".  I notice there's no
MOUSE, for instance -- maybe that's UNKNOWN or TTY?  Are there other
TYPEs missing?  Is there stuff missing from the rndsource_t struct?

Also, I can probably pattern match from the other OSKit COM interfaces
to come up with a resonable name for this new interface, but, for the
sake of consistency (and in order to avoid wasting time renaming
things later), does anyone have a suggestion for what I should call
it?

Lastly, I'm concerned about being unable to test hardware that I don't
have.  There are a /lot/ of drivers in OSKit ;-)  I don't know of a
practical approach for implementing the COM interface for hardware
that I don't have.  Any suggestions here?  Of course, I'll be plenty
busy just implmenting it for the HW I do have, so this isn't a concern
right away.

Thanks,
Derek


Follow-Ups: