Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
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. More...
 

Functions

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

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 \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_CC_CTX_SIZE, \
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 109 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