Botan 3.6.0
Crypto and TLS for C&
tpm2_rng.h
Go to the documentation of this file.
1/*
2* TPM 2 RNG interface
3* (C) 2024 Jack Lloyd
4* (C) 2024 René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity GmbH, financed by LANCOM Systems GmbH
5*
6* Botan is released under the Simplified BSD License (see license.txt)
7*/
8
9#ifndef BOTAN_TPM2_RNG_H_
10#define BOTAN_TPM2_RNG_H_
11
12#include <botan/rng.h>
13#include <botan/tpm2_context.h>
14#include <botan/tpm2_session.h>
15
16namespace Botan::TPM2 {
17
18/**
19 * This class implements a random number generator that uses the TPM 2.0 device
20 * as a source of randomness.
21 */
23 public:
24 RandomNumberGenerator(std::shared_ptr<Context> ctx, SessionBundle sessions = {});
25
26 bool accepts_input() const override { return true; }
27
28 std::string name() const override { return "TPM2_RNG"; }
29
30 bool is_seeded() const override { return true; }
31
32 private:
33 void fill_bytes_with_input(std::span<uint8_t> output, std::span<const uint8_t> input) override;
34
35 private:
36 std::shared_ptr<Context> m_ctx;
37 SessionBundle m_sessions;
38
39 size_t m_max_tpm2_rng_bytes;
40};
41
42} // namespace Botan::TPM2
43
44#endif
bool accepts_input() const override
Definition tpm2_rng.h:26
std::string name() const override
Definition tpm2_rng.h:28
bool is_seeded() const override
Definition tpm2_rng.h:30
int(* final)(unsigned char *, CTX *)
#define BOTAN_PUBLIC_API(maj, min)
Definition compiler.h:31