Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptodoc update for TPM 2.0 Wrapper #250

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/cryptodoc/src/07_rng.rst
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,61 @@ the PKCS#11 standard, e.g., a smartcard. The PKCS11_RNG is provided in

1. **C\_GenerateRandom**\ (``m_session.get().handle()``, ``output``, ``output.size()``)

.. _rng/tpm2:

TPM2::RandomNumberGenerator
^^^^^^^^^^^^^^^^^^^^^^^^^^^

This class provides a wrapper around the TPM 2.0 RNG interface that is part of
the :ref:`TPM 2.0 <tpm/main>` module. No further processing of the random bytes
is done by this class.

.. admonition:: Construction

**Input:**

- ``ctx``: A TPM2::Context object.
- ``sessions``: A bundle of TPM::Session objects

**Output:**

- A ready-to-use TPM2::RandomNumberGenerator instance

**Steps:**

1. ``Esys_GetCapability(ctx, sessions, TPM2_PT_MAX_DIGEST, ...)`` to obtain
the maximum number of bytes ``m_max`` consumable from a single RNG invocation

.. admonition:: Reseeding

**Input:**

- ``in``: Additional input received from the consuming application.

**Steps:**

1. ``Esys_StirRandom(ctx, sessions, in)``

.. admonition:: Randomize

**Input:**

- ``bytes``: Number of random bytes to be generated.

**Output:**

- ``output``: The pseudorandom bits to be returned to the consuming application.

**Steps:**

1. Allocate an ``output`` buffer with capacity of ``bytes``
2. As long as ``output`` is not fully filled:

1. ``output_slice = get_next_slice(output, m_max)``
2. ``Esys_GetRandom(ctx, sessions, bytes, &output_slice)``

3. Return ``output``

.. _rng/processor_generators:

Processor_RNG
Expand Down
Loading
Loading