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

Go to the source code of this file.

Macros

#define LC_CSHAKE256_DRNG_CTX_ON_STACK(name)
 Allocate stack memory for the CSHAKE256 DRNG context.
 

Functions

int lc_cshake256_drng_alloc (struct lc_rng_ctx **state)
 Allocation of a CSHAKE DRNG context.
 

Macro Definition Documentation

◆ LC_CSHAKE256_DRNG_CTX_ON_STACK

#define LC_CSHAKE256_DRNG_CTX_ON_STACK ( name)
Value:
_Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_CSHAKE256_DRNG_CTX_SIZE, \
LC_HASH_COMMON_ALIGNMENT); \
struct lc_rng_ctx *name = (struct lc_rng_ctx *)name##_ctx_buf; \
LC_CSHAKE256_RNG_CTX(name); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the CSHAKE256 DRNG context.

Parameters
[in]nameName of the stack variable
Warning
You MUST seed the DRNG!

Definition at line 58 of file lc_cshake256_drng.h.

Function Documentation

◆ lc_cshake256_drng_alloc()

int lc_cshake256_drng_alloc ( struct lc_rng_ctx ** state)

Allocation of a CSHAKE DRNG context.

Parameters
[out]stateCSHAKE DRNG context allocated by the function

The cipher handle including its memory is allocated with this function.

The memory is pinned so that the DRNG state cannot be swapped out to disk.

Warning
You MUST seed the DRNG!
Returns
0 upon success; < 0 on error