Leancrypto 1.6.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
lc_ascon_lightweight.h File Reference
#include "lc_ascon_aead.h"
#include "lc_ascon_hash.h"
Include dependency graph for lc_ascon_lightweight.h:

Go to the source code of this file.

Macros

#define LC_AL_CTX_ON_STACK(name)
 Allocate stack memory for the Ascon lightweight cryptor context.

Functions

int lc_al_alloc (struct lc_aead_ctx **ctx)
 Allocate Ascon Lightweight cryptor context on heap.

Variables

const struct lc_aead * lc_ascon_aead

Macro Definition Documentation

◆ LC_AL_CTX_ON_STACK

#define LC_AL_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_AL_CTX_SIZE, \
LC_ASCON_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_ASCON_SET_CTX(name, lc_ascon_128a, lc_ascon_aead); \
struct lc_ascon_cryptor *__name_ascon_crypto = name->aead_state; \
__name_ascon_crypto->statesize = LC_ASCON_HASH_STATE_SIZE; \
__name_ascon_crypto->taglen = 16; \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the Ascon lightweight cryptor context.

Parameters
[in]nameName of the stack variable

Definition at line 54 of file lc_ascon_lightweight.h.

Function Documentation

◆ lc_al_alloc()

int lc_al_alloc ( struct lc_aead_ctx ** ctx)

Allocate Ascon Lightweight cryptor context on heap.

Parameters
[out]ctxAllocated Ascon lightweight cryptor context
Returns
0 on success, < 0 on error

Variable Documentation

◆ lc_ascon_aead

const struct lc_aead* lc_ascon_aead
extern