| RNDSINK(9) | Kernel Developer's Manual | RNDSINK(9) | 
rndsink, rndsink_create,
  rndsink_destroy,
  rndsink_request,
  rndsink_schedule, —
#include <sys/rndsink.h>
struct rndsink *
  
  rndsink_create(size_t
    bytes, void
    (*callback)(void *, const void *, size_t),
    void *arg);
void
  
  rndsink_destroy(struct
    rndsink *rndsink);
bool
  
  rndsink_request(struct
    rndsink *rndsink, void
    *buffer, size_t
    bytes);
void
  
  rndsink_schedule(struct
    rndsink *rndsink);
rndsink functions support asynchronous requests for
  entropy from the system entropy pool. Users must call
  rndsink_create() to create an rndsink which they may
  then pass to rndsink_request() to request data from
  the system entropy pool. If full entropy is not available, the system will
  call a callback when entropy is next available. Users can schedule a callback
  without requesting data now using rndsink_schedule().
  When users no longer need an rndsink, they must pass it to
  rndsink_destroy().
This API provides direct access to the system entropy pool. Most users should use the cprng(9) API instead, which interposes a cryptographic pseudorandom number generator between the user and the entropy pool.
rndsink_create(bytes,
    callback, arg)RNDSINK_MAX_BYTES. When requested and enough
      entropy is available, the system will call callback
      with three arguments:
    The callback will be called in soft interrupt context.
rndsink_create() may sleep to allocate
        memory.
rndsink_destroy(rndsink)rndsink_destroy() may sleep to
      wait for pending callbacks to complete and to deallocate memory.rndsink_request(rndsink,
    buffer, bytes)rndsink_schedule() and return false. In either
      case, rndsink_request() will store data in
      buffer. The argument bytes
      must be the same as the argument to
      rndsink_create() that was used to create
      rndsink. May be called at
      IPL_VM or lower. The caller should use
      explicit_memset(3)
      to clear buffer once it has used the data stored
      there.rndsink_schedule(rndsink)IPL_VM or lower.| April 10, 2013 | NetBSD 9.3 |