32 int (*generate)(
void *state,
const uint8_t *addtl_input,
33 size_t addtl_input_len, uint8_t *out,
size_t outlen);
34 int (*seed)(
void *state,
const uint8_t *seed,
size_t seedlen,
35 const uint8_t *persbuf,
size_t perslen);
36 void (*zero)(
void *state);
37 uint64_t algorithm_type;
41 const struct lc_rng *rng;
45#define LC_RNG_CTX(name, cb) \
47 name->rng_state = (uint8_t *)(name) + sizeof(struct lc_rng_ctx)
118 size_t addtl_input_len, uint8_t *out,
size_t outlen);
136int lc_rng_seed(
struct lc_rng_ctx *ctx,
const uint8_t *seed,
size_t seedlen,
137 const uint8_t *persbuf,
size_t perslen);
enum lc_alg_status_val lc_rng_ctx_alg_status(const struct lc_rng_ctx *ctx)
Obtain algorithm status.
void lc_rng_zero(struct lc_rng_ctx *ctx)
Zeroize RNG context.
int lc_rng_set_seeded(struct lc_rng_ctx *new_ctx)
Set an externally defined RNG as the seeded RNG.
int lc_rng_generate(struct lc_rng_ctx *ctx, const uint8_t *addtl_input, size_t addtl_input_len, uint8_t *out, size_t outlen)
Obtain random numbers.
void lc_rng_check(struct lc_rng_ctx **ctx)
Get the default leancrypto RNG.
enum lc_alg_status_val lc_rng_alg_status(const struct lc_rng *rng)
Obtain algorithm status.
int lc_rng_seed(struct lc_rng_ctx *ctx, const uint8_t *seed, size_t seedlen, const uint8_t *persbuf, size_t perslen)
(Re)Seed the RNG
struct lc_rng_ctx * lc_seeded_rng
One common instance of a seeded DRNG. The caller does not need to consider the seeding and reseeding ...
void lc_rng_zero_free(struct lc_rng_ctx *ctx)
Zeroize and free RNG context.