Botan 3.6.0
Crypto and TLS for C&
dilithium_shake_xof.h
Go to the documentation of this file.
1/*
2* Asymmetric primitives for dilithium and ML-KEM using SHAKE as XOF
3* (C) 2022 Jack Lloyd
4* (C) 2022 Manuel Glaser, Michael Boric, René Meusel - Rohde & Schwarz Cybersecurity
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#ifndef BOTAN_DILITHIUM_SHAKE_XOF_ADAPTER_H_
10#define BOTAN_DILITHIUM_SHAKE_XOF_ADAPTER_H_
11
12#include <botan/internal/dilithium_symmetric_primitives.h>
13
14#include <botan/internal/loadstor.h>
15#include <botan/internal/shake_xof.h>
16
17namespace Botan {
18
20 public:
21 Botan::XOF& XOF128(std::span<const uint8_t> seed, uint16_t nonce) const override {
22 return XOF(m_xof_128, seed, nonce);
23 }
24
25 Botan::XOF& XOF256(std::span<const uint8_t> seed, uint16_t nonce) const override {
26 return XOF(m_xof_256, seed, nonce);
27 }
28
29 private:
30 static Botan::XOF& XOF(Botan::XOF& xof, std::span<const uint8_t> seed, uint16_t nonce) {
31 xof.clear();
32 xof.update(seed);
33 xof.update(store_le(nonce));
34 return xof;
35 }
36
37 private:
38 mutable SHAKE_256_XOF m_xof_256;
39 mutable SHAKE_128_XOF m_xof_128;
40};
41
42} // namespace Botan
43
44#endif
Botan::XOF & XOF128(std::span< const uint8_t > seed, uint16_t nonce) const override
Botan::XOF & XOF256(std::span< const uint8_t > seed, uint16_t nonce) const override
void clear()
Definition xof.h:66
void update(std::span< const uint8_t > input)
Definition xof.h:142
int(* final)(unsigned char *, CTX *)
constexpr auto store_le(ParamTs &&... params)
Definition loadstor.h:764