28 static uint8_t
const ASCON128a_IV[8] =
29 {0x80, 0x80, 0x0c, 0x08, 0x00, 0x00, 0x00, 0x00};
33 const unsigned char *npub,
const unsigned char *k)
67 unsigned char *out,
size_t len)
71 (&(
state->state), out, in, len, 4,
state->posn);
95 unsigned char *out,
size_t len)
99 (&(
state->state), out, in, len, 4,
state->posn);
#define ASCON128_TAG_SIZE
Size of the authentication tag for ASCON-128 and ASCON-128a.
#define ASCON128_NONCE_SIZE
Size of the nonce for ASCON-128 and ASCON-128a.
#define ASCON128_KEY_SIZE
Size of the key for ASCON-128 and ASCON-128a.
void ascon_aead_absorb_16(ascon_state_t *state, const unsigned char *data, size_t len, uint8_t first_round, int last_permute)
Absorbs data into an ASCON state with a 16-byte rate.
unsigned char ascon_aead_encrypt_16(ascon_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, unsigned char partial)
Encrypts a block of data with an ASCON state and a 16-byte rate.
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.
unsigned char ascon_aead_decrypt_16(ascon_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, unsigned char partial)
Decrypts a block of data with an ASCON state and a 16-byte rate.
int ascon128a_aead_decrypt_finalize(ascon128a_state_t *state, const unsigned char *tag)
Finalizes an incremental ASCON-128a decryption operation and checks the authentication tag.
void ascon128a_aead_encrypt_finalize(ascon128a_state_t *state, unsigned char *tag)
Finalizes an incremental ASCON-128a encryption operation and generates the authentication tag.
void ascon128a_aead_decrypt_block(ascon128a_state_t *state, const unsigned char *in, unsigned char *out, size_t len)
Decrypts a block of data with ASCON-128a in incremental mode.
void ascon128a_aead_start(ascon128a_state_t *state, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Starts encrypting or decrypting a packet with ASCON-128a in incremental mode.
void ascon128a_aead_encrypt_block(ascon128a_state_t *state, const unsigned char *in, unsigned char *out, size_t len)
Encrypts a block of data with ASCON-128a in incremental mode.
void ascon128a_aead_abort(ascon128a_state_t *state)
Aborts use of ASCON-128a in incremental mode.
#define ascon_pad(state, offset)
#define ascon_absorb_16(state, data, offset)
#define ascon_squeeze_partial(state, data, offset, count)
#define ascon_squeeze_16(state, data, offset)
#define ascon_separator(state)
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_state_t state
[snippet_key]
State information for the incremental version of ASCON-128a.
void ascon_clean(void *buf, unsigned size)
Cleans a buffer that contains sensitive material.