Bitcoin Core  27.99.0
P2P Digital Currency
Classes | Macros | Typedefs | Functions | Variables
crypto_diff_fuzz_chacha20.cpp File Reference
#include <crypto/chacha20.h>
#include <test/fuzz/FuzzedDataProvider.h>
#include <test/fuzz/fuzz.h>
#include <test/fuzz/util.h>
#include <cstdint>
#include <vector>
Include dependency graph for crypto_diff_fuzz_chacha20.cpp:

Go to the source code of this file.

Classes

struct  ECRYPT_ctx
 

Macros

#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 int u32
 
typedef unsigned char u8
 

Functions

void ECRYPT_keysetup (ECRYPT_ctx *ctx, const u8 *key, u32 keysize, u32 ivsize)
 
void ECRYPT_ivsetup (ECRYPT_ctx *ctx, const u8 *iv)
 
void ECRYPT_encrypt_bytes (ECRYPT_ctx *ctx, const u8 *plaintext, u8 *ciphertext, u32 msglen)
 
void ECRYPT_keystream_bytes (ECRYPT_ctx *ctx, u8 *keystream, u32 length)
 
 FUZZ_TARGET (crypto_diff_fuzz_chacha20)
 

Variables

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

Macro Definition Documentation

◆ PLUS

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

Definition at line 83 of file crypto_diff_fuzz_chacha20.cpp.

◆ PLUSONE

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

Definition at line 84 of file crypto_diff_fuzz_chacha20.cpp.

◆ QUARTERROUND

#define QUARTERROUND (   a,
  b,
  c,
 
)
Value:
a = PLUS(a, b); d = ROTATE(XOR(d, a), 16); \
c = PLUS(c, d); b = ROTATE(XOR(b, c), 12); \
a = PLUS(a, b); d = ROTATE(XOR(d, a), 8); \
c = PLUS(c, d); b = ROTATE(XOR(b, c), 7);
#define ROTATE(v, c)
#define PLUS(v, w)
#define XOR(v, w)

Definition at line 86 of file crypto_diff_fuzz_chacha20.cpp.

◆ ROTATE

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

Definition at line 81 of file crypto_diff_fuzz_chacha20.cpp.

◆ ROTL32

#define ROTL32 (   v,
 
)    (U32V((v) << (n)) | ((v) >> (32 - (n))))

Definition at line 29 of file crypto_diff_fuzz_chacha20.cpp.

◆ U32C

#define U32C (   v)    (v##U)

Definition at line 24 of file crypto_diff_fuzz_chacha20.cpp.

◆ U32TO8_LITTLE

#define U32TO8_LITTLE (   p,
 
)
Value:
do { \
(p)[0] = U8V((v)); \
(p)[1] = U8V((v) >> 8); \
(p)[2] = U8V((v) >> 16); \
(p)[3] = U8V((v) >> 24); \
} while (0)
#define U8V(v)

Definition at line 35 of file crypto_diff_fuzz_chacha20.cpp.

◆ U32V

#define U32V (   v)    ((u32)(v)&U32C(0xFFFFFFFF))

Definition at line 27 of file crypto_diff_fuzz_chacha20.cpp.

◆ U8C

#define U8C (   v)    (v##U)

Definition at line 23 of file crypto_diff_fuzz_chacha20.cpp.

◆ U8TO32_LITTLE

#define U8TO32_LITTLE (   p)
Value:
(((u32)((p)[0])) | ((u32)((p)[1]) << 8) | ((u32)((p)[2]) << 16) | \
((u32)((p)[3]) << 24))
unsigned int u32

Definition at line 31 of file crypto_diff_fuzz_chacha20.cpp.

◆ U8V

#define U8V (   v)    ((u8)(v)&U8C(0xFF))

Definition at line 26 of file crypto_diff_fuzz_chacha20.cpp.

◆ XOR

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

Definition at line 82 of file crypto_diff_fuzz_chacha20.cpp.

Typedef Documentation

◆ u32

typedef unsigned int u32

Definition at line 20 of file crypto_diff_fuzz_chacha20.cpp.

◆ u8

typedef unsigned char u8

Definition at line 21 of file crypto_diff_fuzz_chacha20.cpp.

Function Documentation

◆ ECRYPT_encrypt_bytes()

void ECRYPT_encrypt_bytes ( ECRYPT_ctx ctx,
const u8 plaintext,
u8 ciphertext,
u32  msglen 
)

Definition at line 127 of file crypto_diff_fuzz_chacha20.cpp.

Here is the caller graph for this function:

◆ ECRYPT_ivsetup()

void ECRYPT_ivsetup ( ECRYPT_ctx ctx,
const u8 iv 
)

Definition at line 119 of file crypto_diff_fuzz_chacha20.cpp.

Here is the caller graph for this function:

◆ ECRYPT_keysetup()

void ECRYPT_keysetup ( ECRYPT_ctx ctx,
const u8 key,
u32  keysize,
u32  ivsize 
)

Definition at line 95 of file crypto_diff_fuzz_chacha20.cpp.

Here is the caller graph for this function:

◆ ECRYPT_keystream_bytes()

void ECRYPT_keystream_bytes ( ECRYPT_ctx ctx,
u8 keystream,
u32  length 
)

Definition at line 260 of file crypto_diff_fuzz_chacha20.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ FUZZ_TARGET()

FUZZ_TARGET ( crypto_diff_fuzz_chacha20  )

Definition at line 268 of file crypto_diff_fuzz_chacha20.cpp.

Here is the call graph for this function:

Variable Documentation

◆ sigma

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

Definition at line 92 of file crypto_diff_fuzz_chacha20.cpp.

◆ tau

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

Definition at line 93 of file crypto_diff_fuzz_chacha20.cpp.