26 #if ASCON_MASKED_DATA_SHARES != 1
34 ascon_masked_data_load(word,
data, trng);
35 ascon_masked_data_xor(&(
state->M[0]), word);
36 ascon_masked_data_permute(
state, first_round, preserve);
41 ascon_masked_data_load_partial(word,
data, len, trng);
42 ascon_masked_data_xor(&(
state->M[0]), word);
45 ascon_masked_data_permute(
state, first_round, preserve);
54 ascon_masked_data_load(word,
data, trng);
55 ascon_masked_data_xor(&(
state->M[0]), word);
56 ascon_masked_data_load(word,
data + 8, trng);
57 ascon_masked_data_xor(&(
state->M[1]), word);
58 ascon_masked_data_permute(
state, first_round, preserve);
63 ascon_masked_data_load(word,
data, trng);
64 ascon_masked_data_xor(&(
state->M[0]), word);
68 ascon_masked_data_load_partial(word,
data, len, trng);
69 ascon_masked_data_xor(&(
state->M[1]), word);
74 ascon_masked_data_load_partial(word,
data, len, trng);
75 ascon_masked_data_xor(&(
state->M[0]), word);
79 ascon_masked_data_permute(
state, first_round, preserve);
84 const unsigned char *src,
size_t len, uint8_t first_round,
88 ascon_masked_data_load(word, src, trng);
89 ascon_masked_data_xor(&(
state->M[0]), word);
90 ascon_masked_data_store(dest, &(
state->M[0]));
91 ascon_masked_data_permute(
state, first_round, preserve);
97 ascon_masked_data_load_partial(word, src, len, trng);
98 ascon_masked_data_xor(&(
state->M[0]), word);
99 ascon_masked_data_store_partial(dest, len, &(
state->M[0]));
106 const unsigned char *src,
size_t len, uint8_t first_round,
110 ascon_masked_data_load(word, src, trng);
111 ascon_masked_data_xor(&(
state->M[0]), word);
112 ascon_masked_data_load(word, src + 8, trng);
113 ascon_masked_data_xor(&(
state->M[1]), word);
114 ascon_masked_data_store(dest, &(
state->M[0]));
115 ascon_masked_data_store(dest + 8, &(
state->M[1]));
116 ascon_masked_data_permute(
state, first_round, preserve);
122 ascon_masked_data_load(word, src, trng);
123 ascon_masked_data_xor(&(
state->M[0]), word);
124 ascon_masked_data_store(dest, &(
state->M[0]));
129 ascon_masked_data_load_partial(word, src, len, trng);
130 ascon_masked_data_xor(&(
state->M[1]), word);
131 ascon_masked_data_store_partial(dest, len, &(
state->M[1]));
136 ascon_masked_data_load_partial(word, src, len, trng);
137 ascon_masked_data_xor(&(
state->M[0]), word);
138 ascon_masked_data_store_partial(dest, len, &(
state->M[0]));
146 const unsigned char *src,
size_t len, uint8_t first_round,
150 ascon_masked_data_load(word, src, trng);
151 ascon_masked_data_xor(&(
state->M[0]), word);
152 ascon_masked_data_store(dest, &(
state->M[0]));
154 ascon_masked_data_permute(
state, first_round, preserve);
160 ascon_masked_data_load_partial(word, src, len, trng);
161 ascon_masked_data_xor(&(
state->M[0]), word);
162 ascon_masked_data_store_partial(dest, len, &(
state->M[0]));
163 ascon_masked_data_replace(&(
state->M[0]), word, len);
170 const unsigned char *src,
size_t len, uint8_t first_round,
174 ascon_masked_data_load(word, src, trng);
175 ascon_masked_data_xor(&(
state->M[0]), word);
176 ascon_masked_data_store(dest, &(
state->M[0]));
178 ascon_masked_data_load(word, src + 8, trng);
179 ascon_masked_data_xor(&(
state->M[1]), word);
180 ascon_masked_data_store(dest + 8, &(
state->M[1]));
182 ascon_masked_data_permute(
state, first_round, preserve);
188 ascon_masked_data_load(word, src, trng);
189 ascon_masked_data_xor(&(
state->M[0]), word);
190 ascon_masked_data_store(dest, &(
state->M[0]));
196 ascon_masked_data_load_partial(word, src, len, trng);
197 ascon_masked_data_xor(&(
state->M[1]), word);
198 ascon_masked_data_store_partial(dest, len, &(
state->M[1]));
199 ascon_masked_data_replace(&(
state->M[1]), word, len);
204 ascon_masked_data_load_partial(word, src, len, trng);
205 ascon_masked_data_xor(&(
state->M[0]), word);
206 ascon_masked_data_store_partial(dest, len, &(
state->M[0]));
207 ascon_masked_data_replace(&(
state->M[0]), word, len);
void ascon_masked_aead_decrypt_16(ascon_masked_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Decrypts a block of data with an ASCON state and a 16-byte rate.
void ascon_masked_aead_absorb_8(ascon_masked_state_t *state, const unsigned char *data, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Absorbs data into a masked ASCON state with an 8-byte rate.
void ascon_masked_aead_encrypt_16(ascon_masked_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Encrypts a block of data with a masked ASCON state and a 16-byte rate.
void ascon_masked_aead_absorb_16(ascon_masked_state_t *state, const unsigned char *data, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Absorbs data into a masked ASCON state with a 16-byte rate.
void ascon_masked_aead_decrypt_8(ascon_masked_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Decrypts a block of data with a masked ASCON state and an 8-byte rate.
void ascon_masked_aead_encrypt_8(ascon_masked_state_t *state, unsigned char *dest, const unsigned char *src, size_t len, uint8_t first_round, ascon_masked_word_t *word, uint64_t *preserve, ascon_trng_state_t *trng)
Encrypts a block of data with a masked ASCON state and an 8-byte rate.
void ascon_masked_word_pad(ascon_masked_word_t *word, unsigned offset)
Adds a padding marker to a masked word.
ascon_state_t state
[snippet_key]
unsigned char data[8]
[snippet_key]
State of the ASCON permutation which has been masked with up to 4 shares.
State of the random number source.
Masked 64-bit word with up to ASCON_MASKED_MAX_SHARES shares.