|
Leancrypto 1.7.2
Post-Quantum Cryptographic Library
|
#include "ext_headers.h"#include "lc_hash.h"#include "lc_rng.h"#include "lc_sha3.h"#include "lc_ed25519.h"#include "lc_sha512.h"#include "lc_ed448.h"
Include dependency graph for lc_dilithium_44.h:Go to the source code of this file.
Data Structures | |
| struct | lc_dilithium_44_sk |
| Dilithium secret key. More... | |
| struct | lc_dilithium_44_pk |
| Dilithium public key. More... | |
| struct | lc_dilithium_44_sig |
| Dilithium signature. More... | |
| struct | lc_dilithium_ctx |
| struct | lc_dilithium_44_ed25519_sk |
| Dilithium secret key. More... | |
| struct | lc_dilithium_44_ed25519_pk |
| Dilithium public key. More... | |
| struct | lc_dilithium_44_ed25519_sig |
| Dilithium signature. More... | |
| struct | lc_dilithium_ed25519_ctx |
| Dilithium stream context. More... | |
| struct | lc_dilithium_44_ed448_sk |
| Dilithium secret key. More... | |
| struct | lc_dilithium_44_ed448_pk |
| Dilithium public key. More... | |
| struct | lc_dilithium_44_ed448_sig |
| Dilithium signature. More... | |
| struct | lc_dilithium_ed448_ctx |
| Dilithium stream context. More... | |
Macros | |
| #define | LC_DILITHIUM_CTX_ON_STACK(name) |
| Allocate stack memory for the Dilithium stream context or additional parameter relevant for the signature operation. More... | |
| #define | LC_DILITHIUM_44_CTX_ON_STACK_AHAT(name) |
| Allocate stack memory for the Dilithium stream context and additional parameter relevant for the signature operation. More... | |
| #define | LC_DILITHIUM_ED25519_SIG |
| #define | LC_DILITHIUM_ED25519_CTX_ON_STACK(name) |
| Allocate stack memory for the Dilithium-ED25519 stream context. More... | |
| #define | LC_DILITHIUM_ED448_SIG |
| #define | LC_DILITHIUM_ED448_CTX_ON_STACK(name) |
| Allocate stack memory for the Dilithium-ED448 stream context. More... | |
Functions | |
| 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. More... | |
| int | lc_dilithium_44_ctx_alloc (struct lc_dilithium_ctx **ctx) |
| Allocate Dilithium stream context on heap. More... | |
| 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 operation. More... | |
| void | lc_dilithium_44_ctx_zero_free (struct lc_dilithium_ctx *ctx) |
| Zeroize and free Dilithium stream context. More... | |
| static LC_PURE unsigned int | lc_dilithium_44_sk_size (void) |
| Return the size of the Dilithium secret key. More... | |
| static LC_PURE unsigned int | lc_dilithium_44_pk_size (void) |
| Return the size of the Dilithium public key. More... | |
| static LC_PURE unsigned int | lc_dilithium_44_sig_size (void) |
| Return the size of the Dilithium signature. More... | |
| 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. More... | |
| int | lc_dilithium_44_pk_from_sk (struct lc_dilithium_44_pk *pk, const struct lc_dilithium_44_sk *sk) |
| Generates Dilithium public from private key. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_sign_init (struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_sk *sk) |
| Initializes a signature operation. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_verify_init (struct lc_dilithium_ctx *ctx, const struct lc_dilithium_44_pk *pk) |
| Initializes a signature verification operation. More... | |
| 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. More... | |
| 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. More... | |
| 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_ed25519_alloc. More... | |
| int | lc_dilithium_44_ed25519_ctx_alloc (struct lc_dilithium_ed25519_ctx **ctx) |
| Allocate Dilithium-ED25519 stream context on heap. More... | |
| void | lc_dilithium_44_ed25519_ctx_zero_free (struct lc_dilithium_ed25519_ctx *ctx) |
| Zeroize and free Dilithium-ED25519 stream context. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed25519_pk_from_sk (struct lc_dilithium_44_ed25519_pk *pk, const struct lc_dilithium_44_ed25519_sk *sk) |
| Generates Dilithium public from private key. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed25519_sign_init (struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_sk *sk) |
| Initiates signature generation with Dilithium context in stream operation. More... | |
| int | lc_dilithium_44_ed25519_sign_update (struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen) |
| Updates signature generation with Dilithium context in stream operation. More... | |
| 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) |
| Perform signature generation with Dilithium context in stream operation. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed25519_verify_init (struct lc_dilithium_ed25519_ctx *ctx, const struct lc_dilithium_44_ed25519_pk *pk) |
| Initiates signature verification with Dilithium context in stream operation. More... | |
| int | lc_dilithium_44_ed25519_verify_update (struct lc_dilithium_ed25519_ctx *ctx, const uint8_t *m, size_t mlen) |
| Updates signature verification with Dilithium context in stream operation. More... | |
| 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) |
| Perform signature verification with Dilithium context in stream operation. More... | |
| 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_alloc. More... | |
| int | lc_dilithium_44_ed448_ctx_alloc (struct lc_dilithium_ed448_ctx **ctx) |
| Allocate Dilithium-ED448 stream context on heap. More... | |
| void | lc_dilithium_44_ed448_ctx_zero_free (struct lc_dilithium_ed448_ctx *ctx) |
| Zeroize and free Dilithium-ED448 stream context. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed448_pk_from_sk (struct lc_dilithium_44_ed448_pk *pk, const struct lc_dilithium_44_ed448_sk *sk) |
| Generates Dilithium public from private key. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed448_sign_init (struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_sk *sk) |
| Initiates signature generation with Dilithium context in stream operation. More... | |
| int | lc_dilithium_44_ed448_sign_update (struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen) |
| Updates signature generation with Dilithium context in stream operation. More... | |
| 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) |
| Perform signature generation with Dilithium context in stream operation. More... | |
| 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. More... | |
| 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. More... | |
| int | lc_dilithium_44_ed448_verify_init (struct lc_dilithium_ed448_ctx *ctx, const struct lc_dilithium_44_ed448_pk *pk) |
| Initiates signature verification with Dilithium context in stream operation. More... | |
| int | lc_dilithium_44_ed448_verify_update (struct lc_dilithium_ed448_ctx *ctx, const uint8_t *m, size_t mlen) |
| Updates signature verification with Dilithium context in stream operation. More... | |
| 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) |
| Perform signature verification with Dilithium context in stream operation. More... | |
| struct lc_dilithium_44_sk |
Dilithium secret key.
Definition at line 151 of file lc_dilithium_44.h.
| Data Fields | ||
|---|---|---|
| uint8_t | sk[LC_DILITHIUM_SECRETKEYBYTES] | |
| struct lc_dilithium_44_pk |
Dilithium public key.
Definition at line 158 of file lc_dilithium_44.h.
| Data Fields | ||
|---|---|---|
| uint8_t | pk[LC_DILITHIUM_PUBLICKEYBYTES] | |
| struct lc_dilithium_44_sig |
Dilithium signature.
Definition at line 165 of file lc_dilithium_44.h.
| Data Fields | ||
|---|---|---|
| uint8_t | sig[LC_DILITHIUM_CRYPTO_BYTES] | |
| struct lc_dilithium_ctx |
Definition at line 170 of file lc_dilithium_44.h.
| Data Fields | ||
|---|---|---|
| void * | ahat |
Pointer to the AHat buffer. This can be provided by the caller or it must be NULL otherwise.
|
| unsigned int | ahat_expanded:1 | Was aHat already filled? This is used and set internally. |
| unsigned short | ahat_size | |
| unsigned int | composite_algorithm:1 | Indicator whether it is a composite algorithm usage. This is used and set internally. |
| struct lc_hash_ctx | dilithium_hash_ctx | Hash context used internally to the library - it should not be touched by the user. |
| const struct lc_hash * | dilithium_prehash_type |
When using HashML-DSA, set the hash reference used for the hash operation. Allowed values are lc_sha256, lc_sha512, lc_sha3_256, lc_sha3_384, lc_sha3_512, lc_shake128 and lc_shake256. Note, the actual message digest operation can be performed external to leancrypto. This parameter only shall indicate the used hash operation.
|
| const uint8_t * | external_mu |
Pointer to the external mu. If set, the signature operation will use the provided mu instead of the message. In this case, the message pointer to the signature generation or verification can be NULL. |
| size_t | external_mu_len | |
| unsigned int | ml_dsa_internal:1 |
When set to true, only the ML-DSA.Sign_internal or ML-DSA.Verify_internal are performed (see FIPS 204 chapter 6). Otherwise the ML-DSA.Sign / ML-DSA.Verify (see FIPS chapter 5) is applied.
|
| uint8_t | nist_category |
NIST category required for composite signatures. The domain separation logic depends on the selection of the right OID for the "Domain" data. |
| uint8_t | shake_state[LC_HASH_STATE_SIZE_ALIGN(LC_SHA3_256_STATE_SIZE)] | State memory of the hash context used internally to the library - it should not be touched by the user. |
| const uint8_t * | userctx |
buffer with a caller-specified context string
|
| size_t | userctxlen |
length of the user context (allowed range between 0 and 255 bytes)
|
| struct lc_dilithium_44_ed25519_sk |
Dilithium secret key.
Definition at line 696 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed25519_sk:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_sk | sk | |
| struct lc_ed25519_sk | sk_ed25519 | |
| struct lc_dilithium_44_ed25519_pk |
Dilithium public key.
Definition at line 704 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed25519_pk:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_pk | pk | |
| struct lc_ed25519_pk | pk_ed25519 | |
| struct lc_dilithium_44_ed25519_sig |
Dilithium signature.
Definition at line 712 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed25519_sig:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_sig | sig | |
| struct lc_ed25519_sig | sig_ed25519 | |
| struct lc_dilithium_ed25519_ctx |
Dilithium stream context.
This structure is used for the init/update/final operation of the Dilithium-ED25519 hybrid.
Definition at line 724 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_ed25519_ctx:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_ctx | dilithium_ctx | |
| struct lc_dilithium_44_ed448_sk |
Dilithium secret key.
Definition at line 1029 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed448_sk:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_sk | sk | |
| struct lc_ed448_sk | sk_ed448 | |
| struct lc_dilithium_44_ed448_pk |
Dilithium public key.
Definition at line 1037 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed448_pk:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_pk | pk | |
| struct lc_ed448_pk | pk_ed448 | |
| struct lc_dilithium_44_ed448_sig |
Dilithium signature.
Definition at line 1045 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_44_ed448_sig:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_44_sig | sig | |
| struct lc_ed448_sig | sig_ed448 | |
| struct lc_dilithium_ed448_ctx |
Dilithium stream context.
This structure is used for the init/update/final operation of the Dilithium-ED448 hybrid.
Definition at line 1057 of file lc_dilithium_44.h.
Collaboration diagram for lc_dilithium_ed448_ctx:| Data Fields | ||
|---|---|---|
| struct lc_dilithium_ctx | dilithium_ctx | |
| #define LC_DILITHIUM_44_CTX_ON_STACK_AHAT | ( | name | ) |
Allocate stack memory for the Dilithium stream context and additional parameter relevant for the signature operation.
In addition, the memory buffer returned by this allocation contains the space for an expanded representation of the public key which is required in both, signature generation and verification. When using this memory, the first signature operation expands the key and any subsequent operation using this context will re-use the expanded key which improves performance of the signature operation significantly.
As the same expanded structure is used for signature generation and verification and the structure can be expanded by either operation, it is perfectly legal to use one context for both operations as the expanded key can (a) be generated from either the public or the secret key and (b) it applies to both operations and (c) is identical irrespective it was generated from the public or secret key.
LC_DILITHIUM_CTX_ON_STACK instead.lc_dilithium_ctx_drop_ahat. Only after this invalidation you can use the context with a different key.| [in] | name | Name of the stack variable |
Definition at line 374 of file lc_dilithium_44.h.
| #define LC_DILITHIUM_ED25519_CTX_ON_STACK | ( | name | ) |
Allocate stack memory for the Dilithium-ED25519 stream context.
| [in] | name | Name of the stack variable |
Definition at line 754 of file lc_dilithium_44.h.
| #define LC_DILITHIUM_ED25519_SIG |
Definition at line 687 of file lc_dilithium_44.h.
| #define LC_DILITHIUM_ED448_CTX_ON_STACK | ( | name | ) |
Allocate stack memory for the Dilithium-ED448 stream context.
| [in] | name | Name of the stack variable |
Definition at line 1078 of file lc_dilithium_44.h.
| #define LC_DILITHIUM_ED448_SIG |
Definition at line 1021 of file lc_dilithium_44.h.
| int lc_dilithium_44_ctx_alloc | ( | struct lc_dilithium_ctx ** | ctx | ) |
Allocate Dilithium stream context on heap.
| [out] | ctx | Allocated Dilithium stream context |
| 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 operation.
LC_DILITHIUM_44_CTX_ON_STACK_AHAT for details.| [out] | ctx | Allocated Dilithium stream context |
|
inlinestatic |
Zeroize Dilithium context allocated with LC_DILITHIUM_CTX_ON_STACK lc_dilithium_ed25519_alloc.
| [in] | ctx | Dilithium context to be zeroized |
Definition at line 396 of file lc_dilithium_44.h.
| void lc_dilithium_44_ctx_zero_free | ( | struct lc_dilithium_ctx * | ctx | ) |
Zeroize and free Dilithium stream context.
| [in] | ctx | Dilithium stream context to be zeroized and freed |
| int lc_dilithium_44_ed25519_ctx_alloc | ( | struct lc_dilithium_ed25519_ctx ** | ctx | ) |
Allocate Dilithium-ED25519 stream context on heap.
| [out] | ctx | Allocated Dilithium-ED25519 stream context |
|
inlinestatic |
Zeroize Dilithium-ED25519 context allocated with LC_DILITHIUM_ED25519_CTX_ON_STACK lc_dilithium_ed25519_alloc.
| [in] | ctx | Dilithium-ED25519 context to be zeroized |
Definition at line 772 of file lc_dilithium_44.h.
| void lc_dilithium_44_ed25519_ctx_zero_free | ( | struct lc_dilithium_ed25519_ctx * | ctx | ) |
Zeroize and free Dilithium-ED25519 stream context.
| [in] | ctx | Dilithium-ED25519 stream context to be zeroized and freed |
| 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.
| [out] | pk | pointer to allocated output public key |
| [out] | sk | pointer to allocated output private key |
| [in] | rng_ctx | pointer to seeded random number generator context |
| int lc_dilithium_44_ed25519_pk_from_sk | ( | struct lc_dilithium_44_ed25519_pk * | pk, |
| const struct lc_dilithium_44_ed25519_sk * | sk | ||
| ) |
Generates Dilithium public from private key.
| [out] | pk | pointer to allocated output public key |
| [in] | sk | pointer private key |
| 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.
| [out] | sig | pointer to output signature |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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 | ||
| ) |
Perform signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| int lc_dilithium_44_ed25519_sign_init | ( | struct lc_dilithium_ed25519_ctx * | ctx, |
| const struct lc_dilithium_44_ed25519_sk * | sk | ||
| ) |
Initiates signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | sk | pointer to bit-packed secret key |
| int lc_dilithium_44_ed25519_sign_update | ( | struct lc_dilithium_ed25519_ctx * | ctx, |
| const uint8_t * | m, | ||
| size_t | mlen | ||
| ) |
Updates signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| 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.
| [in] | sig | pointer to input signature |
| [in] | m | pointer to message to be verified |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public key |
| 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [in] | sig | pointer to input signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message to be verified |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public key |
| 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 | ||
| ) |
Perform signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | pk | pointer to bit-packed public key |
| int lc_dilithium_44_ed25519_verify_init | ( | struct lc_dilithium_ed25519_ctx * | ctx, |
| const struct lc_dilithium_44_ed25519_pk * | pk | ||
| ) |
Initiates signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | pk | pointer to bit-packed public key |
| int lc_dilithium_44_ed25519_verify_update | ( | struct lc_dilithium_ed25519_ctx * | ctx, |
| const uint8_t * | m, | ||
| size_t | mlen | ||
| ) |
Updates signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| int lc_dilithium_44_ed448_ctx_alloc | ( | struct lc_dilithium_ed448_ctx ** | ctx | ) |
Allocate Dilithium-ED448 stream context on heap.
| [out] | ctx | Allocated Dilithium-ED448 stream context |
|
inlinestatic |
Zeroize Dilithium-ED448 context allocated with LC_DILITHIUM_ED448_CTX_ON_STACK lc_dilithium_ed448_alloc.
| [in] | ctx | Dilithium-ED448 context to be zeroized |
Definition at line 1096 of file lc_dilithium_44.h.
| void lc_dilithium_44_ed448_ctx_zero_free | ( | struct lc_dilithium_ed448_ctx * | ctx | ) |
Zeroize and free Dilithium-ED448 stream context.
| [in] | ctx | Dilithium-ED448 stream context to be zeroized and freed |
| 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.
| [out] | pk | pointer to allocated output public key |
| [out] | sk | pointer to allocated output private key |
| [in] | rng_ctx | pointer to seeded random number generator context |
| int lc_dilithium_44_ed448_pk_from_sk | ( | struct lc_dilithium_44_ed448_pk * | pk, |
| const struct lc_dilithium_44_ed448_sk * | sk | ||
| ) |
Generates Dilithium public from private key.
| [out] | pk | pointer to allocated output public key |
| [in] | sk | pointer private key |
| 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.
| [out] | sig | pointer to output signature |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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 | ||
| ) |
Perform signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| int lc_dilithium_44_ed448_sign_init | ( | struct lc_dilithium_ed448_ctx * | ctx, |
| const struct lc_dilithium_44_ed448_sk * | sk | ||
| ) |
Initiates signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | sk | pointer to bit-packed secret key |
| int lc_dilithium_44_ed448_sign_update | ( | struct lc_dilithium_ed448_ctx * | ctx, |
| const uint8_t * | m, | ||
| size_t | mlen | ||
| ) |
Updates signature generation with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| 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.
| [in] | sig | pointer to input signature |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [in] | sig | pointer to input signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public key |
| 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 | ||
| ) |
Perform signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | pk | pointer to bit-packed public key |
| int lc_dilithium_44_ed448_verify_init | ( | struct lc_dilithium_ed448_ctx * | ctx, |
| const struct lc_dilithium_44_ed448_pk * | pk | ||
| ) |
Initiates signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | pk | pointer to bit-packed public key |
| int lc_dilithium_44_ed448_verify_update | ( | struct lc_dilithium_ed448_ctx * | ctx, |
| const uint8_t * | m, | ||
| size_t | mlen | ||
| ) |
Updates signature verification with Dilithium context in stream operation.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
Just like in other streaming APIs, multiple updates are allowed.
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| 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.
| [out] | pk | pointer to allocated output public key |
| [out] | sk | pointer to allocated output private key |
| [in] | rng_ctx | pointer to seeded random number generator 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.
The idea of the function is the allowance of FIPS 204 to maintain the seed used to generate a key pair in lieu of maintaining a private key or the key pair (which used much more memory). The seed must be treated equally sensitive as a private key.
The seed is generated by simply obtaining 32 bytes from a properly seeded DRNG, i.e. the same way as a symmetric key would be generated.
| [out] | pk | pointer to allocated output public key |
| [out] | sk | pointer to allocated output private key |
| [in] | seed | buffer with the seed data which must be exactly 32 bytes in size |
| [in] | seedlen | length of the seed buffer |
| int lc_dilithium_44_pk_from_sk | ( | struct lc_dilithium_44_pk * | pk, |
| const struct lc_dilithium_44_sk * | sk | ||
| ) |
Generates Dilithium public from private key.
| [out] | pk | pointer to allocated output public key |
| [in] | sk | pointer private key |
|
inlinestatic |
Return the size of the Dilithium public key.
Definition at line 448 of file lc_dilithium_44.h.
|
inlinestatic |
Return the size of the Dilithium signature.
Definition at line 457 of file lc_dilithium_44.h.
| 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.
| [out] | sig | pointer to output signature |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [out] | sig | pointer to output signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| 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.
| [out] | sig | pointer to output signature |
| [in] | ctx | pointer to Dilithium context that was initialized with lc_dilithium_sign_init and filled with lc_dilithium_sign_update |
| [in] | sk | pointer to bit-packed secret key |
| [in] | rng_ctx | pointer to seeded random number generator context - when pointer is non-NULL, perform a randomized signing. Otherwise use deterministic signing. |
| int lc_dilithium_44_sign_init | ( | struct lc_dilithium_ctx * | ctx, |
| const struct lc_dilithium_44_sk * | sk | ||
| ) |
Initializes a signature operation.
This call is intended to support messages that are located in non-contiguous places and even becomes available at different times. This call is to be used together with the lc_dilithium_sign_update and lc_dilithium_sign_final.
| [in,out] | ctx | pointer to an allocated Dilithium context |
| [in] | sk | pointer to bit-packed secret key |
| 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.
This call is intended to support messages that are located in non-contiguous places and even becomes available at different times. This call is to be used together with the lc_dilithium_sign_init and lc_dilithium_sign_final.
| [in] | ctx | pointer to Dilithium context that was initialized with lc_dilithium_sign_init |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |
|
inlinestatic |
Return the size of the Dilithium secret key.
Definition at line 439 of file lc_dilithium_44.h.
| 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.
| [in] | sig | pointer to input signature |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public key |
| 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.
This API allows the caller to provide an arbitrary context buffer which is hashed together with the message to form the message digest to be signed.
| [in] | sig | pointer to input signature |
| [in] | ctx | reference to the allocated Dilithium context handle |
| [in] | m | pointer to message |
| [in] | mlen | length of message |
| [in] | pk | pointer to bit-packed public key |
| 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.
| [in] | sig | pointer to output signature |
| [in] | ctx | pointer to Dilithium context that was initialized with lc_dilithium_sign_init and filled with lc_dilithium_sign_update |
| [in] | pk | pointer to bit-packed public key |
| int lc_dilithium_44_verify_init | ( | struct lc_dilithium_ctx * | ctx, |
| const struct lc_dilithium_44_pk * | pk | ||
| ) |
Initializes a signature verification operation.
This call is intended to support messages that are located in non-contiguous places and even becomes available at different times. This call is to be used together with the lc_dilithium_verify_update and lc_dilithium_verify_final.
| [in,out] | ctx | pointer to an allocated Dilithium context |
| [in] | pk | pointer to bit-packed public key |
| 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.
This call is intended to support messages that are located in non-contiguous places and even becomes available at different times. This call is to be used together with the lc_dilithium_verify_init and lc_dilithium_verify_final.
| [in,out] | ctx | pointer to Dilithium context that was initialized with lc_dilithium_sign_init |
| [in] | m | pointer to message to be signed |
| [in] | mlen | length of message |