31 #define ASCON_PRF_RATE_IN 32
36 #define ASCON_PRF_RATE_OUT 16
39 (
unsigned char *out,
size_t outlen,
40 const unsigned char *in,
size_t inlen,
41 const unsigned char *key)
51 (
unsigned char *out,
size_t outlen,
52 const unsigned char *in,
size_t inlen,
53 const unsigned char *key)
63 (
unsigned char *out,
size_t outlen,
64 const unsigned char *in,
size_t inlen,
65 const unsigned char *key)
68 unsigned char iv[8] = {0x80, 0x00, 0x4c, 0x80, 0x00, 0x00, 0x00, 0x00};
73 iv[1] = (
unsigned char)(inlen * 8U);
87 const unsigned char *in,
size_t inlen,
88 const unsigned char *key)
98 (
const unsigned char *tag,
99 const unsigned char *in,
size_t inlen,
100 const unsigned char *key)
118 unsigned char iv[8] = {0x80, 0x80, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00};
119 #if !defined(__SIZEOF_SIZE_T__) || __SIZEOF_SIZE_T__ >= 4
120 if (outlen >= (((
size_t)1) << 29))
175 temp = (unsigned)inlen;
177 state->count += temp;
198 temp = (unsigned)inlen;
227 temp = (unsigned)outlen;
229 state->count += temp;
249 temp = (unsigned)outlen;
int ascon_aead_check_tag(unsigned char *plaintext, size_t plaintext_len, const unsigned char *tag1, const unsigned char *tag2, size_t size)
Check an authentication tag in constant time.
void ascon_prf_free(ascon_prf_state_t *state)
Frees the ASCON-Prf state and destroys any sensitive material.
void ascon_prf(unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key)
Processes a key and input data with ASCON-Prf to produce a tag.
void ascon_prf_fixed(unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key)
Processes a key and input data with ASCON-Prf to produce a fixed-length output tag.
void ascon_prf_fixed_init(ascon_prf_state_t *state, const unsigned char *key, size_t outlen)
Initializes the state for an incremental ASCON-Prf operation with fixed-length output.
void ascon_mac(unsigned char *tag, const unsigned char *in, size_t inlen, const unsigned char *key)
Processes a key and input data with ASCON-Mac to produce a tag.
int ascon_prf_short(unsigned char *out, size_t outlen, const unsigned char *in, size_t inlen, const unsigned char *key)
Processes a key and input data with ASCON-PrfShort to produce a tag.
void ascon_prf_init(ascon_prf_state_t *state, const unsigned char *key)
Initializes the state for an incremental ASCON-Prf operation.
void ascon_prf_squeeze(ascon_prf_state_t *state, unsigned char *out, size_t outlen)
Squeezes output from an incremental ASCON-Prf operation.
void ascon_prf_reinit(ascon_prf_state_t *state, const unsigned char *key)
Re-initializes the state for an incremental ASCON-Prf operation.
int ascon_mac_verify(const unsigned char *tag, const unsigned char *in, size_t inlen, const unsigned char *key)
Verifies an ASCON-Mac tag value.
void ascon_prf_fixed_reinit(ascon_prf_state_t *state, const unsigned char *key, size_t outlen)
Re-initializes the state for an incremental ASCON-Prf operation with fixed-length output.
#define ASCON_PRF_RATE_IN
Rate of absorption for input blocks.
#define ASCON_PRF_RATE_OUT
Rate of squeezing for output blocks.
void ascon_prf_absorb(ascon_prf_state_t *state, const unsigned char *in, size_t inlen)
Absorbs input data into an incremental ASCON-Prf state.
#define ascon_pad(state, offset)
#define ascon_absorb_16(state, data, offset)
#define ascon_squeeze_partial(state, data, offset, count)
#define ascon_absorb_partial(state, data, offset, count)
#define ascon_squeeze_16(state, data, offset)
#define ascon_separator(state)
#define be_store_word32(ptr, x)
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_permute(ascon_state_t *state, uint8_t first_round)
Permutes the ASCON state with a specified number of rounds.
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.
ASCON-Prf, ASCON-PrfShort, and ASCON-Mac algorithms.
#define ASCON_PRF_KEY_SIZE
Size of the key for ASCON-Prf in bytes.
#define ASCON_PRF_SHORT_MAX_OUTPUT_SIZE
Maximum number of bytes that can be output from ASCON-PrfShort.
#define ASCON_MAC_TAG_SIZE
Size of the ASCON-Mac output in bytes.
#define ASCON_PRF_SHORT_MAX_INPUT_SIZE
Maximum number of bytes that can be input to ASCON-PrfShort.
#define ASCON_PRF_SHORT_KEY_SIZE
Size of the key for ASCON-PrfShort in bytes.
ascon_state_t state
[snippet_key]
State information for the ASCON-Prf incremental mode.
Structure of the internal state of the ASCON permutation.
System utilities of use to applications that use ASCON.
void ascon_clean(void *buf, unsigned size)
Cleans a buffer that contains sensitive material.