Skip to content
Snippets Groups Projects
  • Pekka Enberg's avatar
    fd1be662
    virtio: Add virtio-rng driver · fd1be662
    Pekka Enberg authored
    
    This adds the virtio-rng driver to OSv.  The implementation is simple:
    
      - Start a thread that keeps 64 byte of entropy cached in internal
        buffer.  Entropy is gathered from the host with virtio-rng.
    
      - Create device nodes for "/dev/random" and "/dev/urandom" that both
        use the same virtio_rng_read() hook.
    
      - Use the entropy buffer for virtio_rng_read().  If we exhaust the
        buffer, wake up the thread and wait for more entropy to appear.
    
    We eventually should move device node creation to separate
    drivers/random.c that multiplexes between different hardware RNG
    implementations.  However, as we only support virtio-rng, I'm leaving
    that to whomever implements support for the next RNG.
    
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
    fd1be662
    History
    virtio: Add virtio-rng driver
    Pekka Enberg authored
    
    This adds the virtio-rng driver to OSv.  The implementation is simple:
    
      - Start a thread that keeps 64 byte of entropy cached in internal
        buffer.  Entropy is gathered from the host with virtio-rng.
    
      - Create device nodes for "/dev/random" and "/dev/urandom" that both
        use the same virtio_rng_read() hook.
    
      - Use the entropy buffer for virtio_rng_read().  If we exhaust the
        buffer, wake up the thread and wait for more entropy to appear.
    
    We eventually should move device node creation to separate
    drivers/random.c that multiplexes between different hardware RNG
    implementations.  However, as we only support virtio-rng, I'm leaving
    that to whomever implements support for the next RNG.
    
    Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>