Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mldsa_lowram.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 *****************************************************************************/
25#ifndef CX_MLDSA_LOWRAM_H
26#define CX_MLDSA_LOWRAM_H
27
28#ifdef HAVE_MLDSA_OPTIMIZATION
29
30#include <stdint.h>
31#include "lcx_mldsa.h"
32#include "cx_mldsa_poly.h"
33
35#define MLDSA_WCOMP_BYTES 768U
36
38#define MLDSA_CCOMP_BYTES 68U
39
41#define MLDSA_MAX_OMEGA 80U
42
51void MLDSA_LOWRAM_polyw_pack(uint8_t buf[MLDSA_WCOMP_BYTES], const mldsa_poly *w);
52
59void MLDSA_LOWRAM_polyw_unpack(mldsa_poly *w, const uint8_t buf[MLDSA_WCOMP_BYTES]);
60
68void MLDSA_LOWRAM_polyw_add_idx(uint8_t buf[MLDSA_WCOMP_BYTES], int32_t a, uint32_t idx);
69
77void MLDSA_LOWRAM_polyw_sub(mldsa_poly *c,
78 const uint8_t buf[MLDSA_WCOMP_BYTES],
79 const mldsa_poly *a);
80
90void MLDSA_LOWRAM_challenge_compress(uint8_t ccomp[MLDSA_CCOMP_BYTES],
91 const mldsa_poly *cp,
92 uint8_t tau);
93
101void MLDSA_LOWRAM_challenge_decompress(mldsa_poly *cp,
102 const uint8_t ccomp[MLDSA_CCOMP_BYTES],
103 uint8_t tau);
104
116void MLDSA_LOWRAM_schoolbook_t0(mldsa_poly *c,
117 const uint8_t ccomp[MLDSA_CCOMP_BYTES],
118 const uint8_t *t0,
119 uint8_t tau);
120
132void MLDSA_LOWRAM_schoolbook_t1(mldsa_poly *c,
133 const uint8_t ccomp[MLDSA_CCOMP_BYTES],
134 const uint8_t *t1,
135 uint8_t tau);
136
149void MLDSA_LOWRAM_expand_aij_accum(uint8_t wcomp[MLDSA_WCOMP_BYTES],
150 const mldsa_poly *b,
151 const uint8_t rho[MLDSA_SEEDBYTES],
152 uint16_t nonce);
153
161void MLDSA_LOWRAM_poly_highbits(mldsa_poly *a1, const mldsa_poly *a, int32_t gamma2);
162
170void MLDSA_LOWRAM_poly_lowbits(mldsa_poly *a0, const mldsa_poly *a, int32_t gamma2);
171
186void MLDSA_LOWRAM_poly_r0(mldsa_poly *r0,
187 const uint8_t wcomp[MLDSA_WCOMP_BYTES],
188 const uint8_t *w1_packed,
189 int32_t gamma2);
190
207uint32_t MLDSA_LOWRAM_make_hint(mldsa_poly *h,
208 const mldsa_poly *ct0,
209 const uint8_t wcomp[MLDSA_WCOMP_BYTES],
210 const uint8_t *w1_packed,
211 int32_t gamma2);
212
224void MLDSA_LOWRAM_use_hint_indices(mldsa_poly *b,
225 const mldsa_poly *a,
226 const uint8_t *h_indices,
227 uint32_t num_hints,
228 int32_t gamma2);
229
240void MLDSA_LOWRAM_sample_gamma1(mldsa_poly *a,
241 const uint8_t seed[MLDSA_CRHBYTES],
242 uint16_t nonce,
243 int32_t gamma1);
244
256void MLDSA_LOWRAM_sample_gamma1_add(mldsa_poly *a,
257 const mldsa_poly *b,
258 const uint8_t seed[MLDSA_CRHBYTES],
259 uint16_t nonce,
260 int32_t gamma1);
261
262#endif /* HAVE_MLDSA_OPTIMIZATION */
263#endif /* CX_MLDSA_LOWRAM_H */
#define MLDSA_SEEDBYTES
Definition lcx_mldsa.h:40
#define MLDSA_CRHBYTES
Definition lcx_mldsa.h:41
ML-DSA (Module-Lattice Digital Signature Algorithm) public API.
Polynomial with MLDSA_N int32_t coefficients.