Leancrypto 1.7.2
Post-Quantum Cryptographic Library
Macros | Functions
lc_hash.h File Reference
#include "ext_headers.h"
#include "lc_memset_secure.h"
#include "lc_memory_support.h"
#include "lc_status.h"
+ Include dependency graph for lc_hash.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LC_HASH_CTX_ON_STACK(name, hashname)
 Allocate stack memory for the hash context. More...
 

Functions

int lc_hash_init (struct lc_hash_ctx *hash_ctx)
 Initialize hash context. More...
 
void lc_hash_update (struct lc_hash_ctx *hash_ctx, const uint8_t *in, size_t inlen)
 Update hash. More...
 
void lc_hash_final (struct lc_hash_ctx *hash_ctx, uint8_t *digest)
 Calculate message digest. More...
 
int lc_hash_set_digestsize (struct lc_hash_ctx *hash_ctx, size_t digestsize)
 Set the size of the message digest - this call is intended for SHAKE. More...
 
size_t lc_hash_digestsize (struct lc_hash_ctx *hash_ctx)
 Get the size of the message digest. More...
 
unsigned int lc_hash_blocksize (struct lc_hash_ctx *hash_ctx)
 Get the block size of the message digest (or the "rate" in terms of Sponge-based algorithms) More...
 
unsigned int lc_hash_ctxsize (struct lc_hash_ctx *hash_ctx)
 Get the context size of the message digest implementation. More...
 
void lc_hash_zero (struct lc_hash_ctx *hash_ctx)
 Zeroize Hash context allocated with either LC_HASH_CTX_ON_STACK or lc_hmac_alloc. More...
 
int lc_hash_alloc (const struct lc_hash *hash, struct lc_hash_ctx **hash_ctx)
 Allocate Hash context on heap. More...
 
void lc_hash_zero_free (struct lc_hash_ctx *hash_ctx)
 Zeroize and free hash context. More...
 
int lc_hash (const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
 Calculate message digest - one-shot. More...
 
int lc_xof (const struct lc_hash *xof, const uint8_t *in, size_t inlen, uint8_t *digest, size_t digestlen)
 Calculate message digest for an XOF - one-shot. More...
 
int lc_sponge (const struct lc_hash *hash, void *state, unsigned int rounds)
 Perform Sponge permutation on buffer. More...
 
int lc_sponge_add_bytes (const struct lc_hash *hash, void *state, const uint8_t *data, size_t offset, size_t length)
 Function to add (in GF(2), using bitwise exclusive-or) data given as bytes into the sponge state. More...
 
int lc_sponge_extract_bytes (const struct lc_hash *hash, const void *state, uint8_t *data, size_t offset, size_t length)
 Function to retrieve data from the state. The bit positions that are retrieved by this function are from offset*8 to offset*8 + length*8. More...
 
int lc_sponge_newstate (const struct lc_hash *hash, void *state, const uint8_t *data, size_t offset, size_t length)
 Function to insert a complete new sponge state. More...
 
enum lc_alg_status_val lc_hash_alg_status (const struct lc_hash *hash)
 Obtain algorithm status. More...
 
enum lc_alg_status_val lc_hash_ctx_alg_status (const struct lc_hash_ctx *ctx)
 Obtain algorithm status. More...