Botan
3.9.0
Crypto and TLS for C&
src
lib
pubkey
dilithium
dilithium_common
dilithium_shake
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
17
namespace
Botan
{
18
19
class
DilithiumShakeXOF
final :
public
DilithiumXOF
{
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::DilithiumShakeXOF
Definition
dilithium_shake_xof.h:19
Botan::DilithiumShakeXOF::XOF128
Botan::XOF & XOF128(std::span< const uint8_t > seed, uint16_t nonce) const override
Definition
dilithium_shake_xof.h:21
Botan::DilithiumShakeXOF::XOF256
Botan::XOF & XOF256(std::span< const uint8_t > seed, uint16_t nonce) const override
Definition
dilithium_shake_xof.h:25
Botan::DilithiumXOF
Definition
dilithium_symmetric_primitives.h:89
Botan::XOF
Definition
xof.h:29
Botan::XOF::clear
void clear()
Definition
xof.h:64
Botan::XOF::update
void update(std::span< const uint8_t > input)
Definition
xof.h:140
Botan
Definition
alg_id.cpp:13
Botan::store_le
constexpr auto store_le(ParamTs &&... params)
Definition
loadstor.h:736
Generated by
1.14.0