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

Go to the source code of this file.

Functions

int32_t MLDSA_ROUNDING_power2round (int32_t a, int32_t *a0)
 For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*2^D + a0, with -2^{D-1} < a0 <= 2^{D-1}.
 
int32_t MLDSA_ROUNDING_decompose (int32_t a, int32_t *a0, int32_t gamma2)
 For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*ALPHA + a0, where ALPHA = 2*gamma2.
 
uint32_t MLDSA_ROUNDING_make_hint (int32_t a0, int32_t a1, int32_t gamma2)
 Compute hint bit. Returns 1 if adding ct0 to w - ct0 would change the high bits (i.e., the verifier must correct them).
 
int32_t MLDSA_ROUNDING_use_hint (int32_t a, uint32_t hint, int32_t gamma2)
 Correct high bits using hint.
 
void MLDSA_ROUNDING_poly_power2round (mldsa_poly *a1, mldsa_poly *a0, const mldsa_poly *a)
 Applies power2round to all coefficients of a polynomial.
 
void MLDSA_ROUNDING_poly_decompose (mldsa_poly *a1, mldsa_poly *a0, const mldsa_poly *a, int32_t gamma2)
 Applies decompose to all coefficients of a polynomial.
 
void MLDSA_ROUNDING_poly_use_hint (mldsa_poly *b, const mldsa_poly *a, const mldsa_poly *h, int32_t gamma2)
 Applies use_hint to all coefficients of a polynomial.
 

Function Documentation

◆ MLDSA_ROUNDING_decompose()

int32_t MLDSA_ROUNDING_decompose ( int32_t  a,
int32_t *  a0,
int32_t  gamma2 
)

For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*ALPHA + a0, where ALPHA = 2*gamma2.

Parameters
[in]aCoefficient (standard representative).
[out]a0Low bits output.
[in]gamma2Low-order rounding range.
Returns
High bits a1.

Definition at line 31 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_make_hint()

uint32_t MLDSA_ROUNDING_make_hint ( int32_t  a0,
int32_t  a1,
int32_t  gamma2 
)

Compute hint bit. Returns 1 if adding ct0 to w - ct0 would change the high bits (i.e., the verifier must correct them).

Parameters
[in]a0Low part.
[in]a1High part.
[in]gamma2Low-order rounding range.
Returns
Hint bit (0 or 1).

Definition at line 51 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_poly_decompose()

void MLDSA_ROUNDING_poly_decompose ( mldsa_poly a1,
mldsa_poly a0,
const mldsa_poly a,
int32_t  gamma2 
)

Applies decompose to all coefficients of a polynomial.

Parameters
[out]a1High bits output polynomial.
[out]a0Low bits output polynomial.
[in]aInput polynomial.
[in]gamma2Low-order rounding range.

Definition at line 94 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_poly_power2round()

void MLDSA_ROUNDING_poly_power2round ( mldsa_poly a1,
mldsa_poly a0,
const mldsa_poly a 
)

Applies power2round to all coefficients of a polynomial.

Parameters
[out]a1High bits output polynomial.
[out]a0Low bits output polynomial.
[in]aInput polynomial.

Definition at line 87 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_poly_use_hint()

void MLDSA_ROUNDING_poly_use_hint ( mldsa_poly b,
const mldsa_poly a,
const mldsa_poly h,
int32_t  gamma2 
)

Applies use_hint to all coefficients of a polynomial.

Parameters
[out]bOutput polynomial.
[in]aInput polynomial.
[in]hHint polynomial.
[in]gamma2Low-order rounding range.

Definition at line 104 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_power2round()

int32_t MLDSA_ROUNDING_power2round ( int32_t  a,
int32_t *  a0 
)

For coefficient a, compute high and low bits a0, a1 such that a mod q = a1*2^D + a0, with -2^{D-1} < a0 <= 2^{D-1}.

Parameters
[in]aCoefficient.
[out]a0Low bits output.
Returns
High bits a1.

Definition at line 23 of file cx_mldsa_rounding.c.

◆ MLDSA_ROUNDING_use_hint()

int32_t MLDSA_ROUNDING_use_hint ( int32_t  a,
uint32_t  hint,
int32_t  gamma2 
)

Correct high bits using hint.

Parameters
[in]aCoefficient.
[in]hintHint bit (0 or 1).
[in]gamma2Low-order rounding range.
Returns
Corrected high bits.

Definition at line 59 of file cx_mldsa_rounding.c.