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

Go to the source code of this file.

Functions

void MLDSA_SAMPLE_uniform (mldsa_poly *a, const uint8_t seed[MLDSA_SEEDBYTES], uint16_t nonce)
 Sample polynomial with uniformly random coefficients in [0, q-1] by performing rejection sampling on output stream of SHAKE128.
 
void MLDSA_SAMPLE_eta (mldsa_poly *a, const uint8_t seed[MLDSA_CRHBYTES], uint16_t nonce, uint8_t eta)
 Sample polynomial with coefficients in [-eta, eta] from SHAKE256(seed||nonce).
 
void MLDSA_SAMPLE_gamma1 (mldsa_poly *a, const uint8_t seed[MLDSA_CRHBYTES], uint16_t nonce, int32_t gamma1)
 Sample polynomial with coefficients in [-(gamma1-1), gamma1] from SHAKE256(seed||nonce).
 
void MLDSA_SAMPLE_challenge (mldsa_poly *c, const uint8_t *seed, size_t seedlen, uint8_t tau)
 Sample challenge polynomial with TAU coefficients in {-1, +1}.
 

Function Documentation

◆ MLDSA_SAMPLE_challenge()

void MLDSA_SAMPLE_challenge ( mldsa_poly c,
const uint8_t *  seed,
size_t  seedlen,
uint8_t  tau 
)

Sample challenge polynomial with TAU coefficients in {-1, +1}.

Parameters
[out]cOutput polynomial (TAU nonzero coefficients).
[in]seedChallenge hash of ctilde_bytes length.
[in]seedlenLength of seed.
[in]tauNumber of nonzero coefficients.

Definition at line 201 of file cx_mldsa_sample.c.

◆ MLDSA_SAMPLE_eta()

void MLDSA_SAMPLE_eta ( mldsa_poly a,
const uint8_t  seed[MLDSA_CRHBYTES],
uint16_t  nonce,
uint8_t  eta 
)

Sample polynomial with coefficients in [-eta, eta] from SHAKE256(seed||nonce).

Parameters
[out]aOutput polynomial.
[in]seedByte array with seed of MLDSA_CRHBYTES bytes.
[in]nonceSingle-byte nonce.
[in]etaRange parameter (2 or 4).

Definition at line 67 of file cx_mldsa_sample.c.

◆ MLDSA_SAMPLE_gamma1()

void MLDSA_SAMPLE_gamma1 ( mldsa_poly a,
const uint8_t  seed[MLDSA_CRHBYTES],
uint16_t  nonce,
int32_t  gamma1 
)

Sample polynomial with coefficients in [-(gamma1-1), gamma1] from SHAKE256(seed||nonce).

Parameters
[out]aOutput polynomial.
[in]seedByte array with seed of MLDSA_CRHBYTES bytes.
[in]nonce16-bit nonce.
[in]gamma1Coefficient range parameter.

Definition at line 130 of file cx_mldsa_sample.c.

◆ MLDSA_SAMPLE_uniform()

void MLDSA_SAMPLE_uniform ( mldsa_poly a,
const uint8_t  seed[MLDSA_SEEDBYTES],
uint16_t  nonce 
)

Sample polynomial with uniformly random coefficients in [0, q-1] by performing rejection sampling on output stream of SHAKE128.

Parameters
[out]aOutput polynomial.
[in]seedByte array with seed of MLDSA_SEEDBYTES bytes.
[in]nonceTwo-byte nonce.

Definition at line 38 of file cx_mldsa_sample.c.