31 #if defined(ASCON_BACKEND_SLICED64)
35 #if defined(LW_UTIL_LITTLE_ENDIAN)
36 #define ASCON_C64_BYTE_FOR_OFFSET(state, offset) \
37 (state->B[((offset) & 0x38) + (7 - (offset & 0x07))])
39 #define ASCON_C64_BYTE_FOR_OFFSET(state, offset) (state->B[(offset)])
65 while (offset < 40 && size > 0) {
66 ASCON_C64_BYTE_FOR_OFFSET(
state, offset) ^= *
data++;
75 while (offset < 40 && size > 0) {
76 ASCON_C64_BYTE_FOR_OFFSET(
state, offset) = *
data++;
85 while (offset < 40 && size > 0) {
86 ASCON_C64_BYTE_FOR_OFFSET(
state, offset) = 0;
95 while (offset < 40 && size > 0) {
96 *
data++ = ASCON_C64_BYTE_FOR_OFFSET(
state, offset);
104 unsigned offset,
unsigned size)
106 while (offset < 40 && size > 0) {
107 *output++ = *input++ ^ ASCON_C64_BYTE_FOR_OFFSET(
state, offset);
115 unsigned offset,
unsigned size)
117 while (offset < 40 && size > 0) {
118 unsigned char in = *input++;
119 *output++ = in ^ ASCON_C64_BYTE_FOR_OFFSET(
state, offset);
120 ASCON_C64_BYTE_FOR_OFFSET(
state, offset) = in;
140 memcpy(dest->
S, src->
S,
sizeof(dest->
S));
#define ascon_backend_free(state)
#define ascon_backend_init(state)
Direct access to the ASCON permutation primitive.
void ascon_overwrite_with_zeroes(ascon_state_t *state, unsigned offset, unsigned size)
Overwrites a part of the ASCON state with zeroes.
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_copy(ascon_state_t *dest, const ascon_state_t *src)
Copies the entire ASCON permutation state from a source to a destination.
void ascon_extract_bytes(const ascon_state_t *state, uint8_t *data, unsigned offset, unsigned size)
Extracts bytes from the ASCON state.
void ascon_extract_and_overwrite_bytes(ascon_state_t *state, const uint8_t *input, uint8_t *output, unsigned offset, unsigned size)
Extracts bytes from the ASCON state and XOR's them with input bytes to produce output bytes....
void ascon_add_bytes(ascon_state_t *state, const uint8_t *data, unsigned offset, unsigned size)
Adds bytes to the ASCON state by XOR'ing them with existing bytes.
void ascon_extract_and_add_bytes(const ascon_state_t *state, const uint8_t *input, uint8_t *output, unsigned offset, unsigned size)
Extracts bytes from the ASCON state and XOR's them with input bytes to produce output bytes.
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]
unsigned char data[8]
[snippet_key]
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.