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

Go to the source code of this file.

Macros

#define LC_HKDF_CTX_ON_STACK(name, hashname)
 Allocate stack memory for the HKDF context.
 
#define LC_HKDF_DRNG_CTX_SIZE(hashname)    (sizeof(struct lc_rng_ctx) + LC_HKDF_CTX_SIZE(hashname))
 
#define LC_HKDF_DRNG_SET_CTX(name, hashname)   LC_HKDF_SET_CTX(name, hashname)
 
#define LC_HKDF_RNG_CTX(name, hashname)
 
#define LC_HKDF_DRNG_CTX_ON_STACK(name, hashname)
 Allocate stack memory for the HKDF DRNG context.
 

Functions

int lc_hkdf_extract (struct lc_hkdf_ctx *hkdf_ctx, const uint8_t *ikm, size_t ikmlen, const uint8_t *salt, size_t saltlen)
 HMAC-based Extract-and-Expand Key Derivation Function (HKDF) - RFC5869 Extract phase.
 
int lc_hkdf_expand (struct lc_hkdf_ctx *hkdf_ctx, const uint8_t *info, size_t infolen, uint8_t *dst, size_t dlen)
 HMAC-based Extract-and-Expand Key Derivation Function (HKDF) - RFC5869 Expand phase.
 
static void lc_hkdf_zero (struct lc_hkdf_ctx *hkdf_ctx)
 Zeroize HKDF context allocated with either LC_HKDF_CTX_ON_STACK or hkdf_alloc.
 
int lc_hkdf_alloc (const struct lc_hash *hash, struct lc_hkdf_ctx **hkdf_ctx)
 Allocate HKDF context on heap.
 
void lc_hkdf_zero_free (struct lc_hkdf_ctx *hkdf_ctx)
 Zeroize and free HKDF context.
 
static int lc_hkdf (const struct lc_hash *hash, const uint8_t *ikm, size_t ikmlen, const uint8_t *salt, size_t saltlen, const uint8_t *info, size_t infolen, uint8_t *dst, size_t dlen)
 HMAC-based Extract-and-Expand Key Derivation Function (HKDF) - RFC5869 Complete implementation.
 
int lc_hkdf_rng_alloc (struct lc_rng_ctx **state, const struct lc_hash *hash)
 Allocation of a HKDF DRNG context.
 

Variables

const struct lc_rng * lc_hkdf_rng
 

Macro Definition Documentation

◆ LC_HKDF_DRNG_CTX_SIZE

#define LC_HKDF_DRNG_CTX_SIZE ( hashname)     (sizeof(struct lc_rng_ctx) + LC_HKDF_CTX_SIZE(hashname))

Definition at line 205 of file lc_hkdf.h.

◆ LC_HKDF_DRNG_SET_CTX

#define LC_HKDF_DRNG_SET_CTX ( name,
hashname )   LC_HKDF_SET_CTX(name, hashname)

Definition at line 208 of file lc_hkdf.h.

◆ LC_HKDF_RNG_CTX

#define LC_HKDF_RNG_CTX ( name,
hashname )
Value:
LC_RNG_CTX(name, lc_hkdf_rng); \
LC_HKDF_DRNG_SET_CTX(((struct lc_hkdf_ctx *)(name->rng_state)), \
hashname); \
lc_rng_zero(name)
const struct lc_rng * lc_hkdf_rng

Definition at line 210 of file lc_hkdf.h.

Variable Documentation

◆ lc_hkdf_rng

const struct lc_rng* lc_hkdf_rng
extern