Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mldsa_rounding.h
Go to the documentation of this file.
1/*****************************************************************************
2 * (c) 2026 Ledger SAS.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16#ifndef CX_MLDSA_ROUNDING_H
17#define CX_MLDSA_ROUNDING_H
18
19#include "cx_mldsa_poly.h"
20#include "lcx_mldsa.h"
21
31int32_t MLDSA_ROUNDING_power2round(int32_t a, int32_t *a0);
32
43int32_t MLDSA_ROUNDING_decompose(int32_t a, int32_t *a0, int32_t gamma2);
44
55uint32_t MLDSA_ROUNDING_make_hint(int32_t a0, int32_t a1, int32_t gamma2);
56
66int32_t MLDSA_ROUNDING_use_hint(int32_t a, uint32_t hint, int32_t gamma2);
67
76
86 mldsa_poly *a0,
87 const mldsa_poly *a,
88 int32_t gamma2);
89
99 const mldsa_poly *a,
100 const mldsa_poly *h,
101 int32_t gamma2);
102
103#endif /* CX_MLDSA_ROUNDING_H */
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,...
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.
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.
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,...
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....
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.
ML-DSA (Module-Lattice Digital Signature Algorithm) public API.
Polynomial with MLDSA_N int32_t coefficients.