libzrtp  1.2.0
ZRTP VoIP security
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Random Number Generation
API

Functions

int zrtp_entropy_add (zrtp_global_t *zrtp, const unsigned char *buffer, uint32_t length)
 Entropy accumulation routine.
 
int zrtp_randstr (zrtp_global_t *zrtp, unsigned char *buffer, uint32_t length)
 Random string generation.
 
int zrtp_randstr2 (unsigned char *buffer, uint32_t length)
 

Detailed Description

The generation of cryptographic key material is a highly sensitive process. To do this, you need high entropy random numbers that an attacker cannot predict. This section Random Number Generation in libzrtp gives basic knowliges andbot the RNG and it's implementation in libzrtp.

Warning
Random Number Generation in libzrtp MUST be read by every developer using libzrtp.

Function Documentation

int zrtp_entropy_add ( zrtp_global_t *  zrtp,
const unsigned char *  buffer,
uint32_t  length 
)

Entropy accumulation routine.

The random number generation scheme is described in detail in chapter XXX. This function gets length bytes of entropy from buffer and hashes it into the special storage. This function should be called periodically from the user's space to increase entropy quality.

Warning
RNG is a very important and sensitive component of the crypto-system. Please, pay attention to Random Number Generation in libzrtp.
Parameters
zrtp- libzrtp global context;
buffer- pointer to the buffer with entropy for accumulating;
length- entropy size in bytes.
Returns
: number of hashed bytes.
int zrtp_randstr ( zrtp_global_t *  zrtp,
unsigned char *  buffer,
uint32_t  length 
)

Random string generation.

zrtp_randstr() generates length bytes of "random" data. We say "random" because the "randomness" of the generated sequence depends on the quality of the entropy passed to zrtp_entropy_add(). If the user provides "good" entropy, zrtp_randstr() generates sufficiently "random" data.

Parameters
zrtp- libzrtp global context;
buffer- buffer into which random data will be generated;
length- length of required sequence in bytes.
Returns
  • length of generated sequence in bytes or -1 in case of error
See Also
Random Number Generation in libzrtp