Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Functions
cx_mldsa_internal.c File Reference

ML-DSA internal functions for testing (FIPS 204). More...

#include <string.h>
#include "lcx_mldsa.h"
#include "cx_mldsa_internal.h"
#include "cx_mldsa_poly.h"
#include "cx_mldsa_polyvec.h"
#include "cx_mldsa_polymat.h"
#include "cx_mldsa_sample.h"
#include "cx_mldsa_packing.h"
#include "cx_mldsa_rounding.h"
#include "cx_mldsa_util.h"
Include dependency graph for cx_mldsa_internal.c:

Go to the source code of this file.

Functions

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).
 

Detailed Description

ML-DSA internal functions for testing (FIPS 204).

These functions expose deterministic key generation, signing, and verification entry points intended only for conformance testing. They should not be called directly in production code.

Definition in file cx_mldsa_internal.c.

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_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.