31 #if defined(ASCON_TRNG_MIXER)
39 (&(
state->prng), seed, 40 -
sizeof(seed),
sizeof(seed));
61 #if defined(ASCON_BACKEND_SLICED32) || defined(ASCON_BACKEND_SLICED64) || \
62 defined(ASCON_BACKEND_DIRECT_XOR)
68 (&(
state->prng), (
unsigned char *)&x,
state->posn,
sizeof(x));
71 state->posn +=
sizeof(uint32_t);
80 (
state->posn % 8U) != 0) {
84 #if defined(ASCON_BACKEND_SLICED32) || defined(ASCON_BACKEND_SLICED64) || \
85 defined(ASCON_BACKEND_DIRECT_XOR)
91 (&(
state->prng), (
unsigned char *)&x,
state->posn,
sizeof(x));
94 state->posn +=
sizeof(uint64_t);
uint32_t ascon_trng_generate_32(ascon_trng_state_t *state)
Generates a 32-bit random value for masking operations.
uint64_t ascon_trng_generate_64(ascon_trng_state_t *state)
Generates a 64-bit random value for masking operations.
int ascon_trng_init(ascon_trng_state_t *state)
Initializes the random number source for generating a sequence of masking material at high speed.
int ascon_trng_reseed(ascon_trng_state_t *state)
Reseeds the random number source.
void ascon_trng_free(ascon_trng_state_t *state)
Frees the random number source and destroys any sensitive material.
int ascon_trng_generate(unsigned char *out, size_t outlen)
Generates a buffer of bytes from the system TRNG source.
Access to the system's random number source.
#define ASCON_TRNG_MIXER_RATE
#define ASCON_SYSTEM_SEED_SIZE
Number of bytes to request from the system TRNG to seed a PRNG.
#define ascon_permute12(state)
Permutes the ASCON state with 12 rounds of the permutation.
void ascon_overwrite_with_zeroes(ascon_state_t *state, unsigned offset, unsigned size)
Overwrites a part of the ASCON state with zeroes.
void ascon_free(ascon_state_t *state)
Frees an ASCON permutation state and attempts to destroy any sensitive material.
void ascon_release(ascon_state_t *state)
Temporarily releases access to any shared hardware resources that a permutation state was using.
void ascon_overwrite_bytes(ascon_state_t *state, const uint8_t *data, unsigned offset, unsigned size)
Overwrites existing bytes in the ASCON state.
void ascon_extract_bytes(const ascon_state_t *state, uint8_t *data, unsigned offset, unsigned size)
Extracts bytes from the ASCON state.
void ascon_add_bytes(ascon_state_t *state, const uint8_t *data, unsigned offset, unsigned size)
Adds bytes to the ASCON state by XOR'ing them with existing bytes.
void ascon_acquire(ascon_state_t *state)
Re-acquires access to any shared hardware resources that a permutation state was using.
void ascon_init(ascon_state_t *state)
Initializes the words of the ASCON permutation state to zero.
#define ascon_permute6(state)
Permutes the ASCON state with 6 rounds of the permutation.
ascon_state_t state
[snippet_key]
State of the random number source.
System utilities of use to applications that use ASCON.
void ascon_clean(void *buf, unsigned size)
Cleans a buffer that contains sensitive material.