Leancrypto 1.6.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
lc_chacha20_poly1305.h File Reference
#include "lc_aead.h"
#include "lc_chacha20.h"
#include "lc_memset_secure.h"
#include "lc_poly1305.h"
Include dependency graph for lc_chacha20_poly1305.h:

Go to the source code of this file.

Macros

#define LC_CHACHA20_POLY1305_CTX_ON_STACK(name)
 Allocate stack memory for the ChaCha20 Poly1305 cryptor context.

Functions

int lc_chacha20_poly1305_alloc (struct lc_aead_ctx **ctx)
 Allocate ChaCha20 Poly1305 cryptor context on heap.

Macro Definition Documentation

◆ LC_CHACHA20_POLY1305_CTX_ON_STACK

#define LC_CHACHA20_POLY1305_CTX_ON_STACK ( name)
Value:
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wvla\"") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, \
LC_CHACHA20_POLY1305_CTX_SIZE, \
LC_MEM_COMMON_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_CHACHA20_POLY1305_SET_CTX(name); \
lc_aead_zero(name); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the ChaCha20 Poly1305 cryptor context.

Parameters
[in]nameName of the stack variable

Definition at line 75 of file lc_chacha20_poly1305.h.

Function Documentation

◆ lc_chacha20_poly1305_alloc()

int lc_chacha20_poly1305_alloc ( struct lc_aead_ctx ** ctx)

Allocate ChaCha20 Poly1305 cryptor context on heap.

Parameters
[out]ctxAllocated ChaCha20 Poly1305 cryptor context
Returns
0 on success, < 0 on error