Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
lc_kmac_crypt.h File Reference
#include "ext_headers.h"
#include "lc_aead.h"
#include "lc_memory_support.h"
#include "lc_kmac.h"
#include "lc_memset_secure.h"
+ Include dependency graph for lc_kmac_crypt.h:

Go to the source code of this file.

Macros

#define LC_KC_CTX_ON_STACK(name, hash)
 Allocate stack memory for the KMAC cryptor context. More...
 

Functions

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

Macro Definition Documentation

◆ LC_KC_CTX_ON_STACK

#define LC_KC_CTX_ON_STACK (   name,
  hash 
)
Value:
_Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_KC_CTX_SIZE, \
LC_KMAC_CRYPT_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_KC_SET_CTX(name, hash); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the KMAC 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 HMAC authentication

Definition at line 109 of file lc_kmac_crypt.h.

Function Documentation

◆ lc_kc_alloc()

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

Allocate KMAC 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 KMAC cryptor context
Returns
0 on success, < 0 on error