4#ifndef PROTOCORE_CHACHA20_H
5#define PROTOCORE_CHACHA20_H
40#define PROTOCORE_CHACHA20_KEY_LEN 32
43#define PROTOCORE_CHACHA20_BLOCK_LEN 64
48 embed_bool (*
xor_)(uint8_t *,
const uint8_t *,
const uint8_t *, uint64_t,
const uint8_t *, uint8_t *, size_t);
49 embed_bool (*
block_ietf)(uint8_t *,
const uint8_t *, uint32_t,
const uint8_t *, uint8_t *);
65 const uint8_t *in, uint8_t *out,
size_t len);
embed_bool protocore_chacha20_block_ietf(uint8_t *work, const uint8_t *key, uint32_t counter, const uint8_t *nonce, uint8_t *out)
One 64-byte keystream block in the RFC 8439 layout.
embed_bool protocore_chacha20_xor_(uint8_t *work, const uint8_t *key, const uint8_t *iv, uint64_t counter, const uint8_t *in, uint8_t *out, size_t len)
XOR the OpenSSH-layout keystream over in into out.
#define PROTOCORE_UNUSED
Suppress the unused warning. Every module ends in a namespace most callers only partly use.
#define PROTOCORE_NS_LAYOUT(T,...)
Pin every dispatch slot of a table that is nothing but function pointers.
#define PROTOCORE_NS
Storage for a dispatch table. The const is load bearing.
Dispatch table. Addressed by offset, so the layout is asserted below.
embed_bool(* block_ietf)(uint8_t *, const uint8_t *, uint32_t, const uint8_t *, uint8_t *)
embed_bool(* xor_)(uint8_t *, const uint8_t *, const uint8_t *, uint64_t, const uint8_t *, uint8_t *, size_t)