ASCON Suite
Functions
ascon-masked-key.c File Reference
#include <ascon/masking.h>
#include <ascon/utility.h>
#include "ascon-masked-word.h"
#include <string.h>

Go to the source code of this file.

Functions

void ascon_masked_key_128_init (ascon_masked_key_128_t *masked, const unsigned char *key)
 Initializes a masked 128-bit key for ASCON. More...
 
void ascon_masked_key_128_free (ascon_masked_key_128_t *masked)
 Frees a masked 128-bit key and destroys all sensitive material. More...
 
void ascon_masked_key_128_randomize_with_trng (ascon_masked_key_128_t *masked, ascon_trng_state_t *trng)
 Randomizes a masked 128-bit key by mixing in fresh random material from a caller-supplied TRNG. More...
 
void ascon_masked_key_128_randomize (ascon_masked_key_128_t *masked)
 Randomizes a masked 128-bit key by mixing in fresh random material. More...
 
void ascon_masked_key_128_extract (const ascon_masked_key_128_t *masked, unsigned char *key)
 Extracts the plain version of a 128-bit key from its masked version. More...
 
void ascon_masked_key_160_init (ascon_masked_key_160_t *masked, const unsigned char *key)
 Initializes a masked 160-bit key for ASCON. More...
 
void ascon_masked_key_160_free (ascon_masked_key_160_t *masked)
 Frees a masked 160-bit key and destroys all sensitive material. More...
 
void ascon_masked_key_160_randomize_with_trng (ascon_masked_key_160_t *masked, ascon_trng_state_t *trng)
 Randomizes a masked 160-bit key by mixing in fresh random material from a caller-supplied TRNG. More...
 
void ascon_masked_key_160_randomize (ascon_masked_key_160_t *masked)
 Randomizes a masked 160-bit key by mixing in fresh random material. More...
 
void ascon_masked_key_160_extract (const ascon_masked_key_160_t *masked, unsigned char *key)
 Extracts the plain version of a 160-bit key from its masked version. More...
 

Function Documentation

◆ ascon_masked_key_128_extract()

void ascon_masked_key_128_extract ( const ascon_masked_key_128_t masked,
unsigned char *  key 
)

Extracts the plain version of a 128-bit key from its masked version.

Parameters
maskedPoints to the masked key to be extracted.
keyPoints to a 16 byte buffer to receive the extracted key.

Definition at line 96 of file ascon-masked-key.c.

◆ ascon_masked_key_128_free()

void ascon_masked_key_128_free ( ascon_masked_key_128_t masked)

Frees a masked 128-bit key and destroys all sensitive material.

Parameters
maskedPoints to the masked key to be freed.

Definition at line 55 of file ascon-masked-key.c.

◆ ascon_masked_key_128_init()

void ascon_masked_key_128_init ( ascon_masked_key_128_t masked,
const unsigned char *  key 
)

Initializes a masked 128-bit key for ASCON.

Parameters
maskedMasked version of the key on output.
keyPoints to the 16 bytes of the 128-bit key to be masked.

Keys can be masked to protect them from casual snooping in memory. Or they may be masked for later use by a masked cipher.

Definition at line 28 of file ascon-masked-key.c.

◆ ascon_masked_key_128_randomize()

void ascon_masked_key_128_randomize ( ascon_masked_key_128_t masked)

Randomizes a masked 128-bit key by mixing in fresh random material.

Parameters
maskedPoints to the masked key to randomize.

Long-lived keys should be randomized regularly to mix in fresh randomness.

Definition at line 88 of file ascon-masked-key.c.

◆ ascon_masked_key_128_randomize_with_trng()

void ascon_masked_key_128_randomize_with_trng ( ascon_masked_key_128_t masked,
ascon_trng_state_t trng 
)

Randomizes a masked 128-bit key by mixing in fresh random material from a caller-supplied TRNG.

Parameters
maskedPoints to the masked key to randomize.
trngTRNG to use to randomize the key.

Long-lived keys should be randomized regularly to mix in fresh randomness.

Definition at line 61 of file ascon-masked-key.c.

◆ ascon_masked_key_160_extract()

void ascon_masked_key_160_extract ( const ascon_masked_key_160_t masked,
unsigned char *  key 
)

Extracts the plain version of a 160-bit key from its masked version.

Parameters
maskedPoints to the masked key to be extracted.
keyPoints to a 20 byte buffer to receive the extracted key.

Definition at line 209 of file ascon-masked-key.c.

◆ ascon_masked_key_160_free()

void ascon_masked_key_160_free ( ascon_masked_key_160_t masked)

Frees a masked 160-bit key and destroys all sensitive material.

Parameters
maskedPoints to the masked key to be freed.

Definition at line 170 of file ascon-masked-key.c.

◆ ascon_masked_key_160_init()

void ascon_masked_key_160_init ( ascon_masked_key_160_t masked,
const unsigned char *  key 
)

Initializes a masked 160-bit key for ASCON.

Parameters
maskedMasked version of the key on output.
keyPoints to the 20 bytes of the 160-bit key to be masked.

Keys can be masked to protect them from casual snooping in memory. Or they may be masked for later use by a masked cipher.

Definition at line 117 of file ascon-masked-key.c.

◆ ascon_masked_key_160_randomize()

void ascon_masked_key_160_randomize ( ascon_masked_key_160_t masked)

Randomizes a masked 160-bit key by mixing in fresh random material.

Parameters
maskedPoints to the masked key to randomize.

Long-lived keys should be randomized regularly to mix in fresh randomness.

Definition at line 201 of file ascon-masked-key.c.

◆ ascon_masked_key_160_randomize_with_trng()

void ascon_masked_key_160_randomize_with_trng ( ascon_masked_key_160_t masked,
ascon_trng_state_t trng 
)

Randomizes a masked 160-bit key by mixing in fresh random material from a caller-supplied TRNG.

Parameters
maskedPoints to the masked key to randomize.
trngTRNG to use to randomize the key.

Long-lived keys should be randomized regularly to mix in fresh randomness.

Definition at line 176 of file ascon-masked-key.c.