Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
lc_hash_crypt.h File Reference
#include "lc_aead.h"
#include "lc_hash_drbg.h"
#include "lc_hmac.h"
#include "lc_memset_secure.h"
+ Include dependency graph for lc_hash_crypt.h:

Go to the source code of this file.

Macros

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

Functions

static size_t lc_hc_get_tagsize (struct lc_hc_cryptor *hc)
 Return maximum size of authentication tag. More...
 
int lc_hc_alloc (const struct lc_hash *hash, struct lc_aead_ctx **ctx)
 Allocate Hash cryptor context on heap. More...
 

Macro Definition Documentation

◆ LC_HC_CTX_ON_STACK

#define LC_HC_CTX_ON_STACK (   name,
  hash 
)
Value:
_Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_HC_CTX_SIZE, \
LC_HASH_COMMON_ALIGNMENT); \
struct lc_aead_ctx *name = (struct lc_aead_ctx *)name##_ctx_buf; \
LC_HC_SET_CTX(name, hash); \
lc_aead_zero(name); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the hash cryptor context.

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

Definition at line 101 of file lc_hash_crypt.h.

Function Documentation

◆ lc_hc_alloc()

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

Allocate Hash cryptor context on heap.

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

◆ lc_hc_get_tagsize()

static size_t lc_hc_get_tagsize ( struct lc_hc_cryptor *  hc)
inlinestatic

Return maximum size of authentication tag.

Parameters
[in]hcHash cryptor context handle
Returns
size of tag

Definition at line 76 of file lc_hash_crypt.h.