Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mldsa_polyvec.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_POLYVEC_H
17#define CX_MLDSA_POLYVEC_H
18
19#include "cx_mldsa_poly.h"
20#include "lcx_mldsa.h"
21
25typedef struct {
28
32typedef struct {
35
39void MLDSA_POLYVEC_ntt_l(mldsa_polyvecl *v, uint8_t l);
40
44void MLDSA_POLYVEC_ntt_k(mldsa_polyveck *v, uint8_t k);
45
50
60 const mldsa_polyvecl *u,
61 const mldsa_polyvecl *v,
62 uint8_t l);
63
67void MLDSA_POLYVEC_add_k(mldsa_polyveck *a, const mldsa_polyveck *b, uint8_t k);
68
72void MLDSA_POLYVEC_sub_k(mldsa_polyveck *a, const mldsa_polyveck *b, uint8_t k);
73
77void MLDSA_POLYVEC_reduce_k(mldsa_polyveck *v, uint8_t k);
78
82void MLDSA_POLYVEC_caddq_k(mldsa_polyveck *v, uint8_t k);
83
89int MLDSA_POLYVEC_chknorm_l(const mldsa_polyvecl *v, int32_t B, uint8_t l);
90
96int MLDSA_POLYVEC_chknorm_k(const mldsa_polyveck *v, int32_t B, uint8_t k);
97
101void MLDSA_POLYVEC_shiftl_k(mldsa_polyveck *v, uint8_t k);
102
112 mldsa_polyveck *v0,
113 const mldsa_polyveck *v,
114 uint8_t k);
115
120 mldsa_polyveck *v0,
121 const mldsa_polyveck *v,
122 int32_t gamma2,
123 uint8_t k);
124
137 const mldsa_polyveck *v0,
138 const mldsa_polyveck *v1,
139 int32_t gamma2,
140 uint8_t k);
141
146 const mldsa_polyveck *u,
147 const mldsa_polyveck *h,
148 int32_t gamma2,
149 uint8_t k);
150
159void MLDSA_POLYVEC_pack_w1(uint8_t *r, const mldsa_polyveck *w1, int32_t gamma2, uint8_t k);
160
161#endif /* CX_MLDSA_POLYVEC_H */
void MLDSA_POLYVEC_ntt_k(mldsa_polyveck *v, uint8_t k)
Apply NTT to all polynomials in a K-vector.
void MLDSA_POLYVEC_add_k(mldsa_polyveck *a, const mldsa_polyveck *b, uint8_t k)
Add K-vector b to K-vector a.
void MLDSA_POLYVEC_pack_w1(uint8_t *r, const mldsa_polyveck *w1, int32_t gamma2, uint8_t k)
Pack w1 vector.
uint32_t MLDSA_POLYVEC_make_hint_k(mldsa_polyveck *h, const mldsa_polyveck *v0, const mldsa_polyveck *v1, int32_t gamma2, uint8_t k)
Make hint for K-vectors.
void MLDSA_POLYVEC_use_hint_k(mldsa_polyveck *w, const mldsa_polyveck *u, const mldsa_polyveck *h, int32_t gamma2, uint8_t k)
Use hint to correct high bits of K-vector.
void MLDSA_POLYVEC_pointwise_acc_montgomery(mldsa_poly *w, const mldsa_polyvecl *u, const mldsa_polyvecl *v, uint8_t l)
Inner product of L-vectors in NTT domain with accumulation.
void MLDSA_POLYVEC_decompose_k(mldsa_polyveck *v1, mldsa_polyveck *v0, const mldsa_polyveck *v, int32_t gamma2, uint8_t k)
Decompose all polynomials in K-vector.
void MLDSA_POLYVEC_power2round_k(mldsa_polyveck *v1, mldsa_polyveck *v0, const mldsa_polyveck *v, uint8_t k)
Power2round all polynomials in K-vector.
void MLDSA_POLYVEC_invntt_tomont_k(mldsa_polyveck *v, uint8_t k)
Apply inverse NTT to all polynomials in a K-vector.
int MLDSA_POLYVEC_chknorm_l(const mldsa_polyvecl *v, int32_t B, uint8_t l)
Check infinity norm of an L-vector.
void MLDSA_POLYVEC_sub_k(mldsa_polyveck *a, const mldsa_polyveck *b, uint8_t k)
Subtract K-vector b from K-vector a.
int MLDSA_POLYVEC_chknorm_k(const mldsa_polyveck *v, int32_t B, uint8_t k)
Check infinity norm of a K-vector.
void MLDSA_POLYVEC_shiftl_k(mldsa_polyveck *v, uint8_t k)
Shift left all polynomials in K-vector by D bits.
void MLDSA_POLYVEC_reduce_k(mldsa_polyveck *v, uint8_t k)
Apply reduce to all polynomials in a K-vector.
void MLDSA_POLYVEC_ntt_l(mldsa_polyvecl *v, uint8_t l)
Apply NTT to all polynomials in an L-vector.
void MLDSA_POLYVEC_caddq_k(mldsa_polyveck *v, uint8_t k)
Apply caddq to all polynomials in a K-vector.
ML-DSA (Module-Lattice Digital Signature Algorithm) public API.
#define MLDSA_MAX_K
Definition lcx_mldsa.h:160
#define MLDSA_MAX_L
Definition lcx_mldsa.h:161
Polynomial with MLDSA_N int32_t coefficients.
Polynomial vector of up to MLDSA_MAX_K polynomials.
Polynomial vector of up to MLDSA_MAX_L polynomials.