Leancrypto 0.12.0
Post-Quantum Cryptographic Library
Loading...
Searching...
No Matches
lc_cshake_crypt.h File Reference
#include "lc_aead.h"
#include "lc_memory_support.h"
#include "lc_cshake.h"
#include "lc_memset_secure.h"
+ Include dependency graph for lc_cshake_crypt.h:

Go to the source code of this file.

Macros

#define LC_CC_CTX_ON_STACK(name, hash)
 Allocate stack memory for the cSHAKE cryptor context.
 

Functions

int lc_cc_alloc (const struct lc_hash *hash, struct lc_aead_ctx **ctx)
 Allocate cSHAKE cryptor context on heap.
 

Macro Definition Documentation

◆ LC_CC_CTX_ON_STACK

#define LC_CC_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_CC_CTX_SIZE(hash), \
LC_CSHAKE_CRYPT_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_CC_SET_CTX(name, hash); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the cSHAKE cryptor context.

NOTE: This is defined for lc_cshake256 as of now.

Parameters
[in]nameName of the stack variable
[in]hashHash implementation of type struct hash used for the cSHAKE authentication

Definition at line 110 of file lc_cshake_crypt.h.

Function Documentation

◆ lc_cc_alloc()

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

Allocate cSHAKE cryptor context on heap.

NOTE: This is defined for lc_cshake256 as of now.

Parameters
[in]hashHash implementation of type struct hash used for the HMAC authentication
[out]ctxAllocated cSHAKE cryptor context
Returns
0 on success, < 0 on error