File: rng.md

package info (click to toggle)
tpm2-openssl 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,172 kB
  • sloc: ansic: 6,075; sh: 5,400; makefile: 152
file content (26 lines) | stat: -rw-r--r-- 784 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Random Number Generation

The tpm2 provider implements a
[OSSL_OP_RAND](https://www.openssl.org/docs/manmaster/man7/provider-rand.html)
operation, which retrieves random bytes from the TPM. It is made available to
applications via the
[EVP_RAND](https://www.openssl.org/docs/manmaster/man3/EVP_RAND.html) API function
and the
[`openssl rand`](https://www.openssl.org/docs/manmaster/man1/openssl-rand.html)
command.

For example, to generate 10 bytes:
```
openssl rand -provider tpm2 -hex 10
```

This is similar to:
```
tpm2_getrandom --hex 10
```

Note: For compatibility reasons is the number generator named **CTR-DRBG**,
although the TPM uses a completely different mechanism.

Gettable parameters (API only):
 * `max_request` (size_t) defines maximal size of a single request.