Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
Functions
cx_mlkem_sample.h File Reference
#include <stdint.h>
#include "cx_errors.h"
#include "lcx_mlkem.h"
Include dependency graph for cx_mlkem_sample.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void MLKEM_SAMPLE_cbd2 (poly *r, const uint8_t *buf)
 Samples a polynomial using the centered binomial distribution with eta=2.
 
void MLKEM_SAMPLE_cbd3 (poly *r, const uint8_t *buf)
 Samples a polynomial using the centered binomial distribution with eta=3.
 
void MLKEM_SAMPLE_getnoise (poly *r, const uint8_t *seed, uint8_t nonce, uint8_t eta)
 Samples a noise polynomial using PRF and CBD.
 
void MLKEM_SAMPLE_rej_uniform (poly *r, const uint8_t *seed, uint8_t x, uint8_t y)
 Samples a polynomial using rejection sampling from a uniform distribution.
 

Function Documentation

◆ MLKEM_SAMPLE_cbd2()

void MLKEM_SAMPLE_cbd2 ( poly r,
const uint8_t *  buf 
)

Samples a polynomial using the centered binomial distribution with eta=2.

Parameters
[out]rOutput polynomial.
[in]bufInput byte buffer of 2 * MLKEM_N / 4 bytes.

Definition at line 50 of file cx_mlkem_sample.c.

◆ MLKEM_SAMPLE_cbd3()

void MLKEM_SAMPLE_cbd3 ( poly r,
const uint8_t *  buf 
)

Samples a polynomial using the centered binomial distribution with eta=3.

Parameters
[out]rOutput polynomial.
[in]bufInput byte buffer of 3 * MLKEM_N / 4 bytes.

Definition at line 65 of file cx_mlkem_sample.c.

◆ MLKEM_SAMPLE_getnoise()

void MLKEM_SAMPLE_getnoise ( poly r,
const uint8_t *  seed,
uint8_t  nonce,
uint8_t  eta 
)

Samples a noise polynomial using PRF and CBD.

Parameters
[out]rOutput polynomial.
[in]seedSeed of MLKEM_SYMBYTES bytes.
[in]nonceNonce byte.
[in]etaCBD parameter (2 or 3).

Definition at line 81 of file cx_mlkem_sample.c.

◆ MLKEM_SAMPLE_rej_uniform()

void MLKEM_SAMPLE_rej_uniform ( poly r,
const uint8_t *  seed,
uint8_t  x,
uint8_t  y 
)

Samples a polynomial using rejection sampling from a uniform distribution.

Parameters
[out]rOutput polynomial with coefficients in [0, q-1].
[in]seedSeed of MLKEM_SYMBYTES bytes.
[in]xFirst index byte for the XOF.
[in]ySecond index byte for the XOF.

Definition at line 100 of file cx_mlkem_sample.c.