Name

RAND_add, RAND_seed
RAND_status

add entropy to the PRNG


Library

libcrypto.lib


Synopsis

#include <openssl/rand.h>
void RAND_seed(const void *buf, int num);
void RAND_add(const void *buf, int num, double entropy);
int  RAND_status(void);


Detailed Description

RAND_add() mixes the num bytes at buf into the PRNG state. Thus, if the data at buf are unpredictable to an adversary, this increases the uncertainty about the state and makes the PRNG output less predictable. Suitable input comes from user interaction (random key presses, mouse movements) and certain hardware events. The entropy argument is (the lower bound of) an estimate of how much randomness is contained in buf, measured in bytes. Details about sources of randomness and how to estimate their entropy can be found in the literature, e.g. RFC 1750.

RAND_add() may be called with sensitive data such as user entered passwords. The seed values cannot be recovered from the PRNG output.

OpenSSL makes sure that the PRNG state is unique for each thread. The application is responsible for seeding the PRNG by calling RAND_add() or RAND_load_file().

RAND_seed() is equivalent to RAND_add() when num == entropy.


Return Values

The functions do not return values.


See Also

rand(), RAND_load_file(), RAND_egd(), RAND_cleanup()


History

RAND_seed() and is available in all versions of SSLeay and OpenSSL. RAND_add() and RAND_status() have been added in OpenSSL 0.9.5.


Feedback

For additional information or queries on this page send feedback


© 2005-2007 Nokia 

Top