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

WIP: Add support for enabling the SVN-limited hierarchy #470

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

stefanberger
Copy link
Owner

Add support for the SVN-limited hierarchy and allow enabling it with a profile attribute svn-limited-hierarchy.

The SVN limited hierarchy is based on a 16 bytes SVN base secret that is unique per vTPM instance and is created as a random number on first manufacturing.

@stefanberger stefanberger marked this pull request as draft October 17, 2024 19:45
@stefanberger stefanberger changed the title Add support for enabling the SVN-limited hierarchy WIP: Add support for enabling the SVN-limited hierarchy Oct 17, 2024
@stefanberger stefanberger force-pushed the stefanberger/svn-hierarchy-enablement branch 3 times, most recently from 646931e to db3eccc Compare October 18, 2024 15:26
@@ -871,6 +871,13 @@ static TPM_BOOL TPM2_WasManufactured(void)
return g_wasManufactured;
}

static TPM_RESULT TPM2_RecreateSvnBaseSecret(void)
{
if (_plat__SvnBaseSecretRecreate() == 0)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably trigger the storing of the persistent state.

Set the currentSvn number to a number derived from the library version.
Start out with currentSvn '0'. The number would then follow the
following numbering scheme relative to possible future libtpms versions:

v0.10   : 0x0000
v0.10.1 : 0x0001
v0.10.2 : 0x0002
v0.11   : 0x0010
v0.11.1 : 0x0011
v1.0    : 0x0020
v1.0.1  : 0x0021

Signed-off-by: Stefan Berger <[email protected]>
MAX_SVN and its related function are not currently used, so comment
them out.

Signed-off-by: Stefan Berger <[email protected]>
Introduce a per-TPM SVN base secret of 16 bytes that is to be used for the
SVN-limited hierarchy to derive its secrets from when the 16bit SVN
number is mixed in. Create it at first manufacturing time.

Signed-off-by: Stefan Berger <[email protected]>
Use the TPM's unique 16 byte SVN base secret to deterministically calculate
the TpmFirmwareSvnSecret from it by first hashing this 16 byte number and
then adding the 16bit SVN to the hash.

Signed-off-by: Stefan Berger <[email protected]>
In several locations where #if SVN_LIMITED_SUPPORT is used to deactivate
SVN hierarchy related code, add a profile attribute check for whether the
svn-limited-hierarchy attribute's flag is set. If it is not set, handle it
in the same way is if SVN hierarchy support was disabled.

Signed-off-by: Stefan Berger <[email protected]>
Implement support for a profile attribute svn-limited-hierarchy that must
be set for SVN-limited hiearchy support to be enabled. Bump up the
StateFormatLevel to 8 and store the SVN base secret starting with
StateFormatLevel 8.

Signed-off-by: Stefan Berger <[email protected]>
Implement TPMLIB_RecreateSvnBaseSecret() to allow the user to recreate
the SVN base secret. Trigger the storage of the persistent state. Add
a man page.

Signed-off-by: Stefan Berger <[email protected]>
@stefanberger stefanberger force-pushed the stefanberger/svn-hierarchy-enablement branch from fd3b337 to 54671af Compare November 12, 2024 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant