ASCON Suite
|
#include "ascon-masked-word.h"
Go to the source code of this file.
Functions | |
void | ascon_masked_word_x2_zero (ascon_masked_word_t *word, ascon_trng_state_t *trng) |
Sets a x2 masked word to zero. More... | |
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. More... | |
void | ascon_masked_word_x2_load_partial (ascon_masked_word_t *word, const uint8_t *data, unsigned size, ascon_trng_state_t *trng) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x2 masked word structure. More... | |
void | ascon_masked_word_x2_load_32 (ascon_masked_word_t *word, const uint8_t *data1, const uint8_t *data2, ascon_trng_state_t *trng) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x2 masked word structure. More... | |
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. More... | |
void | ascon_masked_word_x2_store_partial (uint8_t *data, unsigned size, const ascon_masked_word_t *word) |
Unmasks and stores the contents of a x2 masked word structure to a partial buffer. More... | |
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. More... | |
void | ascon_masked_word_x2_xor (ascon_masked_word_t *dest, const ascon_masked_word_t *src) |
XOR's a source x2 masked word against a destination x2 masked word. More... | |
void | ascon_masked_word_x2_replace (ascon_masked_word_t *dest, const ascon_masked_word_t *src, unsigned size) |
Replace part of a destination x2 masked word with part of a source. More... | |
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. More... | |
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. More... | |
void | ascon_masked_word_x3_zero (ascon_masked_word_t *word, ascon_trng_state_t *trng) |
Sets a x3 masked word to zero. More... | |
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. More... | |
void | ascon_masked_word_x3_load_partial (ascon_masked_word_t *word, const uint8_t *data, unsigned size, ascon_trng_state_t *trng) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x3 masked word structure. More... | |
void | ascon_masked_word_x3_load_32 (ascon_masked_word_t *word, const uint8_t *data1, const uint8_t *data2, ascon_trng_state_t *trng) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x3 masked word structure. More... | |
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. More... | |
void | ascon_masked_word_x3_store_partial (uint8_t *data, unsigned size, const ascon_masked_word_t *word) |
Unmasks and stores the contents of a x3 masked word structure to a partial buffer. More... | |
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. More... | |
void | ascon_masked_word_x3_xor (ascon_masked_word_t *dest, const ascon_masked_word_t *src) |
XOR's a source x3 masked word against a destination x3 masked word. More... | |
void | ascon_masked_word_x3_replace (ascon_masked_word_t *dest, const ascon_masked_word_t *src, unsigned size) |
Replace part of a destination x3 masked word with part of a source. More... | |
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. More... | |
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. More... | |
void | ascon_masked_word_x4_zero (ascon_masked_word_t *word, ascon_trng_state_t *trng) |
Sets a x4 masked word to zero. More... | |
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. More... | |
void | ascon_masked_word_x4_load_partial (ascon_masked_word_t *word, const uint8_t *data, unsigned size, ascon_trng_state_t *trng) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x4 masked word structure. More... | |
void | ascon_masked_word_x4_load_32 (ascon_masked_word_t *word, const uint8_t *data1, const uint8_t *data2, ascon_trng_state_t *trng) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x4 masked word structure. More... | |
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. More... | |
void | ascon_masked_word_x4_store_partial (uint8_t *data, unsigned size, const ascon_masked_word_t *word) |
Unmasks and stores the contents of a x4 masked word structure to a partial buffer. More... | |
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. More... | |
void | ascon_masked_word_x4_xor (ascon_masked_word_t *dest, const ascon_masked_word_t *src) |
XOR's a source x4 masked word against a destination x4 masked word. More... | |
void | ascon_masked_word_x4_replace (ascon_masked_word_t *dest, const ascon_masked_word_t *src, unsigned size) |
Replace part of a destination x4 masked word with part of a source. More... | |
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. More... | |
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. More... | |
void | ascon_masked_word_pad (ascon_masked_word_t *word, unsigned offset) |
Adds a padding marker to a masked word. More... | |
void | ascon_masked_word_separator (ascon_masked_word_t *word) |
Adds a separator marker to a masked word. More... | |
void ascon_masked_word_pad | ( | ascon_masked_word_t * | word, |
unsigned | offset | ||
) |
Adds a padding marker to a masked word.
word | The masked word to be padded. |
offset | Offset of the padding marker (0 to 7). |
Definition at line 563 of file ascon-masked-word-c64.c.
void ascon_masked_word_separator | ( | ascon_masked_word_t * | word | ) |
Adds a separator marker to a masked word.
word | The masked word to add the separator marker to. |
Definition at line 568 of file ascon-masked-word-c64.c.
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.
dest | The destination x2 masked word. |
src | The source x3 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 170 of file ascon-masked-word-c64.c.
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.
dest | The destination x2 masked word. |
src | The source x4 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 188 of file ascon-masked-word-c64.c.
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.
word | The x2 masked word to write to. |
data | Points to the 64 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Definition at line 44 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_load_32 | ( | ascon_masked_word_t * | word, |
const uint8_t * | data1, | ||
const uint8_t * | data2, | ||
ascon_trng_state_t * | trng | ||
) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x2 masked word structure.
word | The x2 masked word to write to. |
data1 | Points to the high 32 bits of data to be loaded. |
data2 | Points to the low 32 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Normally ascon_masked_word_x2_load() should be used instead of this, but ASCON-80pq mixes IV and key data in the same 64-bit word.
Definition at line 93 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_load_partial | ( | ascon_masked_word_t * | word, |
const uint8_t * | data, | ||
unsigned | size, | ||
ascon_trng_state_t * | trng | ||
) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x2 masked word structure.
word | The x2 masked word to write to. |
data | Points to the data to be loaded. |
size | Number of bytes to load between 1 and 7. |
trng | TRNG to use to generate masking material. |
Definition at line 59 of file ascon-masked-word-c64.c.
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.
dest | Points to the destination for the randomized version. |
src | Points to the source to randomize, can be the same as dest. |
trng | TRNG to use to randomize the state. |
The word will still have the same effective value, but this function will mix in fresh randomness.
Definition at line 142 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_replace | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src, | ||
unsigned | size | ||
) |
Replace part of a destination x2 masked word with part of a source.
dest | Destination masked word. |
src | Source masked word. |
size | Number of bytes from the top of the masked word to copy. |
Definition at line 158 of file ascon-masked-word-c64.c.
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.
data | Points to the buffer to receive the 64 bits of unmasked data. |
word | The x2 masked word to read from. |
Definition at line 109 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_store_partial | ( | uint8_t * | data, |
unsigned | size, | ||
const ascon_masked_word_t * | word | ||
) |
Unmasks and stores the contents of a x2 masked word structure to a partial buffer.
data | Points to the buffer to receive the unmasked data. |
size | Number of bytes to unmask. |
word | The x2 masked word to read from. |
Definition at line 116 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_xor | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src | ||
) |
XOR's a source x2 masked word against a destination x2 masked word.
dest | The destination masked word. |
src | The source masked word. |
Definition at line 151 of file ascon-masked-word-c64.c.
void ascon_masked_word_x2_zero | ( | ascon_masked_word_t * | word, |
ascon_trng_state_t * | trng | ||
) |
Sets a x2 masked word to zero.
word | The x2 masked word to set to zero. |
trng | TRNG to use to generate masking material. |
Definition at line 30 of file ascon-masked-word-c64.c.
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.
dest | The destination x3 masked word. |
src | The source x2 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 350 of file ascon-masked-word-c64.c.
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.
dest | The destination x3 masked word. |
src | The source x4 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 366 of file ascon-masked-word-c64.c.
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.
word | The x3 masked word to write to. |
data | Points to the 64 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Definition at line 219 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_load_32 | ( | ascon_masked_word_t * | word, |
const uint8_t * | data1, | ||
const uint8_t * | data2, | ||
ascon_trng_state_t * | trng | ||
) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x3 masked word structure.
word | The x3 masked word to write to. |
data1 | Points to the high 32 bits of data to be loaded. |
data2 | Points to the low 32 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Normally ascon_masked_word_x3_load() should be used instead of this, but ASCON-80pq mixes IV and key data in the same 64-bit word.
Definition at line 266 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_load_partial | ( | ascon_masked_word_t * | word, |
const uint8_t * | data, | ||
unsigned | size, | ||
ascon_trng_state_t * | trng | ||
) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x3 masked word structure.
word | The x3 masked word to write to. |
data | Points to the data to be loaded. |
size | Number of bytes to load between 1 and 7. |
trng | TRNG to use to generate masking material. |
Definition at line 233 of file ascon-masked-word-c64.c.
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.
dest | Points to the destination for the randomized version. |
src | Points to the source to randomize, can be the same as dest. |
trng | TRNG to use to randomize the state. |
The word will still have the same effective value, but this function will mix in fresh randomness.
Definition at line 319 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_replace | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src, | ||
unsigned | size | ||
) |
Replace part of a destination x3 masked word with part of a source.
dest | Destination masked word. |
src | Source masked word. |
size | Number of bytes from the top of the masked word to copy. |
Definition at line 338 of file ascon-masked-word-c64.c.
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.
data | Points to the buffer to receive the 64 bits of unmasked data. |
word | The x3 masked word to read from. |
Definition at line 281 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_store_partial | ( | uint8_t * | data, |
unsigned | size, | ||
const ascon_masked_word_t * | word | ||
) |
Unmasks and stores the contents of a x3 masked word structure to a partial buffer.
data | Points to the buffer to receive the unmasked data. |
size | Number of bytes to unmask. |
word | The x3 masked word to read from. |
Definition at line 289 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_xor | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src | ||
) |
XOR's a source x3 masked word against a destination x3 masked word.
dest | The destination masked word. |
src | The source masked word. |
Definition at line 330 of file ascon-masked-word-c64.c.
void ascon_masked_word_x3_zero | ( | ascon_masked_word_t * | word, |
ascon_trng_state_t * | trng | ||
) |
Sets a x3 masked word to zero.
word | The x3 masked word to set to zero. |
trng | TRNG to use to generate masking material. |
Definition at line 205 of file ascon-masked-word-c64.c.
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.
dest | The destination x4 masked word. |
src | The source x2 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 535 of file ascon-masked-word-c64.c.
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.
dest | The destination x4 masked word. |
src | The source x3 masked word. May be the same as dest. |
trng | TRNG to use to randomize the state. |
Definition at line 548 of file ascon-masked-word-c64.c.
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.
word | The x4 masked word to write to. |
data | Points to the 64 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Definition at line 397 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_load_32 | ( | ascon_masked_word_t * | word, |
const uint8_t * | data1, | ||
const uint8_t * | data2, | ||
ascon_trng_state_t * | trng | ||
) |
Loads two 32-bit big endian values from buffers, masks them, and writes the result to a x4 masked word structure.
word | The x4 masked word to write to. |
data1 | Points to the high 32 bits of data to be loaded. |
data2 | Points to the low 32 bits of data to be loaded. |
trng | TRNG to use to generate masking material. |
Normally ascon_masked_word_x4_load() should be used instead of this, but ASCON-80pq mixes IV and key data in the same 64-bit word.
Definition at line 442 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_load_partial | ( | ascon_masked_word_t * | word, |
const uint8_t * | data, | ||
unsigned | size, | ||
ascon_trng_state_t * | trng | ||
) |
Loads a 8-bit to 56-bit big endian value from buffer, masks it, and writes it to a x4 masked word structure.
word | The x4 masked word to write to. |
data | Points to the data to be loaded. |
size | Number of bytes to load between 1 and 7. |
trng | TRNG to use to generate masking material. |
Definition at line 410 of file ascon-masked-word-c64.c.
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.
dest | Points to the destination for the randomized version. |
src | Points to the source to randomize, can be the same as dest. |
trng | TRNG to use to randomize the state. |
The word will still have the same effective value, but this function will mix in fresh randomness.
Definition at line 499 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_replace | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src, | ||
unsigned | size | ||
) |
Replace part of a destination x4 masked word with part of a source.
dest | Destination masked word. |
src | Source masked word. |
size | Number of bytes from the top of the masked word to copy. |
Definition at line 521 of file ascon-masked-word-c64.c.
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.
data | Points to the buffer to receive the 64 bits of unmasked data. |
word | The x4 masked word to read from. |
Definition at line 456 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_store_partial | ( | uint8_t * | data, |
unsigned | size, | ||
const ascon_masked_word_t * | word | ||
) |
Unmasks and stores the contents of a x4 masked word structure to a partial buffer.
data | Points to the buffer to receive the unmasked data. |
size | Number of bytes to unmask. |
word | The x4 masked word to read from. |
Definition at line 465 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_xor | ( | ascon_masked_word_t * | dest, |
const ascon_masked_word_t * | src | ||
) |
XOR's a source x4 masked word against a destination x4 masked word.
dest | The destination masked word. |
src | The source masked word. |
Definition at line 512 of file ascon-masked-word-c64.c.
void ascon_masked_word_x4_zero | ( | ascon_masked_word_t * | word, |
ascon_trng_state_t * | trng | ||
) |
Sets a x4 masked word to zero.
word | The x4 masked word to set to zero. |
trng | TRNG to use to generate masking material. |
Definition at line 385 of file ascon-masked-word-c64.c.