28#ifndef LC_DILITHIUM_44_H
29#define LC_DILITHIUM_44_H
33#include "ext_headers.h"
53#define LC_DILITHIUM_MODE 2
55#define LC_DILITHIUM_SEEDBYTES 32
56#define LC_DILITHIUM_CRHBYTES 64
57#define LC_DILITHIUM_TRBYTES 64
58#define LC_DILITHIUM_RNDBYTES 32
59#define LC_DILITHIUM_N 256
60#define LC_DILITHIUM_Q 8380417
61#define LC_DILITHIUM_D 13
62#define LC_DILITHIUM_ROOT_OF_UNITY 1753
64#if LC_DILITHIUM_MODE == 2
65#define LC_DILITHIUM_NIST_CATEGORY 1
66#define LC_DILITHIUM_LAMBDA 128
67#define LC_DILITHIUM_K 4
68#define LC_DILITHIUM_L 4
69#define LC_DILITHIUM_ETA 2
70#define LC_DILITHIUM_TAU 39
71#define LC_DILITHIUM_BETA 78
72#define LC_DILITHIUM_GAMMA1 (1 << 17)
73#define LC_DILITHIUM_GAMMA2 ((LC_DILITHIUM_Q - 1) / 88)
74#define LC_DILITHIUM_OMEGA 80
76#elif LC_DILITHIUM_MODE == 3
77#define LC_DILITHIUM_NIST_CATEGORY 3
78#define LC_DILITHIUM_LAMBDA 192
79#define LC_DILITHIUM_K 6
80#define LC_DILITHIUM_L 5
81#define LC_DILITHIUM_ETA 4
82#define LC_DILITHIUM_TAU 49
83#define LC_DILITHIUM_BETA 196
84#define LC_DILITHIUM_GAMMA1 (1 << 19)
85#define LC_DILITHIUM_GAMMA2 ((LC_DILITHIUM_Q - 1) / 32)
86#define LC_DILITHIUM_OMEGA 55
88#elif LC_DILITHIUM_MODE == 5
89#define LC_DILITHIUM_NIST_CATEGORY 5
90#define LC_DILITHIUM_LAMBDA 256
91#define LC_DILITHIUM_K 8
92#define LC_DILITHIUM_L 7
93#define LC_DILITHIUM_ETA 2
94#define LC_DILITHIUM_TAU 60
95#define LC_DILITHIUM_BETA 120
96#define LC_DILITHIUM_GAMMA1 (1 << 19)
97#define LC_DILITHIUM_GAMMA2 ((LC_DILITHIUM_Q - 1) / 32)
98#define LC_DILITHIUM_OMEGA 75
102#define LC_DILITHIUM_CTILDE_BYTES (LC_DILITHIUM_LAMBDA * 2 / 8)
103#define LC_DILITHIUM_POLYT1_PACKEDBYTES 320
104#define LC_DILITHIUM_POLYT0_PACKEDBYTES 416
105#define LC_DILITHIUM_POLYVECH_PACKEDBYTES (LC_DILITHIUM_OMEGA + LC_DILITHIUM_K)
107#if LC_DILITHIUM_GAMMA1 == (1 << 17)
108#define LC_DILITHIUM_POLYZ_PACKEDBYTES 576
109#elif LC_DILITHIUM_GAMMA1 == (1 << 19)
110#define LC_DILITHIUM_POLYZ_PACKEDBYTES 640
113#if LC_DILITHIUM_GAMMA2 == (LC_DILITHIUM_Q - 1) / 88
114#define LC_DILITHIUM_POLYW1_PACKEDBYTES 192
115#elif LC_DILITHIUM_GAMMA2 == (LC_DILITHIUM_Q - 1) / 32
116#define LC_DILITHIUM_POLYW1_PACKEDBYTES 128
119#if LC_DILITHIUM_ETA == 2
120#define LC_DILITHIUM_POLYETA_PACKEDBYTES 96
121#elif LC_DILITHIUM_ETA == 4
122#define LC_DILITHIUM_POLYETA_PACKEDBYTES 128
133#define LC_DILITHIUM_PUBLICKEYBYTES \
134 (LC_DILITHIUM_SEEDBYTES + \
135 LC_DILITHIUM_K * LC_DILITHIUM_POLYT1_PACKEDBYTES)
136#define LC_DILITHIUM_SECRETKEYBYTES \
137 (2 * LC_DILITHIUM_SEEDBYTES + LC_DILITHIUM_TRBYTES + \
138 LC_DILITHIUM_L * LC_DILITHIUM_POLYETA_PACKEDBYTES + \
139 LC_DILITHIUM_K * LC_DILITHIUM_POLYETA_PACKEDBYTES + \
140 LC_DILITHIUM_K * LC_DILITHIUM_POLYT0_PACKEDBYTES)
142#define LC_DILITHIUM_CRYPTO_BYTES \
143 (LC_DILITHIUM_CTILDE_BYTES + \
144 LC_DILITHIUM_L * LC_DILITHIUM_POLYZ_PACKEDBYTES + \
145 LC_DILITHIUM_POLYVECH_PACKEDBYTES)
153 uint8_t
sk[LC_DILITHIUM_SECRETKEYBYTES];
160 uint8_t
pk[LC_DILITHIUM_PUBLICKEYBYTES];
167 uint8_t
sig[LC_DILITHIUM_CRYPTO_BYTES];
170#ifndef LC_DILITHIUM_CTX_ON_STACK
182 uint8_t
shake_state[LC_SHA3_STATE_SIZE_ALIGN(LC_SHA3_256_CTX_SIZE)];
279#define LC_DILITHIUM_AHAT_ALIGNMENT (32)
285#define LC_DILITHIUM_44_AHAT_PAD \
286 (LC_DILITHIUM_AHAT_ALIGNMENT - \
287 (sizeof(struct lc_dilithium_ctx) % LC_DILITHIUM_AHAT_ALIGNMENT))
290#define LC_DILITHIUM_44_AHAT_SIZE \
291 (256 * sizeof(int32_t) * LC_DILITHIUM_K * LC_DILITHIUM_L)
293#ifndef LC_DILITHIUM_CTX_ON_STACK
294#define LC_DILITHIUM_CTX_SIZE \
295 sizeof(struct lc_dilithium_ctx)
297#define LC_DILITHIUM_CTX_INIT_HASH(name) \
298 LC_SHAKE_256_CTX((&(name)->dilithium_hash_ctx))
300#define LC_DILITHIUM_SET_CTX(name) \
301 LC_DILITHIUM_CTX_INIT_HASH(name); \
302 (name)->dilithium_prehash_type = NULL; \
303 (name)->ml_dsa_internal = 0; \
304 (name)->userctxlen = 0; \
305 (name)->userctx = NULL; \
306 (name)->ahat = NULL; \
307 (name)->ahat_size = 0; \
308 (name)->external_mu = NULL; \
309 (name)->external_mu_len = 0; \
310 (name)->randomizer = NULL; \
311 (name)->randomizerlen = 0; \
312 (name)->nist_category = 0;
322#ifndef LC_DILITHIUM_CTX_ON_STACK
323#define LC_DILITHIUM_CTX_ON_STACK(name) \
324 _Pragma("GCC diagnostic push") _Pragma( \
325 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
327 name##_ctx_buf, LC_DILITHIUM_CTX_SIZE, \
328 LC_HASH_COMMON_ALIGNMENT); \
329 struct lc_dilithium_ctx *name = \
330 (struct lc_dilithium_ctx *)name##_ctx_buf; \
331 LC_DILITHIUM_SET_CTX(name); \
332 _Pragma("GCC diagnostic pop")
375#define LC_DILITHIUM_44_CTX_ON_STACK_AHAT(name) \
376 _Pragma("GCC diagnostic push") _Pragma( \
377 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
379 name##_ctx_buf, LC_DILITHIUM_CTX_SIZE + \
380 LC_DILITHIUM_44_AHAT_PAD + LC_DILITHIUM_44_AHAT_SIZE, \
381 LC_HASH_COMMON_ALIGNMENT); \
382 struct lc_dilithium_ctx *name = \
383 (struct lc_dilithium_ctx *)name##_ctx_buf; \
384 LC_DILITHIUM_SET_CTX(name); \
385 name->ahat = (uint8_t *)name + LC_DILITHIUM_CTX_SIZE + \
386 LC_DILITHIUM_44_AHAT_PAD; \
387 name->ahat_expanded = 0; \
388 name->ahat_size = LC_DILITHIUM_44_AHAT_SIZE; \
389 _Pragma("GCC diagnostic pop")
473 struct lc_rng_ctx *rng_ctx);
496 const uint8_t *seed,
size_t seedlen);
513 struct lc_rng_ctx *rng_ctx);
534 const uint8_t *m,
size_t mlen,
536 struct lc_rng_ctx *rng_ctx);
588 struct lc_rng_ctx *rng_ctx);
621 const uint8_t *m,
size_t mlen,
677#define LC_DILITHIUM_ED25519_SIG
678#ifdef LC_DILITHIUM_ED25519_SIG
680#include "lc_ed25519.h"
712#ifndef LC_DILITHIUM_ED25519_CTX_ON_STACK
719#ifndef LC_DILITHIUM_ED25519_CTX_ON_STACK
720#define LC_DILITHIUM_ED25519_CTX_SIZE \
721 sizeof(struct lc_dilithium_ed25519_ctx)
730#ifndef LC_DILITHIUM_ED25519_CTX_ON_STACK
731#define LC_DILITHIUM_ED25519_CTX_ON_STACK(name) \
732 _Pragma("GCC diagnostic push") _Pragma( \
733 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
735 name##_ctx_buf, LC_DILITHIUM_ED25519_CTX_SIZE, \
736 LC_HASH_COMMON_ALIGNMENT); \
737 struct lc_dilithium_ed25519_ctx *name = \
738 (struct lc_dilithium_ed25519_ctx *)name##_ctx_buf; \
739 LC_DILITHIUM_SET_CTX(&(name)->dilithium_ctx); \
740 _Pragma("GCC diagnostic pop")
786 struct lc_rng_ctx *rng_ctx);
802 const uint8_t *m,
size_t mlen,
804 struct lc_rng_ctx *rng_ctx);
825 const uint8_t *m,
size_t mlen,
827 struct lc_rng_ctx *rng_ctx);
841 struct lc_rng_ctx *rng_ctx);
855 const uint8_t *m,
size_t mlen,
875 const uint8_t *m,
size_t mlen,
893#define LC_DILITHIUM_ED448_SIG
894#ifdef LC_DILITHIUM_ED448_SIG
928#ifndef LC_DILITHIUM_ED448_CTX_ON_STACK
935#ifndef LC_DILITHIUM_ED448_CTX_ON_STACK
936#define LC_DILITHIUM_ED448_CTX_SIZE \
937 sizeof(struct lc_dilithium_ed448_ctx)
946#ifndef LC_DILITHIUM_ED448_CTX_ON_STACK
947#define LC_DILITHIUM_ED448_CTX_ON_STACK(name) \
948 _Pragma("GCC diagnostic push") _Pragma( \
949 "GCC diagnostic ignored \"-Wdeclaration-after-statement\"") \
951 name##_ctx_buf, LC_DILITHIUM_ED448_CTX_SIZE, \
952 LC_HASH_COMMON_ALIGNMENT); \
953 struct lc_dilithium_ed448_ctx *name = \
954 (struct lc_dilithium_ed448_ctx *)name##_ctx_buf; \
955 LC_DILITHIUM_SET_CTX(&(name)->dilithium_ctx); \
956 _Pragma("GCC diagnostic pop")
1002 struct lc_rng_ctx *rng_ctx);
1018 const uint8_t *m,
size_t mlen,
1020 struct lc_rng_ctx *rng_ctx);
1041 const uint8_t *m,
size_t mlen,
1043 struct lc_rng_ctx *rng_ctx);
1057 struct lc_rng_ctx *rng_ctx);
1071 const uint8_t *m,
size_t mlen,
1091 const uint8_t *m,
size_t mlen,
1114#ifndef LC_DILITHIUM_INTERNAL
1115#undef LC_DILITHIUM_MODE
1116#undef LC_DILITHIUM_NIST_CATEGORY
1117#undef LC_DILITHIUM_SEEDBYTES
1118#undef LC_DILITHIUM_CRHBYTES
1119#undef LC_DILITHIUM_TRBYTES
1120#undef LC_DILITHIUM_RNDBYTES
1121#undef LC_DILITHIUM_N
1122#undef LC_DILITHIUM_Q
1123#undef LC_DILITHIUM_D
1124#undef LC_DILITHIUM_ROOT_OF_UNITY
1125#undef LC_DILITHIUM_LAMBDA
1126#undef LC_DILITHIUM_K
1127#undef LC_DILITHIUM_L
1128#undef LC_DILITHIUM_ETA
1129#undef LC_DILITHIUM_TAU
1130#undef LC_DILITHIUM_BETA
1131#undef LC_DILITHIUM_GAMMA1
1132#undef LC_DILITHIUM_GAMMA2
1133#undef LC_DILITHIUM_OMEGA
1134#undef LC_DILITHIUM_CTILDE_BYTES
1135#undef LC_DILITHIUM_POLYT1_PACKEDBYTES
1136#undef LC_DILITHIUM_POLYT0_PACKEDBYTES
1137#undef LC_DILITHIUM_POLYVECH_PACKEDBYTES
1138#undef LC_DILITHIUM_POLYZ_PACKEDBYTES
1139#undef LC_DILITHIUM_POLYW1_PACKEDBYTES
1140#undef LC_DILITHIUM_POLYETA_PACKEDBYTES
1141#undef LC_DILITHIUM_PUBLICKEYBYTES
1142#undef LC_DILITHIUM_SECRETKEYBYTES
1143#undef LC_DILITHIUM_CRYPTO_BYTES
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.
int lc_hash(const struct lc_hash *hash, const uint8_t *in, size_t inlen, uint8_t *digest)
Calculate message digest - one-shot.
int lc_dilithium_44_ed448_sign_init(struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_sk *sk)
struct lc_ed25519_pk pk_ed25519
struct lc_dilithium_44_pk pk
struct lc_dilithium_44_sk sk
int lc_dilithium_44_ed25519_sign_update(struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen)
int lc_dilithium_44_verify(const struct lc_dilithium_44_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_pk *pk)
Verifies ML-DSA signature in one shot.
struct lc_dilithium_44_sig sig
int lc_dilithium_44_ctx_alloc_ahat(struct lc_dilithium_ctx **ctx)
Allocate Dilithium stream context on heap including additional parameter relevant for the signature o...
void lc_dilithium_44_ed25519_ctx_zero_free(struct lc_dilithium_ed25519_ctx *ctx)
Zeroize and free Dilithium-ED25519 stream context.
int lc_dilithium_44_keypair_from_seed(struct lc_dilithium_44_pk *pk, struct lc_dilithium_44_sk *sk, const uint8_t *seed, size_t seedlen)
Generates Dilithium public and private key from a given seed.
int lc_dilithium_44_verify_ctx(const struct lc_dilithium_44_sig *sig, struct lc_dilithium_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_pk *pk)
Verifies signature with Dilithium context in one shot.
int lc_dilithium_44_keypair(struct lc_dilithium_44_pk *pk, struct lc_dilithium_44_sk *sk, struct lc_rng_ctx *rng_ctx)
Generates Dilithium public and private key.
struct lc_ed448_sk sk_ed448
int lc_dilithium_44_ed25519_sign_final(struct lc_dilithium_44_ed25519_sig *sig, struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_sk *sk, struct lc_rng_ctx *rng_ctx)
int lc_dilithium_44_ctx_alloc(struct lc_dilithium_ctx **ctx)
Allocate Dilithium stream context on heap.
int lc_dilithium_44_ed448_verify_init(struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_pk *pk)
struct lc_ed448_sig sig_ed448
int lc_dilithium_44_sign_final(struct lc_dilithium_44_sig *sig, struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature.
int lc_dilithium_44_ed25519_sign_ctx(struct lc_dilithium_44_ed25519_sig *sig, struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed25519_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature with Dilithium context in one shot.
struct lc_ed448_pk pk_ed448
int lc_dilithium_44_sign(struct lc_dilithium_44_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes ML-DSA signature in one shot.
int lc_dilithium_44_ed448_verify_update(struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen)
static LC_PURE unsigned int lc_dilithium_44_sk_size(void)
Return the size of the Dilithium secret key.
struct lc_dilithium_44_sig sig
struct lc_ed25519_sk sk_ed25519
int lc_dilithium_44_ed25519_verify_init(struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_pk *pk)
int lc_dilithium_44_ed448_ctx_alloc(struct lc_dilithium_ed448_ctx **ctx)
Allocate Dilithium-ED448 stream context on heap.
int lc_dilithium_44_ed25519_verify_update(struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen)
int lc_dilithium_44_verify_update(struct lc_dilithium_ctx *ctx, const uint8_t *m, size_t mlen)
Add more data to an already initialized signature state.
int lc_dilithium_44_ed448_verify_final(const struct lc_dilithium_44_ed448_sig *sig, struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_pk *pk)
static void lc_dilithium_44_ed25519_ctx_zero(struct lc_dilithium_ed25519_ctx *ctx)
Zeroize Dilithium-ED25519 context allocated with LC_DILITHIUM_ED25519_CTX_ON_STACK lc_dilithium_ed255...
int lc_dilithium_44_ed25519_sign_init(struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_sk *sk)
int lc_dilithium_44_ed448_sign_final(struct lc_dilithium_44_ed448_sig *sig, struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_sk *sk, struct lc_rng_ctx *rng_ctx)
int lc_dilithium_44_ed448_verify(const struct lc_dilithium_44_ed448_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed448_pk *pk)
Verifies signature in one shot.
void lc_dilithium_44_ed448_ctx_zero_free(struct lc_dilithium_ed448_ctx *ctx)
Zeroize and free Dilithium-ED448 stream context.
int lc_dilithium_44_sign_update(struct lc_dilithium_ctx *ctx, const uint8_t *m, size_t mlen)
Add more data to an already initialized signature state.
int lc_dilithium_44_ed448_keypair(struct lc_dilithium_44_ed448_pk *pk, struct lc_dilithium_44_ed448_sk *sk, struct lc_rng_ctx *rng_ctx)
Generates Dilithium public and private key.
int lc_dilithium_44_ed448_verify_ctx(const struct lc_dilithium_44_ed448_sig *sig, struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed448_pk *pk)
Verifies signature in one shot with Dilithium context.
uint8_t sk[LC_DILITHIUM_SECRETKEYBYTES]
int lc_dilithium_44_ed25519_ctx_alloc(struct lc_dilithium_ed25519_ctx **ctx)
Allocate Dilithium-ED25519 stream context on heap.
static void lc_dilithium_44_ed448_ctx_zero(struct lc_dilithium_ed448_ctx *ctx)
Zeroize Dilithium-ED448 context allocated with LC_DILITHIUM_ED448_CTX_ON_STACK lc_dilithium_ed448_all...
struct lc_dilithium_44_pk pk
static LC_PURE unsigned int lc_dilithium_44_pk_size(void)
Return the size of the Dilithium public key.
int lc_dilithium_44_ed448_sign_update(struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen)
uint8_t sig[LC_DILITHIUM_CRYPTO_BYTES]
int lc_dilithium_44_ed25519_verify(const struct lc_dilithium_44_ed25519_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed25519_pk *pk)
Verifies signature in one shot.
struct lc_dilithium_44_sk sk
int lc_dilithium_44_sign_ctx(struct lc_dilithium_44_sig *sig, struct lc_dilithium_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature with Dilithium context in one shot.
static LC_PURE unsigned int lc_dilithium_44_sig_size(void)
Return the size of the Dilithium signature.
int lc_dilithium_44_ed25519_sign(struct lc_dilithium_44_ed25519_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed25519_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature in one shot.
int lc_dilithium_44_verify_final(const struct lc_dilithium_44_sig *sig, struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_pk *pk)
Verifies signature.
int lc_dilithium_44_ed25519_verify_ctx(const struct lc_dilithium_44_ed25519_sig *sig, struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed25519_pk *pk)
Verifies signature in one shot with Dilithium context.
int lc_dilithium_44_verify_init(struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_pk *pk)
Initializes a signature verification operation.
int lc_dilithium_44_ed25519_keypair(struct lc_dilithium_44_ed25519_pk *pk, struct lc_dilithium_44_ed25519_sk *sk, struct lc_rng_ctx *rng_ctx)
Generates Dilithium public and private key.
static void lc_dilithium_44_ctx_zero(struct lc_dilithium_ctx *ctx)
Zeroize Dilithium context allocated with LC_DILITHIUM_CTX_ON_STACK lc_dilithium_ed25519_alloc.
int lc_dilithium_44_ed448_sign(struct lc_dilithium_44_ed448_sig *sig, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed448_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature in one shot.
int lc_dilithium_44_sign_init(struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_sk *sk)
Initializes a signature operation.
void lc_dilithium_44_ctx_zero_free(struct lc_dilithium_ctx *ctx)
Zeroize and free Dilithium stream context.
struct lc_ed25519_sig sig_ed25519
int lc_dilithium_44_ed448_sign_ctx(struct lc_dilithium_44_ed448_sig *sig, struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen, const struct lc_dilithium_44_ed448_sk *sk, struct lc_rng_ctx *rng_ctx)
Computes signature with Dilithium context in one shot.
int lc_dilithium_44_ed25519_verify_final(const struct lc_dilithium_44_ed25519_sig *sig, struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_pk *pk)
uint8_t pk[LC_DILITHIUM_PUBLICKEYBYTES]
unsigned int ahat_expanded
Was aHat already filled? This is used and set internally.
const uint8_t * external_mu
Pointer to the external mu.
uint8_t shake_state[LC_SHA3_STATE_SIZE_ALIGN(LC_SHA3_256_CTX_SIZE)]
State memory of the hash context used internally to the library - it should not be touched by the use...
struct lc_hash_ctx dilithium_hash_ctx
Hash context used internally to the library - it should not be touched by the user.
unsigned int ml_dsa_internal
When set to true, only the ML-DSA.Sign_internal or ML-DSA.Verify_internal are performed (see FIPS 204...
struct lc_dilithium_ctx dilithium_ctx
const uint8_t * randomizer
Pointer to the randomizer.
size_t userctxlen
length of the user context (allowed range between 0 and 255 bytes)
void * ahat
Pointer to the AHat buffer. This can be provided by the caller or it must be NULL otherwise.
struct lc_dilithium_ctx dilithium_ctx
const uint8_t * userctx
buffer with a caller-specified context string
uint8_t nist_category
NIST category required for composite signatures.
const struct lc_hash * dilithium_prehash_type
When using HashML-DSA, set the hash reference used for the hash operation. Allowed values are lc_sha2...
Dilithium stream context.
Dilithium stream context.
static void lc_memset_secure(void *s, int c, size_t n)