31 static uint8_t
const ASCON80PQ_IV1[4] = {0xa1, 0x40, 0x0c, 0x06};
36 static uint8_t
const ASCON80PQ_IV2[4] = {0xa2, 0x40, 0x0c, 0x06};
46 static void ascon80pq_siv_init
48 const unsigned char *k,
const uint8_t iv[4])
70 static void ascon_siv_encrypt_8_80pq
72 const unsigned char *src,
size_t len, uint8_t first_round)
74 unsigned char block[8];
91 (
unsigned char *c,
size_t *clen,
92 const unsigned char *m,
size_t mlen,
93 const unsigned char *ad,
size_t adlen,
94 const unsigned char *npub,
95 const unsigned char *k)
103 ascon80pq_siv_init(&
state, npub, k, ASCON80PQ_IV1);
123 ascon80pq_siv_init(&
state, c + mlen, k, ASCON80PQ_IV2);
126 ascon_siv_encrypt_8_80pq(&
state, c, m, mlen, 6);
131 (
unsigned char *m,
size_t *mlen,
132 const unsigned char *c,
size_t clen,
133 const unsigned char *ad,
size_t adlen,
134 const unsigned char *npub,
135 const unsigned char *k)
148 ascon80pq_siv_init(&
state, c + clen, k, ASCON80PQ_IV2);
151 ascon_siv_encrypt_8_80pq(&
state, m, c, clen, 6);
155 ascon80pq_siv_init(&
state, npub, k, ASCON80PQ_IV1);
#define ASCON80PQ_NONCE_SIZE
Size of the nonce for ASCON-80pq.
#define ASCON80PQ_TAG_SIZE
Size of the authentication tag for ASCON-80pq.
#define ASCON80PQ_KEY_SIZE
Size of the key for ASCON-80pq.
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_aead_absorb_8(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 an 8-byte rate.
void ascon80pq_siv_encrypt(unsigned char *c, size_t *clen, const unsigned char *m, size_t mlen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with ASCON-80pq-SIV.
int ascon80pq_siv_decrypt(unsigned char *m, size_t *mlen, const unsigned char *c, size_t clen, const unsigned char *ad, size_t adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with ASCON-80pq-SIV.
#define ascon_absorb_16(state, data, offset)
#define ascon_squeeze_8(state, data, offset)
#define ascon_absorb_partial(state, data, offset, count)
#define ascon_squeeze_16(state, data, offset)
#define ascon_separator(state)
#define lw_xor_block_2_src(dest, src1, src2, len)
void ascon_free(ascon_state_t *state)
Frees an ASCON permutation state and attempts to destroy any sensitive material.
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_init(ascon_state_t *state)
Initializes the words of the ASCON permutation state to zero.
SIV encryption primitives built around the ASCON permutation.
ascon_state_t state
[snippet_key]
Structure of the internal state of the ASCON permutation.
void ascon_clean(void *buf, unsigned size)
Cleans a buffer that contains sensitive material.