Botan 3.6.1
Crypto and TLS for C&
dilithium_round3_symmetric_primitives.h
Go to the documentation of this file.
1/*
2* Asymmetric primitives for Dilithium round 3
3* (C) 2022 Jack Lloyd
4* 2022 Manuel Glaser, Michael Boric, René Meusel - Rohde & Schwarz Cybersecurity
5* 2024 René Meusel - Rohde & Schwarz Cybersecurity
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_DILITHIUM_ROUND3_SYM_PRIMITIVES_H_
11#define BOTAN_DILITHIUM_ROUND3_SYM_PRIMITIVES_H_
12
13#include <botan/internal/dilithium_keys.h>
14#include <botan/internal/dilithium_symmetric_primitives.h>
15
16#include <botan/rng.h>
17
18namespace Botan {
19
21 public:
23 DilithiumInternalKeypair decode_keypair(std::span<const uint8_t> private_key,
24 DilithiumConstants mode) const override;
25};
26
28 private:
29 /// Rho prime (deterministic) computation for Dilithium R3 instances
33 }
34
35 public:
37
41 std::optional<std::reference_wrapper<RandomNumberGenerator>> rng) const final {
42 // Dilitihium R3, Figure 4, l. 12:
43 // p' in {0, 1}^512 := H(K || mu) (or p' <- {0, 1}^512 for randomized signing)
44 return (rng.has_value())
46 : H(k, mu);
47 }
48
54
55 std::optional<std::array<uint8_t, 2>> seed_expansion_domain_separator() const final {
56 // Dilithium does not require domain separation when expanding its
57 // seeds from the input randomness.
58 return std::nullopt;
59 }
60};
61
62} // namespace Botan
63
64#endif
static constexpr size_t COMMITMENT_HASH_C1_BYTES
static constexpr size_t SEED_RHOPRIME_BYTES
secure_vector< uint8_t > encode_keypair(DilithiumInternalKeypair keypair) const override
DilithiumInternalKeypair decode_keypair(std::span< const uint8_t > private_key, DilithiumConstants mode) const override
StrongSpan< const DilithiumCommitmentHash > truncate_commitment_hash(StrongSpan< const DilithiumCommitmentHash > seed) const final
DilithiumSeedRhoPrime H_maybe_randomized(StrongSpan< const DilithiumSigningSeedK > k, StrongSpan< const DilithiumMessageRepresentative > mu, std::optional< std::reference_wrapper< RandomNumberGenerator > > rng) const final
std::optional< std::array< uint8_t, 2 > > seed_expansion_domain_separator() const final
OutT H_256(size_t outbytes, InTs &&... ins) const
Dilithium_Symmetric_Primitives_Base(const DilithiumConstants &mode, std::unique_ptr< DilithiumXOF > xof_adapter)
int(* final)(unsigned char *, CTX *)
std::vector< T, secure_allocator< T > > secure_vector
Definition secmem.h:61
std::pair< std::shared_ptr< Dilithium_PublicKeyInternal >, std::shared_ptr< Dilithium_PrivateKeyInternal > > DilithiumInternalKeypair
Internal representation of a Dilithium key pair.