Go to the source code of this file.
Data Structures | |
struct | chacha_ctx |
Defines | |
#define | U8C(v) (v##U) |
#define | U32C(v) (v##U) |
#define | U8V(v) ((u8)(v) & U8C(0xFF)) |
#define | U32V(v) ((u32)(v) & U32C(0xFFFFFFFF)) |
#define | ROTL32(v, n) (U32V((v) << (n)) | ((v) >> (32 - (n)))) |
#define | U8TO32_LITTLE(p) |
#define | U32TO8_LITTLE(p, v) |
#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) |
Typedefs | |
typedef unsigned char | u8 |
typedef unsigned int | u32 |
Functions | |
static void | chacha_keysetup (chacha_ctx *x, const u8 *k, u32 kbits, u32 ivbits) |
static void | chacha_ivsetup (chacha_ctx *x, const u8 *iv) |
static void | chacha_encrypt_bytes (chacha_ctx *x, const u8 *m, u8 *c, u32 bytes) |
Variables | |
static const char | sigma [16] |
static const char | tau [16] |
#define U8C | ( | v | ) | (v##U) |
Definition at line 20 of file chacha_private.h.
#define U32C | ( | v | ) | (v##U) |
Definition at line 21 of file chacha_private.h.
#define U8V | ( | v | ) | ((u8)(v) & U8C(0xFF)) |
Definition at line 23 of file chacha_private.h.
#define U32V | ( | v | ) | ((u32)(v) & U32C(0xFFFFFFFF)) |
Definition at line 24 of file chacha_private.h.
#define ROTL32 | ( | v, | |||
n | ) | (U32V((v) << (n)) | ((v) >> (32 - (n)))) |
Definition at line 26 of file chacha_private.h.
#define U8TO32_LITTLE | ( | p | ) |
Value:
Definition at line 29 of file chacha_private.h.
Referenced by chacha_encrypt_bytes(), chacha_ivsetup(), and chacha_keysetup().
#define U32TO8_LITTLE | ( | p, | |||
v | ) |
Value:
do { \ (p)[0] = U8V((v) ); \ (p)[1] = U8V((v) >> 8); \ (p)[2] = U8V((v) >> 16); \ (p)[3] = U8V((v) >> 24); \ } while (0)
Definition at line 35 of file chacha_private.h.
Referenced by chacha_encrypt_bytes().
#define ROTATE | ( | v, | |||
c | ) | (ROTL32(v,c)) |
Definition at line 43 of file chacha_private.h.
#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 | ) |
typedef unsigned char u8 |
Definition at line 12 of file chacha_private.h.
typedef unsigned int u32 |
Definition at line 13 of file chacha_private.h.
static void chacha_keysetup | ( | chacha_ctx * | x, | |
const u8 * | k, | |||
u32 | kbits, | |||
u32 | ivbits | |||
) | [static] |
Definition at line 60 of file chacha_private.h.
References chacha_ctx::input, sigma, tau, U8TO32_LITTLE, and UNUSED.
Referenced by chacha_reinit().
static void chacha_ivsetup | ( | chacha_ctx * | x, | |
const u8 * | iv | |||
) | [static] |
Definition at line 87 of file chacha_private.h.
References chacha_ctx::input, and U8TO32_LITTLE.
Referenced by chacha_reinit().
static void chacha_encrypt_bytes | ( | chacha_ctx * | x, | |
const u8 * | m, | |||
u8 * | c, | |||
u32 | bytes | |||
) | [static] |
Definition at line 96 of file chacha_private.h.
References chacha_ctx::input, PLUS, PLUSONE, QUARTERROUND, U32TO8_LITTLE, U8TO32_LITTLE, and XOR.
Referenced by chacha_rekey().
const char sigma[16] [static] |
Initial value:
{ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '3', '2', '-', 'b', 'y', 't', 'e', ' ', 'k' }
Definition at line 54 of file chacha_private.h.
Referenced by chacha_keysetup().
const char tau[16] [static] |
Initial value:
{ 'e', 'x', 'p', 'a', 'n', 'd', ' ', '1', '6', '-', 'b', 'y', 't', 'e', ' ', 'k' }
Definition at line 56 of file chacha_private.h.
Referenced by chacha_keysetup(), and runs().