Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
lc_ctr_drbg.h File Reference
#include "lc_aes.h"
#include "lc_drbg.h"
#include "lc_memory_support.h"
#include "lc_rng.h"
#include "lc_sym.h"
+ Include dependency graph for lc_ctr_drbg.h:

Go to the source code of this file.

Macros

#define LC_DRBG_CTR_USE_DF_CTX_ON_STACK(name)
 Allocate stack memory for the CTR DRBG with Derivation Function context. More...
 
#define LC_DRBG_CTR_NO_DF_CTX_ON_STACK(name)
 Allocate stack memory for the CTR DRBG without Derivation Function context. More...
 

Functions

int lc_drbg_ctr_use_df_alloc (struct lc_rng_ctx **drbg)
 Allocate CTR DRBG with Derivation Function context on heap. More...
 
int lc_drbg_ctr_no_df_alloc (struct lc_rng_ctx **drbg)
 Allocate CTR DRBG without Derivation Function context on heap. More...
 

Macro Definition Documentation

◆ LC_DRBG_CTR_NO_DF_CTX_ON_STACK

#define LC_DRBG_CTR_NO_DF_CTX_ON_STACK (   name)
Value:
_Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_DRBG_CTR_CTX_SIZE_NO_DF, \
LC_SYM_COMMON_ALIGNMENT); \
struct lc_rng_ctx *name = (struct lc_rng_ctx *)name##_ctx_buf; \
LC_DRBG_CTR_RNG_CTX(name, 0, LC_DRBG_CTR_SCRATCHPAD_NO_DF); \
_Pragma("GCC diagnostic pop")
#define LC_ALIGNED_BUFFER(name, size, alignment)
Allocate aligned stack memory.

Allocate stack memory for the CTR DRBG without Derivation Function context.

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

Definition at line 128 of file lc_ctr_drbg.h.

◆ LC_DRBG_CTR_USE_DF_CTX_ON_STACK

#define LC_DRBG_CTR_USE_DF_CTX_ON_STACK (   name)
Value:
_Pragma("GCC diagnostic push") _Pragma( \
"GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
LC_ALIGNED_BUFFER(name##_ctx_buf, LC_DRBG_CTR_CTX_SIZE_USE_DF, \
LC_SYM_COMMON_ALIGNMENT); \
struct lc_rng_ctx *name = (struct lc_rng_ctx *)name##_ctx_buf; \
LC_DRBG_CTR_RNG_CTX(name, 1, LC_DRBG_CTR_SCRATCHPAD_USE_DF); \
_Pragma("GCC diagnostic pop")

Allocate stack memory for the CTR DRBG with Derivation Function context.

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

Definition at line 111 of file lc_ctr_drbg.h.

Function Documentation

◆ lc_drbg_ctr_no_df_alloc()

int lc_drbg_ctr_no_df_alloc ( struct lc_rng_ctx **  drbg)

Allocate CTR DRBG without Derivation Function context on heap.

Parameters
[out]drbgAllocated CTR DRBG context
Warning
You MUST seed the DRNG!
Returns
: 0 on success, < 0 on error

◆ lc_drbg_ctr_use_df_alloc()

int lc_drbg_ctr_use_df_alloc ( struct lc_rng_ctx **  drbg)

Allocate CTR DRBG with Derivation Function context on heap.

Parameters
[out]drbgAllocated CTR DRBG context
Warning
You MUST seed the DRNG!
Returns
: 0 on success, < 0 on error