|
Embedded SDK
Embedded SDK
|
ML-DSA sampling operations (FIPS 204). More...

Go to the source code of this file.
Macros | |
| #define | MLDSA_XOF_BLOCKBYTES 168U |
| #define | MLDSA_REJ_UNIFORM_NBLOCKS 5U |
| #define | MLDSA_REJ_UNIFORM_BUFLEN (MLDSA_REJ_UNIFORM_NBLOCKS * MLDSA_XOF_BLOCKBYTES) |
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}. | |
ML-DSA sampling operations (FIPS 204).
Implements rejection sampling for uniform, eta, gamma1, and challenge polynomial generation.
Definition in file cx_mldsa_sample.c.
| #define MLDSA_REJ_UNIFORM_BUFLEN (MLDSA_REJ_UNIFORM_NBLOCKS * MLDSA_XOF_BLOCKBYTES) |
Definition at line 36 of file cx_mldsa_sample.c.
| #define MLDSA_REJ_UNIFORM_NBLOCKS 5U |
Definition at line 35 of file cx_mldsa_sample.c.
| #define MLDSA_XOF_BLOCKBYTES 168U |
Definition at line 29 of file cx_mldsa_sample.c.
| 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}.
| [out] | c | Output polynomial (TAU nonzero coefficients). |
| [in] | seed | Challenge hash of ctilde_bytes length. |
| [in] | seedlen | Length of seed. |
| [in] | tau | Number of nonzero coefficients. |
Definition at line 201 of file cx_mldsa_sample.c.
| 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).
| [out] | a | Output polynomial. |
| [in] | seed | Byte array with seed of MLDSA_CRHBYTES bytes. |
| [in] | nonce | Single-byte nonce. |
| [in] | eta | Range parameter (2 or 4). |
Definition at line 67 of file cx_mldsa_sample.c.
| 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).
| [out] | a | Output polynomial. |
| [in] | seed | Byte array with seed of MLDSA_CRHBYTES bytes. |
| [in] | nonce | 16-bit nonce. |
| [in] | gamma1 | Coefficient range parameter. |
Definition at line 130 of file cx_mldsa_sample.c.
| 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.
| [out] | a | Output polynomial. |
| [in] | seed | Byte array with seed of MLDSA_SEEDBYTES bytes. |
| [in] | nonce | Two-byte nonce. |
Definition at line 38 of file cx_mldsa_sample.c.