31 int (*generate)(
void *state,
const uint8_t *addtl_input,
32 size_t addtl_input_len, uint8_t *out,
size_t outlen);
33 int (*seed)(
void *state,
const uint8_t *seed,
size_t seedlen,
34 const uint8_t *persbuf,
size_t perslen);
35 void (*zero)(
void *state);
36 uint64_t algorithm_type;
40 const struct lc_rng *rng;
44#define LC_RNG_CTX(name, cb) \
46 name->rng_state = (uint8_t *)(name) + sizeof(struct lc_rng_ctx)
117 size_t addtl_input_len, uint8_t *out,
size_t outlen);
135int lc_rng_seed(
struct lc_rng_ctx *ctx,
const uint8_t *seed,
size_t seedlen,
136 const uint8_t *persbuf,
size_t perslen);
uint64_t lc_rng_ctx_algorithm_type(const struct lc_rng_ctx *ctx)
Obtain algorithm type usable with lc_alg_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.
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 ...
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.
uint64_t lc_rng_algorithm_type(const struct lc_rng *rng)
Obtain algorithm type usable with lc_alg_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
void lc_rng_zero_free(struct lc_rng_ctx *ctx)
Zeroize and free RNG context.