43 for (index = 0; index < 5; ++index) {
45 (&(
state->M[index]), &(
state->M[index]), trng);
53 #if defined(ASCON_BACKEND_DIRECT_XOR)
55 for (index = 0; index < 5; ++index)
59 unsigned char word[8];
60 for (index = 0; index < 5; ++index) {
72 #if defined(ASCON_BACKEND_DIRECT_XOR)
73 for (index = 0; index < 5; ++index)
76 unsigned char word[8];
77 for (index = 0; index < 5; ++index) {
90 for (index = 0; index < 5; ++index) {
92 (&(dest->
M[index]), &(src->
M[index]), trng);
96 #if ASCON_MASKED_MAX_SHARES >= 3
103 for (index = 0; index < 5; ++index)
109 #if ASCON_MASKED_MAX_SHARES >= 4
116 for (index = 0; index < 5; ++index)
122 #if ASCON_MASKED_MAX_SHARES >= 3
127 for (index = 0; index < 5; ++index) {
129 (&(
state->M[index]), &(
state->M[index]), trng);
137 #if defined(ASCON_BACKEND_DIRECT_XOR)
139 for (index = 0; index < 5; ++index)
143 unsigned char word[8];
144 for (index = 0; index < 5; ++index) {
156 #if defined(ASCON_BACKEND_DIRECT_XOR)
157 for (index = 0; index < 5; ++index)
160 unsigned char word[8];
161 for (index = 0; index < 5; ++index) {
174 for (index = 0; index < 5; ++index)
183 for (index = 0; index < 5; ++index) {
185 (&(dest->
M[index]), &(src->
M[index]), trng);
189 #if ASCON_MASKED_MAX_SHARES >= 4
196 for (index = 0; index < 5; ++index)
204 #if ASCON_MASKED_MAX_SHARES >= 4
209 for (index = 0; index < 5; ++index) {
211 (&(
state->M[index]), &(
state->M[index]), trng);
219 #if defined(ASCON_BACKEND_DIRECT_XOR)
221 for (index = 0; index < 5; ++index)
225 unsigned char word[8];
226 for (index = 0; index < 5; ++index) {
238 #if defined(ASCON_BACKEND_DIRECT_XOR)
239 for (index = 0; index < 5; ++index)
242 unsigned char word[8];
243 for (index = 0; index < 5; ++index) {
256 for (index = 0; index < 5; ++index)
265 for (index = 0; index < 5; ++index)
274 for (index = 0; index < 5; ++index) {
276 (&(dest->
M[index]), &(src->
M[index]), trng);
void ascon_x4_copy_to_x1(ascon_state_t *dest, const ascon_masked_state_t *src)
Copies the entire ASCON-x4 permutation state to a regular ASCON-x1 permutation state.
void ascon_x2_copy_from_x3(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x3 permutation state to an ASCON-x2 permutation state.
void ascon_x2_copy_from_x2(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x2 permutation state from a source to a destination.
void ascon_x4_randomize(ascon_masked_state_t *state, ascon_trng_state_t *trng)
Randomizes an ASCON-x4 permutation state.
void ascon_x2_copy_from_x4(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x4 permutation state to an ASCON-x2 permutation state.
void ascon_x4_copy_from_x4(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x4 permutation state from a source to a destination.
void ascon_x3_copy_to_x1(ascon_state_t *dest, const ascon_masked_state_t *src)
Copies the entire ASCON-x3 permutation state to a regular ASCON-x1 permutation state.
void ascon_x3_copy_from_x3(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x3 permutation state from a source to a destination.
void ascon_x4_copy_from_x3(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x4 permutation state from an ASCON-x3 permutation state.
void ascon_x4_copy_from_x2(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x4 permutation state from an ASCON-x2 permutation state.
void ascon_x3_copy_from_x2(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x3 permutation state from an ASCON-x2 permutation state.
void ascon_x3_copy_from_x1(ascon_masked_state_t *dest, const ascon_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x3 permutation state from a regular ASCON-x1 permutation state.
void ascon_masked_state_free(ascon_masked_state_t *state)
Frees an ASCON-x2 permutation state and attempts to destroy any sensitive material.
void ascon_masked_state_init(ascon_masked_state_t *state)
Initializes the words of a masked ASCON permutation state.
void ascon_x2_randomize(ascon_masked_state_t *state, ascon_trng_state_t *trng)
Randomizes an ASCON-x2 permutation state.
void ascon_x3_randomize(ascon_masked_state_t *state, ascon_trng_state_t *trng)
Randomizes an ASCON-x3 permutation state.
void ascon_x3_copy_from_x4(ascon_masked_state_t *dest, const ascon_masked_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x3 permutation state from an ASCON-x4 permutation state.
void ascon_x4_copy_from_x1(ascon_masked_state_t *dest, const ascon_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x4 permutation state from a regular ASCON-x1 permutation state.
void ascon_x2_copy_to_x1(ascon_state_t *dest, const ascon_masked_state_t *src)
Copies the entire ASCON-x2 permutation state to a regular ASCON-x1 permutation state.
void ascon_x2_copy_from_x1(ascon_masked_state_t *dest, const ascon_state_t *src, ascon_trng_state_t *trng)
Copies the entire ASCON-x2 permutation state from a regular ASCON-x1 permutation state.
Utility functions for operating on masked ASCON states with between 2 and 4 shares.
void ascon_masked_word_x2_load(ascon_masked_word_t *word, const uint8_t *data, ascon_trng_state_t *trng)
Loads a 64-bit big endian value from buffer, masks it, and writes it to a x2 masked word structure.
void ascon_masked_word_x2_store(uint8_t *data, const ascon_masked_word_t *word)
Unmasks and stores the contents of a x2 masked word structure.
void ascon_masked_word_x4_from_x2(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x2 masked word into a x4 masked word.
void ascon_masked_word_x3_from_x2(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x2 masked word into a x3 masked word.
void ascon_masked_word_x2_from_x4(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x4 masked word into a x2 masked word.
void ascon_masked_word_x4_load(ascon_masked_word_t *word, const uint8_t *data, ascon_trng_state_t *trng)
Loads a 64-bit big endian value from buffer, masks it, and writes it to a x4 masked word structure.
void ascon_masked_word_x3_load(ascon_masked_word_t *word, const uint8_t *data, ascon_trng_state_t *trng)
Loads a 64-bit big endian value from buffer, masks it, and writes it to a x3 masked word structure.
void ascon_masked_word_x2_from_x3(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x3 masked word into a x2 masked word.
void ascon_masked_word_x3_from_x4(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x4 masked word into a x3 masked word.
void ascon_masked_word_x3_randomize(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Randomizes a x3 masked word by incorporating fresh randomness.
void ascon_masked_word_x4_from_x3(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Converts a x3 masked word into a x4 masked word.
void ascon_masked_word_x4_randomize(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Randomizes a x4 masked word by incorporating fresh randomness.
void ascon_masked_word_x4_store(uint8_t *data, const ascon_masked_word_t *word)
Unmasks and stores the contents of a x4 masked word structure.
void ascon_masked_word_x3_store(uint8_t *data, const ascon_masked_word_t *word)
Unmasks and stores the contents of a x3 masked word structure.
void ascon_masked_word_x2_randomize(ascon_masked_word_t *dest, const ascon_masked_word_t *src, ascon_trng_state_t *trng)
Randomizes a x2 masked word by incorporating fresh randomness.
#define ascon_squeeze_8(state, data, offset)
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_init(ascon_state_t *state)
Initializes the words of the ASCON permutation state to zero.
ascon_state_t state
[snippet_key]
State of the ASCON permutation which has been masked with up to 4 shares.
State of the random number source.
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.