Botan 3.14.1
Crypto and TLS for C&
kyber_avx2.h
Go to the documentation of this file.
1/*
2 * Kyber/ML-KEM polynomial arithmetic using AVX2
3 * (C) 2026 Jack Lloyd
4 *
5 * Botan is released under the Simplified BSD License (see license.txt)
6 */
7
8#ifndef BOTAN_KYBER_AVX2_H_
9#define BOTAN_KYBER_AVX2_H_
10
11#include <botan/internal/kyber_constants.h>
12#include <span>
13
14namespace Botan::Kyber_AVX2 {
15
16/**
17 * AVX2 versions of the KyberPolyTraits operations of the same name.
18 *
19 * The polynomials use the standard coefficient order in memory, so the
20 * results are interchangeable with the scalar implementations: ntt and
21 * poly_pointwise_montgomery produce identical values, inverse_ntt values
22 * that are congruent mod q and within (-q, q).
23 */
24BOTAN_TEST_API void ntt(std::span<int16_t, 256> p);
25
26BOTAN_TEST_API void inverse_ntt(std::span<int16_t, 256> p);
27
28BOTAN_TEST_API void poly_pointwise_montgomery(std::span<int16_t, 256> result,
29 std::span<const int16_t, 256> lhs,
30 std::span<const int16_t, 256> rhs);
31
32} // namespace Botan::Kyber_AVX2
33
34#endif
#define BOTAN_TEST_API
Definition api.h:41
BOTAN_FN_ISA_AVX2 void inverse_ntt(std::span< int16_t, 256 > p)
BOTAN_FN_ISA_AVX2 void ntt(std::span< int16_t, 256 > p)
BOTAN_FN_ISA_AVX2 void poly_pointwise_montgomery(std::span< int16_t, 256 > result, std::span< const int16_t, 256 > lhs, std::span< const int16_t, 256 > rhs)