Lightweight Cryptography Primitives
|
Internal implementation of the ASCON permutation. More...
#include "internal-util.h"
Go to the source code of this file.
Data Structures | |
union | ascon_state_t |
Structure of the internal state of the ASCON permutation. More... | |
Macros | |
#define | ASCON_SLICED 1 |
Defined to 1 if the 32-bit sliced version of ASCON is available. | |
#define | ascon_set_sliced(state, data, offset) |
Sets data into the ASCON state in sliced form. More... | |
#define | ascon_absorb_sliced(state, data, offset) |
Absorbs data into the ASCON state in sliced form. More... | |
#define | ascon_absorb32_low_sliced(state, data, offset) |
Absorbs 32 bits of data into the ASCON state in sliced form. More... | |
#define | ascon_absorb32_high_sliced(state, data, offset) |
Absorbs 32 bits of data into the ASCON state in sliced form. More... | |
#define | ascon_squeeze_sliced(state, data, offset) |
Squeezes data from the ASCON state in sliced form. More... | |
#define | ascon_encrypt_sliced(state, c, m, offset) |
Encrypts data using the ASCON state in sliced form. More... | |
#define | ascon_decrypt_sliced(state, m, c, offset) |
Decrypts data using the ASCON state in sliced form. More... | |
Functions | |
void | ascon_permute (ascon_state_t *state, uint8_t first_round) |
Permutes the ASCON state. More... | |
void | ascon_to_sliced (ascon_state_t *state) |
Converts an ASCON state from byte form into sliced form. More... | |
void | ascon_from_sliced (ascon_state_t *state) |
Converts an ASCON state from sliced form into byte form. More... | |
void | ascon_permute_sliced (ascon_state_t *state, uint8_t first_round) |
Permutes the ASCON state in sliced form. More... | |
Internal implementation of the ASCON permutation.
References: http://competitions.cr.yp.to/round3/asconv12.pdf, http://ascon.iaik.tugraz.at/
#define ascon_absorb32_high_sliced | ( | state, | |
data, | |||
offset | |||
) |
Absorbs 32 bits of data into the ASCON state in sliced form.
state | The ASCON state for the data to be absorbed into. |
data | Points to 4 bytes of data in big-endian byte order to absorb. |
offset | Offset of the 64-bit word within the state to absorb at, between 0 and 4. |
The data is absorbed into the high bits of the 64-bit word at offset.
#define ascon_absorb32_low_sliced | ( | state, | |
data, | |||
offset | |||
) |
Absorbs 32 bits of data into the ASCON state in sliced form.
state | The ASCON state for the data to be absorbed into. |
data | Points to 4 bytes of data in big-endian byte order to absorb. |
offset | Offset of the 64-bit word within the state to absorb at, between 0 and 4. |
The data is absorbed into the low bits of the 64-bit word at offset.
#define ascon_absorb_sliced | ( | state, | |
data, | |||
offset | |||
) |
Absorbs data into the ASCON state in sliced form.
state | The ASCON state for the data to be absorbed into. |
data | Points to 8 bytes of data in big-endian byte order to absorb. |
offset | Offset of the 64-bit word within the state to absorb at, between 0 and 4. |
#define ascon_decrypt_sliced | ( | state, | |
m, | |||
c, | |||
offset | |||
) |
Decrypts data using the ASCON state in sliced form.
state | The ASCON state. |
m | Points to 8 bytes of output plaintext in big-endian byte order. |
c | Points to 8 bytes of input ciphertext in big-endian byte order. |
offset | Offset of the 64-bit word within the state to absorb and squeeze at, between 0 and 4. |
#define ascon_encrypt_sliced | ( | state, | |
c, | |||
m, | |||
offset | |||
) |
Encrypts data using the ASCON state in sliced form.
state | The ASCON state. |
c | Points to 8 bytes of output ciphertext in big-endian byte order. |
m | Points to 8 bytes of input plaintext in big-endian byte order. |
offset | Offset of the 64-bit word within the state to absorb and squeeze at, between 0 and 4. |
#define ascon_set_sliced | ( | state, | |
data, | |||
offset | |||
) |
Sets data into the ASCON state in sliced form.
state | The ASCON state for the data to be absorbed into. |
data | Points to 8 bytes of data in big-endian byte order to set. |
offset | Offset of the 64-bit word within the state to set at, between 0 and 4. |
#define ascon_squeeze_sliced | ( | state, | |
data, | |||
offset | |||
) |
Squeezes data from the ASCON state in sliced form.
state | The ASCON state to extract the data from. |
data | Points to the 8 bytes to be extracted from the state. |
offset | Offset of the 64-bit word within the state to extract, between 0 and 4. |
void ascon_from_sliced | ( | ascon_state_t * | state | ) |
Converts an ASCON state from sliced form into byte form.
state | The ASCON state to be converted, in host byte order on entry and in big-endian byte order on exit. |
void ascon_permute | ( | ascon_state_t * | state, |
uint8_t | first_round | ||
) |
Permutes the ASCON state.
state | The ASCON state to be permuted. |
first_round | The first round (of 12) to be performed; 0, 4, or 6. |
The input and output state will be in big-endian byte order.
void ascon_permute_sliced | ( | ascon_state_t * | state, |
uint8_t | first_round | ||
) |
Permutes the ASCON state in sliced form.
state | The ASCON state to be permuted. |
first_round | The first round (of 12) to be performed; 0, 4, or 6. |
The input and output state will be in host byte order.
void ascon_to_sliced | ( | ascon_state_t * | state | ) |
Converts an ASCON state from byte form into sliced form.
state | The ASCON state to be converted, in big-endian byte order on entry and in host byte order on exit. |