Leancrypto 0.12.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, hash)
 Allocate stack memory for the Ascon lightweight cryptor context.
 

Functions

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

Macro Definition Documentation

◆ LC_AL_CTX_ON_STACK

#define LC_AL_CTX_ON_STACK ( name,
hash )
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(hash), \
LC_ASCON_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_ASCON_SET_CTX(name, hash); \
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.

NOTE: This is defined for lc_ascon_128* as of now.

Parameters
[in]nameName of the stack variable
[in]hashHash implementation of type struct hash used for the Ascon lightweight algorithm

Definition at line 59 of file lc_ascon_lightweight.h.

Function Documentation

◆ lc_al_alloc()

int lc_al_alloc ( const struct lc_hash * hash,
struct lc_aead_ctx ** ctx )

Allocate Ascon Lightweight cryptor context on heap.

NOTE: This is defined for lc_ascon_128*.

Parameters
[in]hashHash implementation of type struct hash used for the Ascon-Keccak algorithm
[out]ctxAllocated Ascon lightweight cryptor context
Returns
0 on success, < 0 on error