- prng_error_status perr;
- struct timeval tt;
- char buffer [16];
-
- /* create a Yarrow object */
- perr = prngInitialize(&gPrngRef);
- if (perr != 0) {
- printf ("Couldn't initialize Yarrow, /dev/random will not work.\n");
- return;
- }
-
- /* clear the error flag, reads and write should then work */
- gRandomError = 0;
-
- /* get a little non-deterministic data as an initial seed. */
- microtime(&tt);
-
- /*
- * So how much of the system clock is entropic?
- * It's hard to say, but assume that at least the
- * least significant byte of a 64 bit structure
- * is entropic. It's probably more, how can you figure
- * the exact time the user turned the computer on, for example.
- */
- perr = prngInput(gPrngRef, (BYTE*) &tt, sizeof (tt), SYSTEM_SOURCE, 8);
- if (perr != 0) {
- /* an error, complain */
- printf ("Couldn't seed Yarrow.\n");
- return;
- }
-
- /* turn the data around */
- perr = prngOutput(gPrngRef, (BYTE*) buffer, sizeof (buffer));
-
- /* and scramble it some more */
- perr = prngForceReseed(gPrngRef, RESEED_TICKS);
-
- /* make a mutex to control access */
- gYarrowMutex = mutex_alloc(0);
-}
+ .d_open = random_open,
+ .d_close = random_close,
+ .d_read = random_read,
+ .d_write = random_write,
+ .d_ioctl = random_ioctl,
+ .d_stop = (stop_fcn_t *)nulldev,
+ .d_reset = (reset_fcn_t *)nulldev,
+ .d_select = eno_select,
+ .d_mmap = eno_mmap,
+ .d_strategy = eno_strat,
+ .d_reserved_1 = eno_getc,
+ .d_reserved_2 = eno_putc,
+};
+