11#ifndef BOTAN_KYBER_HELPERS_H_
12#define BOTAN_KYBER_HELPERS_H_
14#include <botan/internal/ct_utils.h>
15#include <botan/internal/kyber_constants.h>
16#include <botan/internal/loadstor.h>
17#include <botan/internal/pqcrystals_helpers.h>
24inline uint32_t
load_le3(std::span<const uint8_t, 3> in) {
25 return Botan::load_le(std::array<uint8_t, 4>{in[0], in[1], in[2], 0});
32 requires(d > 0 && d < 12)
51 using unsigned_T = std::make_unsigned_t<KyberConstants::T>;
53 constexpr uint64_t m = 2580335;
54 constexpr size_t p = 33;
55 constexpr unsigned_T mask = (1 << d) - 1;
56 return static_cast<unsigned_T
>((n * m) >> p) & mask;
63 requires(d > 0 && d < 12)
67 constexpr uint32_t offset = 1 << (d - 1);
68 constexpr uint32_t mask = (1 << d) - 1;
#define BOTAN_DEBUG_ASSERT(expr)
static constexpr T Q
modulus
int16_t T
base data type for most calculations
constexpr std::make_unsigned_t< KyberConstants::T > compress(KyberConstants::T x)
uint32_t load_le3(std::span< const uint8_t, 3 > in)
constexpr KyberConstants::T decompress(std::make_unsigned_t< KyberConstants::T > x)
constexpr auto load_le(ParamTs &&... params)