class Collector

Defined at line 19 of file ../../zircon/kernel/lib/crypto/include/lib/crypto/entropy/collector.h

Public Methods

void ~Collector ()

Defined at line 20 of file ../../zircon/kernel/lib/crypto/entropy/collector.cc

size_t DrawEntropy (uint8_t * buf, size_t len)

Fills |len| bytes of memory at |buf| with random data from this entropy

collector's entropy source. The bytes that are returned may not be

perfectly random, i.e. they may be statistically dependent or biased. Use

the BytesNeeded() method to determine how may random bytes are needed to

collect a certain amount of entropy.

size_t BytesNeeded (size_t bits)

Returns the number of bytes of random data that should be drawn via

DrawEntropy() to get approximately |bits| bits of entropy. Note: |bits|

must be no larger than 2^20 (= 1048576).

Defined at line 22 of file ../../zircon/kernel/lib/crypto/entropy/collector.cc

void get_name (char * name, size_t len)

Returns a null-terminated name, in the buffer of size |len| at |buf|.

Defined at line 24 of file ../../zircon/kernel/lib/crypto/include/lib/crypto/entropy/collector.h

Protected Methods

void Collector (const char * name, size_t entropy_per_1000_bytes)

Initialize this entropy collector. |name| is used for debugging and

testing, and it may be truncated if it is too long.

|entropy_per_1000_bytes| is the (approximate) amount of min-entropy in

each 1000 bytes of data returned by the entropy source. The amount of

entropy in a byte from the entropy source is generally not an integer.

Quoting the entropy per 1000 bytes supports non-integer values, without

requiring floating-point or fixed-point arithmetic. It is an error if

|entropy_per_1000_bytes| is 0 or is greater than 8000.

TODO(andrewkrieger): document entropy source quality tests, and reference

that document here, to explain how to find a good value for

entropy_per_1000_bytes.

Defined at line 14 of file ../../zircon/kernel/lib/crypto/entropy/collector.cc