Botan 3.5.0
Crypto and TLS for C&
frodo_shake_generator.h
Go to the documentation of this file.
1/*
2 * FrodoKEM matrix generator based on SHAKE
3 *
4 * The Fellowship of the FrodoKEM:
5 * (C) 2023 Jack Lloyd
6 * 2023 René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity
7 *
8 * Botan is released under the Simplified BSD License (see license.txt)
9 */
10
11#ifndef BOTAN_FRODOKEM_SHAKE_GENERATOR_H_
12#define BOTAN_FRODOKEM_SHAKE_GENERATOR_H_
13
14#include <botan/internal/frodo_constants.h>
15#include <botan/internal/frodo_types.h>
16#include <botan/internal/loadstor.h>
17#include <botan/internal/shake_xof.h>
18
19#include <span>
20
21namespace Botan {
22
24 BOTAN_ASSERT_NOMSG(constants.mode().is_shake());
25
26 return [xof = SHAKE_128_XOF(), a = FrodoSeedA(seed_a)](std::span<uint8_t> out, uint16_t i) mutable {
27 xof.clear();
28 xof.update(store_le(i));
29 xof.update(a);
30 xof.output(out);
31 };
32}
33
34} // namespace Botan
35
36#endif
#define BOTAN_ASSERT_NOMSG(expr)
Definition assert.h:59
FrodoKEMMode mode() const
bool is_shake() const
Definition frodo_mode.h:56
auto create_shake_row_generator(const FrodoKEMConstants &constants, StrongSpan< const FrodoSeedA > seed_a)
constexpr auto store_le(ParamTs &&... params)
Definition loadstor.h:698
Strong< std::vector< uint8_t >, struct FrodoSeedA_ > FrodoSeedA
Definition frodo_types.h:23