*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->NetBSD man pages -> rnd (9)              
Title
Content
Arch
Section
 

RND(9)

Contents


NAME    [Toc]    [Back]

     RND, rnd_attach_source, rnd_detach_source, rnd_add_data, rnd_add_uint32 -
     functions to make a device available for entropy collection

SYNOPSIS    [Toc]    [Back]

     #include <sys/rnd.h>

     void
     rnd_attach_source(rndsource_element_t *rnd_source, char *devname,
             u_int32_t source_type, u_int32_t flags);

     void
     rnd_detach_source(rndsource_element_t *rnd_source);

     void
     rnd_add_data(rndsource_element_t *rnd_source, void *data, u_int32_t len,
             u_int32_t entropy);

     void
     rnd_add_uint32(rndsource_element_t *rnd_source, u_int32_t datum);

DESCRIPTION    [Toc]    [Back]

     These RND functions make a device available for entropy collection for
     /dev/random.

     Ideally the first argument rnd_source of these functions gets included in
     the devices' entity struct, but any means to permanently (static) attach
     one such argument to one incarnation of the device is ok.  Do not share
     rnd_source structures between two devices.

     rnd_attach_source(rndsource_element_t *rnd_source, char *devname,
               u_int32_t source_type, u_int32_t flags)
               This function announces the availability of a device for
               entropy collection.  It must be called before the source struct
               pointed to by rnd_source is used in any of the following functions.


               devname is the name of the device.  It is used to print a message
 (if the kernel is compiled with ``options RND_VERBOSE'')
               and also for status information printed with rndctl(8).

               source_type is RND_TYPE_NET for network devices, RND_TYPE_DISK
               for physical disks, RND_TYPE_TAPE for a tape drive, and
               RND_TYPE_TTY for a tty.  RND_TYPE_UNKNOWN is not to be used as
               a type.  It is used internally to the rnd system.

               flags are the logical OR of RND_FLAGS_NO_COLLECT (don't collect
               or estimate) RND_FLAGS_NO_ESTIMATE (don't estimate) to control
               the default setting for collection and estimation.  Note that
               devices of type RND_TYPE_NET default to RND_FLAGS_NO_ESTIMATE.

     rnd_detach_source(rndsource_element_t *rnd_source)
               This function disconnects the device from entropy collection.

     rnd_add_uint32(rndsource_element_t *rnd_source, u_int32_t datum)
               This function adds the value of datum to the entropy pool.  No
               entropy is assumed to be collected from this value, it merely
               helps stir the entropy pool.  All entropy is gathered from jitter
 between the timing of events.

               Note that using a constant for datum does not weaken security,
               but it does not help.  Try to use something that can change,
               such as an interrupt status register which might have a bit set
               for receive ready or transmit ready, or other device status
               information.

               To allow the system to gather the timing information accurately,
 this call should be placed within the actual hardware
               interrupt service routine.  Care must be taken to ensure that
               the interrupt was actually serviced by the interrupt handler,
               since on some systems interrupts can be shared.

               This function loses nearly all usefulness if it is called from
               a scheduled software interrupt.  If that is the only way to add
               the device as an entropy source, don't.

               If it is desired to mix in the datum and to add in a timestamp,
               but not to actually estimate entropy from a source of randomness,
 passing NULL for rnd_source is permitted, and the device
               does not need to be attached.

     rnd_add_data(rndsource_element_t *rnd_source, void *data, u_int32_t len,
               u_int32_t entropy)
               adds (hopefully) random data to the entropy pool.  len is the
               number of bytes in data and entropy is an "entropy quality"
               measurement.  If every bit of data is known to be random,
               entropy is the number of bits in data.

               Timing information is also used to add entropy into the system,
               using inter-event timings.

               If it is desired to mix in the data and to add in a timestamp,
               but not to actually estimate entropy from a source of randomness,
 passing NULL for rnd_source is permitted, and the device
               does not need to be attached.

FILES    [Toc]    [Back]

     These functions are declared in src/sys/sys/rnd.h and defined in
     src/sys/dev/rnd.c.

SEE ALSO    [Toc]    [Back]

      
      
     rnd(4), rndctl(8)

HISTORY    [Toc]    [Back]

     The random device was introduced in NetBSD 1.3.

AUTHORS    [Toc]    [Back]

     This implementation was written by Michael Graff <explorer@flame.org>
     using ideas and algorithms gathered from many sources, including the
     driver written by Ted Ts'o.

BUGS    [Toc]    [Back]

     The only good sources of randomness are quantum mechanical, and most computers
 avidly avoid having true sources of randomness included.  Don't
     expect to surpass "pretty good".

BSD                            October 20, 1997                            BSD
[ Back ]
 Similar pages
Name OS Title
random_harvest FreeBSD gather entropy from the kernel for the entropy device
random FreeBSD the entropy device
mksf HP-UX make a special (device) file
mtools Tru64 Provides a collection of tools for manipulating DOS files
satctl IRIX control the collection of audit data
rqsprint IRIX displays information about a collection of ELF files on a system
DtInfoLib HP-UX collection of book cases for browsing with dtinfo
sia_collect_trm Tru64 Parameter collection routine for SIA (Security Integration Architecture)
crashdc Tru64 Diagnostic data collection for a running or crashed system
RAND_add NetBSD add entropy to the PRNG
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service