20#ifndef LC_ASCON_HASH_H
21#define LC_ASCON_HASH_H
30#define LC_ASCON_HASH_STATE_WORDS 5
31#define LC_ASCON_HASH_STATE_SIZE (LC_ASCON_HASH_STATE_WORDS * sizeof(uint64_t))
33#define LC_ASCON_HASH_RATE (64 / 8)
34#define LC_ASCON_HASH_RATE_WORDS (LC_ASCON_HASH_RATE / sizeof(uint64_t))
36#define LC_ASCON_HASH_DIGESTSIZE_BITS 256
37#define LC_ASCON_HASH_DIGESTSIZE (LC_ASCON_HASH_DIGESTSIZE_BITS >> 3)
40#undef LC_DEF_ASCON_AVX512
43 uint64_t state[LC_ASCON_HASH_STATE_WORDS
44#ifdef LC_DEF_ASCON_AVX512
52 uint8_t squeeze_more : 1;
55#define LC_ASCON_STATE_SIZE (sizeof(struct lc_ascon_hash))
56#define LC_ASCON_CTX_SIZE (sizeof(struct lc_hash) + LC_ASCON_STATE_SIZE)
58#define LC_ASCON_CTX(name, ascon) \
59 LC_HASH_SET_CTX(name, ascon); \
62#define LC_ASCON_CTX_ON_STACK(name, ascon) \
63 _Pragma("GCC diagnostic push") \
64 _Pragma("GCC diagnostic ignored \"-Wvla\"") _Pragma( \
65 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
66 LC_ALIGNED_BUFFER(name##_ctx_buf, LC_ASCON_CTX_SIZE, \
67 LC_HASH_COMMON_ALIGNMENT); \
68 struct lc_hash_ctx *name = (struct lc_hash_ctx *)name##_ctx_buf; \
69 LC_ASCON_CTX(name, ascon); \
70 _Pragma("GCC diagnostic pop")
96#define LC_ASCON_256_CTX_ON_STACK(name) \
97 LC_ASCON_CTX_ON_STACK(name, lc_ascon_256)
104#define LC_ASCON_XOF_CTX_ON_STACK(name) \
105 LC_ASCON_CTX_ON_STACK(name, lc_ascon_xof)
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
const struct lc_hash * lc_ascon_256
Ascon 256 message digest algorithm.
const struct lc_hash * lc_ascon_xof
Ascon XOF extended output function.
const struct lc_hash * lc_ascon_128a
Ascon 128a message digest algorithm.