CC23x0R5DriverLibrary
sw_chacha.c File Reference
#include "sw_ecrypt-sync.h"
Include dependency graph for sw_chacha.c:

Macros

#define ECRYPT_LITTLE_ENDIAN
 
#define ROTATE(v, c)   (ROTL32(v, c))
 
#define XOR(v, w)   ((v) ^ (w))
 
#define PLUS(v, w)   (U32V((v) + (w)))
 
#define PLUSONE(v)   (PLUS((v), 1))
 
#define QUARTERROUND(a, b, c, d)
 

Functions

static void salsa20_wordtobyte (u8 output[64], const u32 input[16])
 
void ECRYPT_init (void)
 
void ECRYPT_keysetup (ECRYPT_ctx *x, const u8 *k, u32 kbits, u32 ivbits)
 
void ECRYPT_ivsetup (ECRYPT_ctx *x, const u8 *iv)
 
void ECRYPT_encrypt_bytes (ECRYPT_ctx *x, const u8 *m, u8 *c, u32 bytes)
 
void ECRYPT_decrypt_bytes (ECRYPT_ctx *x, const u8 *c, u8 *m, u32 bytes)
 
void ECRYPT_keystream_bytes (ECRYPT_ctx *x, u8 *stream, u32 bytes)
 

Variables

static const char sigma [16] = "expand 32-byte k"
 
static const char tau [16] = "expand 16-byte k"
 

Macro Definition Documentation

§ ECRYPT_LITTLE_ENDIAN

#define ECRYPT_LITTLE_ENDIAN

§ ROTATE

#define ROTATE (   v,
 
)    (ROTL32(v, c))

§ XOR

#define XOR (   v,
 
)    ((v) ^ (w))

§ PLUS

#define PLUS (   v,
 
)    (U32V((v) + (w)))

Referenced by salsa20_wordtobyte().

§ PLUSONE

#define PLUSONE (   v)    (PLUS((v), 1))

Referenced by ECRYPT_encrypt_bytes().

§ QUARTERROUND

#define QUARTERROUND (   a,
  b,
  c,
 
)
Value:
x[a] = PLUS(x[a], x[b]); \
x[d] = ROTATE(XOR(x[d], x[a]), 16); \
x[c] = PLUS(x[c], x[d]); \
x[b] = ROTATE(XOR(x[b], x[c]), 12); \
x[a] = PLUS(x[a], x[b]); \
x[d] = ROTATE(XOR(x[d], x[a]), 8); \
x[c] = PLUS(x[c], x[d]); \
x[b] = ROTATE(XOR(x[b], x[c]), 7);
#define PLUS(v, w)
Definition: sw_chacha.c:16
#define XOR(v, w)
Definition: sw_chacha.c:15
#define ROTATE(v, c)
Definition: sw_chacha.c:14

Referenced by salsa20_wordtobyte().

Function Documentation

§ salsa20_wordtobyte()

static void salsa20_wordtobyte ( u8  output[64],
const u32  input[16] 
)
static

References PLUS, QUARTERROUND, and U32TO8_LITTLE.

Referenced by ECRYPT_encrypt_bytes().

§ ECRYPT_init()

void ECRYPT_init ( void  )

§ ECRYPT_keysetup()

void ECRYPT_keysetup ( ECRYPT_ctx x,
const u8 *  k,
u32  kbits,
u32  ivbits 
)

§ ECRYPT_ivsetup()

void ECRYPT_ivsetup ( ECRYPT_ctx x,
const u8 *  iv 
)

References ECRYPT_ctx::input, and U8TO32_LITTLE.

§ ECRYPT_encrypt_bytes()

void ECRYPT_encrypt_bytes ( ECRYPT_ctx x,
const u8 *  m,
u8 *  c,
u32  bytes 
)

§ ECRYPT_decrypt_bytes()

void ECRYPT_decrypt_bytes ( ECRYPT_ctx x,
const u8 *  c,
u8 *  m,
u32  bytes 
)

§ ECRYPT_keystream_bytes()

void ECRYPT_keystream_bytes ( ECRYPT_ctx x,
u8 *  stream,
u32  bytes 
)

Variable Documentation

§ sigma

const char sigma[16] = "expand 32-byte k"
static

Referenced by ECRYPT_keysetup().

§ tau

const char tau[16] = "expand 16-byte k"
static

Referenced by ECRYPT_keysetup().