Logo Search packages:      
Sourcecode: srtp version File versions  Download package

err_status_t crypto_get_random ( unsigned char *  buffer,
unsigned int  length 
)

writes a random octet string.

The function call crypto_get_random(dest, len) writes len octets of random data to the location to which dest points, and returns an error code. This error code must be checked, and if a failure is reported, the data in the buffer must not be used.

Warning:
If the return code is not checked, then non-random data may be in the buffer. This function will fail unless it is called after crypto_kernel_init().
Returns:
  • err_status_ok if no problems occured.
  • [other] a problem occured, and no assumptions should be made about the contents of the destination buffer.

Definition at line 518 of file crypto_kernel.c.

References err_status_fail.

                                                              {
  if (crypto_kernel.state == crypto_kernel_state_secure)
    return ctr_prng_get_octet_string(buffer, length);
  else
    return err_status_fail;
}


Generated by  Doxygen 1.6.0   Back to index