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

Re: random sources interface




Hi again,

I /think/ this time I'm making some progress with adding a random pool
device to OSKit.  Here's a simple little diagram of the way I'm seeing
it now (thanks to Roland for his earlier, detailed reply):


            /dev/random                /dev/urandom
              |     ^                    |     ^
              |     |                    |     |
              |     |                    |     |
              |     |                    |     |
              |    +-----------+         |    +-----------+
              |    | oskit_    |         |    | oskit     |
              |    |  stream_t |         |    |  stream_t |
              |    | asyncio_t |         |    +-----------+
              |    +-----------+         |     ^
              |     ^                    |     |
+----------+  |     |                    |     |
| open_    <--+     |                    |     |
|  good()  >--------+                    |     |
| open_    <-----------------------------+     |
|  non_    >-----------------------------------+
|  block() |
+----------+ "Top" (client OS)
| Random   |
| Pool     |
| Device/  |
| Driver   |
+----------+ "Bottom" (devices/drivers)
| rnd_     |
|  attach_ |
|  source()|
+-^--|-^-|-+
  |  | | +--------------+
  |  | +-------------+  |
  |  |               |  |
  | +V---------+     | +V---------+
  | | rnd_     |     | | rnd_     |
  | |  add_    |     | |  add_    |
  | |  data()  | ... | |  data()  | ...
  | | rnd_     |     | | rnd_     |
  | |  add_    |     | |  add_    |
  | |  uint32()|     | |  uint32()|
  | | get_     |     | | get_     |
  | |  stats() |     | |  stats() |
  | +-^--------+     | +-^--------+
  |   |              |   |
+-|---|----+        +|---|-----+
| Disk     |        | Ether    |
| Driver/  |  ...   | Driver/  |  ... keyboard, etc...
| Device   |        | Device   |
+----------+        +----------+



Last night I succeeded in getting add_blkdev_randomness (misc.c) to
talk to the randompool com object via the device_registry and then
make "add data" calls!  I cribbed a bunch of code from the blkio
example to cobble this together.  I have a slew of detail questions,
but I don't think they're too important right now.

Hopefully I'm going in the right direction.  I think that if what I've
got above is in the ballpark then with what I've learned about how
OSKit works it should be easy for me to code up the device/driver
interfaces and then crib code from linux for the "core".

At this point I'm planning on making the random pool a "singleton"
implementing oskit_device_t and oskit_driver_t that both return the
same getinfo "info" - I have lots of other questions, but I don't
think they will hold me up too much yet.

Derek

-- 

References: