Embedded SDK
Embedded SDK
Loading...
Searching...
No Matches
cx_mlkem_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 MLKEM_POLYVEC_H
17#define MLKEM_POLYVEC_H
18
19#include "lcx_mlkem.h"
20#include "cx_mlkem_poly.h"
21
25typedef struct {
27} polyvec;
28
36void MLKEM_POLYVEC_tobytes(uint8_t *r, const polyvec *a, uint8_t k);
37
45void MLKEM_POLYVEC_frombytes(polyvec *r, const uint8_t *a, uint8_t k);
46
53void MLKEM_POLYVEC_ntt(polyvec *r, uint8_t k);
54
61void MLKEM_POLYVEC_invntt_tomont(polyvec *r, uint8_t k);
62
69void MLKEM_POLYVEC_reduce(polyvec *r, uint8_t k);
70
78void MLKEM_POLYVEC_add(polyvec *r, const polyvec *b, uint8_t k);
79
86void MLKEM_POLYVEC_tomont(polyvec *r, uint8_t k);
87
96void MLKEM_POLYVEC_compress(uint8_t *r, const polyvec *a, uint8_t k, uint8_t du);
97
106void MLKEM_POLYVEC_decompress(polyvec *r, const uint8_t *a, uint8_t k, uint8_t du);
107
117void MLKEM_POLYVEC_basemul_acc_montgomery(poly *r, const polyvec *a, const polyvec *b, uint8_t k);
118
119#endif // MLKEM_POLYVEC_H
void MLKEM_POLYVEC_decompress(polyvec *r, const uint8_t *a, uint8_t k, uint8_t du)
Decompresses and deserializes a polynomial vector.
void MLKEM_POLYVEC_invntt_tomont(polyvec *r, uint8_t k)
Applies the inverse NTT to each polynomial in a vector.
void MLKEM_POLYVEC_reduce(polyvec *r, uint8_t k)
Reduces all coefficients of each polynomial in a vector.
void MLKEM_POLYVEC_compress(uint8_t *r, const polyvec *a, uint8_t k, uint8_t du)
Compresses and serializes a polynomial vector.
void MLKEM_POLYVEC_tomont(polyvec *r, uint8_t k)
Converts each polynomial in a vector to Montgomery domain.
void MLKEM_POLYVEC_frombytes(polyvec *r, const uint8_t *a, uint8_t k)
Deserializes a polynomial vector from bytes.
void MLKEM_POLYVEC_tobytes(uint8_t *r, const polyvec *a, uint8_t k)
Serializes a polynomial vector to bytes.
void MLKEM_POLYVEC_add(polyvec *r, const polyvec *b, uint8_t k)
Adds polynomial vector b to r in place.
void MLKEM_POLYVEC_basemul_acc_montgomery(poly *r, const polyvec *a, const polyvec *b, uint8_t k)
Accumulated pointwise multiplication of two polynomial vectors in the NTT domain.
void MLKEM_POLYVEC_ntt(polyvec *r, uint8_t k)
Applies the NTT to each polynomial in a vector.
ML-KEM (Module-Lattice Key Encapsulation Mechanism) public API.
#define MLKEM_MAX_K
Definition lcx_mlkem.h:154
Polynomial with MLKEM_N coefficients.
Vector of polynomials with up to MLKEM_MAX_K elements.