ica_drbg_generate

Purpose

This function requests pseud random bytes from an ica_drbg instantiation created by the ica_drbg_instantiate function.

Format


int ica_drbg_generate(ica_drbg_t *sh,
  int sec,
  bool pr,
  const unsigned char *add,
  size_t add_len,
  unsigned char *prnd,
  size_t prnd_len);

Parameters

ica_drbg_t *sh
State handle pointer. Identifies the DRBG instantiation from which pseudorandom bytes are requested.
int sec
Requested security strength: Minimum bits of security that the generated pseudo random bytes shall offer.
bool pr
Prediction resistance request. Indicates whether or not prediction resistance is required.
const unsigned char *add
Pointer to additional optional input. NULL indicates that no additional input is used.
size_t add_len
Length in bytes of parameter add.
unsigned char *prnd
Pointer to the generated pseudo random bytes.
size_t prnd_len
Length in bytes of parameter prnd, which corresponds to the number of generated pseudo random bytes.

Return codes

0
Success
ENOTSUP
Prediction resistance or the requested security strength is not supported.
EPERM
Reseed required.
ICA_DBRG_HEALTH_TEST_FAIL
Health test failed, see ica_drbg_health_test.
ICA_DBRG_ENTROPY_SOURCE_FAIL
Entropy source failed.

For return codes indicating exceptions, see Return codes.