Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Typedefs | Functions
cx_mldsa_internal.h File Reference
#include "lcx_mldsa.h"
Include dependency graph for cx_mldsa_internal.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct MLDSA_formatted_message_s MLDSA_formatted_message_t
 

Functions

cx_err_t MLDSA_internal_sign_core (uint8_t *sig, size_t sig_len, size_t *sig_actual_len, const MLDSA_formatted_message_t *formatted_mprime, const uint8_t *precomputed_mu, uint8_t *rnd, size_t rnd_len, const uint8_t *sk, size_t sk_len, MLDSA_param_t param)
 Core ML-DSA signing routine (FIPS 204, Algorithms 2 & 7).
 
cx_err_t MLDSA_internal_verify_core (const uint8_t *sig, size_t sig_len, const MLDSA_formatted_message_t *formatted_mprime, const uint8_t *precomputed_mu, const uint8_t *pk, size_t pk_len, MLDSA_param_t param)
 Core ML-DSA verification routine (FIPS 204, Algorithms 3 & 8).
 
cx_err_t MLDSA_internal_keygen (uint8_t *pk, size_t pk_len, uint8_t *sk, size_t sk_len, const uint8_t seed[MLDSA_SEEDBYTES], MLDSA_param_t param)
 Generates an ML-DSA key pair from a seed (deterministic).
 
cx_err_t MLDSA_internal_sign (uint8_t *sig, size_t sig_len, size_t *sig_actual_len, const uint8_t *mu, uint8_t *rnd, size_t rnd_len, const uint8_t *sk, size_t sk_len, MLDSA_param_t param)
 Internal ML-DSA signature generation (FIPS 204, Algorithms 2 & 7).
 
cx_err_t MLDSA_internal_verify (const uint8_t *sig, size_t sig_len, const uint8_t *mu, const uint8_t *pk, size_t pk_len, MLDSA_param_t param)
 Internal ML-DSA signature verification (FIPS 204, Algorithms 3 & 8).
 

Typedef Documentation

◆ MLDSA_formatted_message_t

Definition at line 21 of file cx_mldsa_internal.h.

Function Documentation

◆ MLDSA_internal_keygen()

cx_err_t MLDSA_internal_keygen ( uint8_t *  pk,
size_t  pk_len,
uint8_t *  sk,
size_t  sk_len,
const uint8_t  seed[MLDSA_SEEDBYTES],
MLDSA_param_t  param 
)

Generates an ML-DSA key pair from a seed (deterministic).

Parameters
[out]pkPublic key output buffer.
[in]pk_lenSize of the public key buffer in bytes.
[out]skSecret key output buffer.
[in]sk_lenSize of the secret key buffer in bytes.
[in]seedRandom seed of MLDSA_SEEDBYTES bytes.
[in]paramML-DSA parameter set selector.
Returns
CX_OK on success, error code otherwise.

Definition at line 49 of file cx_mldsa_internal.c.

◆ MLDSA_internal_sign()

cx_err_t MLDSA_internal_sign ( uint8_t *  sig,
size_t  sig_len,
size_t *  sig_actual_len,
const uint8_t *  mu,
uint8_t *  rnd,
size_t  rnd_len,
const uint8_t *  sk,
size_t  sk_len,
MLDSA_param_t  param 
)

Internal ML-DSA signature generation (FIPS 204, Algorithms 2 & 7).

Signs a message whose mu value has already been computed by the caller. Unlike MLDSA_sign(), this function does not perform message formatting or context string handling.

Parameters
[out]sigSignature output buffer.
[in]sig_lenSize of the signature buffer in bytes.
[out]sig_actual_lenActual signature length written.
[in]muPre-computed message representative (MLDSA_CRHBYTES bytes).
[in]rndSigning randomness buffer (MLDSA_RNDBYTES bytes).
[in]rnd_lenLength of the randomness buffer in bytes.
[in]skSecret key.
[in]sk_lenSecret key length in bytes.
[in]paramML-DSA parameter set selector.
Returns
CX_OK on success, error code otherwise.

Definition at line 153 of file cx_mldsa_internal.c.

◆ MLDSA_internal_sign_core()

cx_err_t MLDSA_internal_sign_core ( uint8_t *  sig,
size_t  sig_len,
size_t *  sig_actual_len,
const MLDSA_formatted_message_t formatted_mprime,
const uint8_t *  precomputed_mu,
uint8_t *  rnd,
size_t  rnd_len,
const uint8_t *  sk,
size_t  sk_len,
MLDSA_param_t  param 
)

Core ML-DSA signing routine (FIPS 204, Algorithms 2 & 7).

Performs the rejection-sampling signing loop. Accepts either a formatted message formatted_mprime (from which mu is derived) or a pre-computed precomputed_mu; exactly one must be non-NULL.

Parameters
[out]sigSignature output buffer.
[in]sig_lenSize of the signature buffer in bytes.
[out]sig_actual_lenActual signature length written on success.
[in]formatted_mprimeFormatted message M' (NULL when using precomputed_mu).
[in]precomputed_muPre-computed mu (NULL when using formatted_mprime).
[in]rndSigning randomness (MLDSA_RNDBYTES), or NULL for deterministic signing.
[in]rnd_lenLength of rnd (must be MLDSA_RNDBYTES or 0 if NULL).
[in]skSecret key.
[in]sk_lenSecret key length in bytes.
[in]paramML-DSA parameter set selector.
Returns
CX_OK on success, error code otherwise.

Definition at line 317 of file cx_mldsa.c.

◆ MLDSA_internal_verify()

cx_err_t MLDSA_internal_verify ( const uint8_t *  sig,
size_t  sig_len,
const uint8_t *  mu,
const uint8_t *  pk,
size_t  pk_len,
MLDSA_param_t  param 
)

Internal ML-DSA signature verification (FIPS 204, Algorithms 3 & 8).

Verifies a signature given a pre-computed message representative mu. Unlike MLDSA_verify(), this function does not perform message formatting or context string handling.

Parameters
[in]sigSignature to verify.
[in]sig_lenSignature length in bytes.
[in]muPre-computed message representative (MLDSA_CRHBYTES bytes).
[in]pkPublic key.
[in]pk_lenPublic key length in bytes.
[in]paramML-DSA parameter set selector.
Returns
CX_OK if signature is valid, error code otherwise.

Definition at line 174 of file cx_mldsa_internal.c.

◆ MLDSA_internal_verify_core()

cx_err_t MLDSA_internal_verify_core ( const uint8_t *  sig,
size_t  sig_len,
const MLDSA_formatted_message_t formatted_mprime,
const uint8_t *  precomputed_mu,
const uint8_t *  pk,
size_t  pk_len,
MLDSA_param_t  param 
)

Core ML-DSA verification routine (FIPS 204, Algorithms 3 & 8).

Verifies an ML-DSA signature. Accepts either a formatted message formatted_mprime (from which mu is derived) or a pre-computed precomputed_mu; exactly one must be non-NULL.

Parameters
[in]sigSignature to verify.
[in]sig_lenSignature length in bytes.
[in]formatted_mprimeFormatted message M' (NULL when using precomputed_mu).
[in]precomputed_muPre-computed mu (NULL when using formatted_mprime).
[in]pkPublic key.
[in]pk_lenPublic key length in bytes.
[in]paramML-DSA parameter set selector.
Returns
CX_OK if the signature is valid, error code otherwise.

Definition at line 577 of file cx_mldsa.c.