#include <crypto/chacha20.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <cstdint>
#include <vector>
Go to the source code of this file.
|
#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) |
|
|
typedef unsigned int | u32 |
|
typedef unsigned char | u8 |
|
|
static const char | sigma [] = "expand 32-byte k" |
|
static const char | tau [] = "expand 16-byte k" |
|
◆ PLUS
#define PLUS |
( |
|
v, |
|
|
|
w |
|
) |
| (U32V((v) + (w))) |
◆ PLUSONE
#define PLUSONE |
( |
|
v | ) |
(PLUS((v), 1)) |
◆ QUARTERROUND
#define QUARTERROUND |
( |
|
a, |
|
|
|
b, |
|
|
|
c, |
|
|
|
d |
|
) |
| |
◆ ROTATE
#define ROTATE |
( |
|
v, |
|
|
|
c |
|
) |
| (ROTL32(v, c)) |
◆ ROTL32
#define ROTL32 |
( |
|
v, |
|
|
|
n |
|
) |
| (U32V((v) << (n)) | ((v) >> (32 - (n)))) |
◆ U32C
◆ U32TO8_LITTLE
#define U32TO8_LITTLE |
( |
|
p, |
|
|
|
v |
|
) |
| |
◆ U32V
#define U32V |
( |
|
v | ) |
((u32)(v)&U32C(0xFFFFFFFF)) |
◆ U8C
◆ U8TO32_LITTLE
#define U8TO32_LITTLE |
( |
|
p | ) |
|
◆ U8V
#define U8V |
( |
|
v | ) |
((u8)(v)&U8C(0xFF)) |
◆ XOR
#define XOR |
( |
|
v, |
|
|
|
w |
|
) |
| ((v) ^ (w)) |
◆ u32
◆ u8
◆ ECRYPT_encrypt_bytes()
void ECRYPT_encrypt_bytes |
( |
ECRYPT_ctx * |
ctx, |
|
|
const u8 * |
plaintext, |
|
|
u8 * |
ciphertext, |
|
|
u32 |
msglen |
|
) |
| |
◆ ECRYPT_ivsetup()
◆ ECRYPT_keysetup()
◆ ECRYPT_keystream_bytes()
void ECRYPT_keystream_bytes |
( |
ECRYPT_ctx * |
ctx, |
|
|
u8 * |
keystream, |
|
|
u32 |
length |
|
) |
| |
◆ FUZZ_TARGET()
FUZZ_TARGET |
( |
crypto_diff_fuzz_chacha20 |
| ) |
|
◆ sigma
const char sigma[] = "expand 32-byte k" |
|
static |
◆ tau
const char tau[] = "expand 16-byte k" |
|
static |