Lightweight Cryptography Primitives
 All Data Structures Files Functions Variables Typedefs Macros Pages
Data Structures | Macros | Typedefs | Functions
internal-tinyjambu.h File Reference

Internal implementation of the TinyJAMBU permutation. More...

#include "internal-util.h"

Go to the source code of this file.

Data Structures

struct  tiny_jambu_state_t
 TinyJAMBU permutation state. More...
 

Macros

#define tiny_jambu_key_load_even(ptr)   ((tiny_jambu_key_word_t)(~(le_load_word32((ptr)))))
 Loads an even key word for TinyJAMBU. More...
 
#define tiny_jambu_key_load_odd(ptr)   ((tiny_jambu_key_word_t)(~(le_load_word32((ptr)))))
 Loads an odd key word for TinyJAMBU. More...
 
#define tiny_jambu_init_state(state)   ((state)->s[0] = (state)->s[1] = (state)->s[2] = (state)->s[3] = 0)
 Initializes a TinyJAMBU state to zero. More...
 
#define tiny_jambu_add_domain(state, domain)   ((state)->s[1] ^= (domain))
 Adds a domain separation value to the TinyJAMBU state. More...
 
#define tiny_jambu_absorb(state, word)   ((state)->s[3] ^= (word))
 Absorbs a 32-bit word into the TinyJAMBU state. More...
 
#define tiny_jambu_squeeze(state)   ((state)->s[2])
 Squeezes a 32-bit word from the TinyJAMBU state. More...
 
#define TINYJAMBU_ROUNDS(steps)   ((steps) / 128)
 Converts a number of steps into a number of rounds, where each round consists of 128 steps. More...
 

Typedefs

typedef uint32_t tiny_jambu_key_word_t
 Size of a word in the key schedule (32 or 64 bits).
 

Functions

void tiny_jambu_permutation_128 (tiny_jambu_state_t *state, const tiny_jambu_key_word_t *key, unsigned rounds)
 Perform the TinyJAMBU-128 permutation. More...
 
void tiny_jambu_permutation_192 (tiny_jambu_state_t *state, const tiny_jambu_key_word_t *key, unsigned rounds)
 Perform the TinyJAMBU-192 permutation. More...
 
void tiny_jambu_permutation_256 (tiny_jambu_state_t *state, const tiny_jambu_key_word_t *key, unsigned rounds)
 Perform the TinyJAMBU-256 permutation. More...
 

Detailed Description

Internal implementation of the TinyJAMBU permutation.

Macro Definition Documentation

#define tiny_jambu_absorb (   state,
  word 
)    ((state)->s[3] ^= (word))

Absorbs a 32-bit word into the TinyJAMBU state.

Parameters
stateTinyJAMBU state to be updated.
wordWord value to absorb.
#define tiny_jambu_add_domain (   state,
  domain 
)    ((state)->s[1] ^= (domain))

Adds a domain separation value to the TinyJAMBU state.

Parameters
stateTinyJAMBU state to be updated.
domainDomain separation value to add.
#define tiny_jambu_init_state (   state)    ((state)->s[0] = (state)->s[1] = (state)->s[2] = (state)->s[3] = 0)

Initializes a TinyJAMBU state to zero.

Parameters
stateTinyJAMBU state to be initialized.
#define tiny_jambu_key_load_even (   ptr)    ((tiny_jambu_key_word_t)(~(le_load_word32((ptr)))))

Loads an even key word for TinyJAMBU.

Parameters
ptrPoints to the 4 bytes of the key word in little-endian order.
Returns
The key word.
#define tiny_jambu_key_load_odd (   ptr)    ((tiny_jambu_key_word_t)(~(le_load_word32((ptr)))))

Loads an odd key word for TinyJAMBU.

Parameters
ptrPoints to the 4 bytes of the key word in little-endian order.
Returns
The key word.
#define tiny_jambu_squeeze (   state)    ((state)->s[2])

Squeezes a 32-bit word from the TinyJAMBU state.

Parameters
stateTinyJAMBU state to squeeze from.
Returns
Word value that was squeezed out.
#define TINYJAMBU_ROUNDS (   steps)    ((steps) / 128)

Converts a number of steps into a number of rounds, where each round consists of 128 steps.

Parameters
stepsThe number of steps to perform; 384, 1024, 1152, or 1280.
Returns
The number of rounds corresponding to steps.

Function Documentation

void tiny_jambu_permutation_128 ( tiny_jambu_state_t state,
const tiny_jambu_key_word_t key,
unsigned  rounds 
)

Perform the TinyJAMBU-128 permutation.

Parameters
stateTinyJAMBU-128 state to be permuted.
keyPoints to the 4 key words.
roundsThe number of rounds to perform.
Note
The words of the key must be the inverted version of the actual key so that we can replace NAND with AND operations when evaluating the permutation.
void tiny_jambu_permutation_192 ( tiny_jambu_state_t state,
const tiny_jambu_key_word_t key,
unsigned  rounds 
)

Perform the TinyJAMBU-192 permutation.

Parameters
stateTinyJAMBU-192 state to be permuted.
keyPoints to the 6 key words.
roundsThe number of rounds to perform.
Note
The words of the key must be the inverted version of the actual key so that we can replace NAND with AND operations when evaluating the permutation.
void tiny_jambu_permutation_256 ( tiny_jambu_state_t state,
const tiny_jambu_key_word_t key,
unsigned  rounds 
)

Perform the TinyJAMBU-256 permutation.

Parameters
stateTinyJAMBU-256 state to be permuted.
keyPoints to the 8 key words.
roundsThe number of rounds to perform.
Note
The words of the key must be the inverted version of the actual key so that we can replace NAND with AND operations when evaluating the permutation.