Botan
3.6.1
Crypto and TLS for C&
src
lib
prov
tpm2
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
16
namespace
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
*/
22
class
BOTAN_PUBLIC_API
(3, 6)
RandomNumberGenerator
final
:
public
Hardware_RNG
{
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
Botan::Hardware_RNG
Definition
rng.h:274
Botan::TPM2::RandomNumberGenerator
Definition
tpm2_rng.h:22
Botan::TPM2::RandomNumberGenerator::accepts_input
bool accepts_input() const override
Definition
tpm2_rng.h:26
Botan::TPM2::RandomNumberGenerator::name
std::string name() const override
Definition
tpm2_rng.h:28
Botan::TPM2::RandomNumberGenerator::is_seeded
bool is_seeded() const override
Definition
tpm2_rng.h:30
Botan::TPM2::SessionBundle
Definition
tpm2_session.h:173
final
int(* final)(unsigned char *, CTX *)
Definition
commoncrypto_hash.cpp:29
BOTAN_PUBLIC_API
#define BOTAN_PUBLIC_API(maj, min)
Definition
compiler.h:31
Botan::TPM2
Definition
tpm2_algo_mappings.h:24
Generated by
1.12.0