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

tpm2: configure vendor/manufacturer values #369

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ben-dav-lytle
Copy link
Contributor

Provide a way to configure Vendor/Manufacturer values.
This also changes default vendor/manufacturer strings to be more generic (remove IBM specifics; makes IBM less liable? 😄)
Cleaned up comments that were a little confusing in VendorString.h, most likely from the Microsoft Reference code port.

I know a major concern is swtpm state and downgrading versions, and these values (at least Manufacturer, Vendor Strings, and Firmware Version) show up in the properties-fixed get capability command. What I'm not sure of is how tightly this is coupled with
the swtpm state and how it would affect earlier libtpms versions.

@stefanberger
Copy link
Owner

stefanberger commented Apr 19, 2023

Provide a way to configure Vendor/Manufacturer values.
This also changes default vendor/manufacturer strings to be more generic (remove IBM specifics; makes IBM less liable? 😄)

I am not sure whether this flexibility will be very helpful, though:

By now any change to any of the fields can cause backwards compatibility issues, such as for example with pkcs11 drivers where the name of the device goes into the pkcs11 URI and an upgrade of libtpms could then be causing the device URI not to work anymore (since the device is identified differently) and crypto to fail. If we want to make it flexible then the default values MUST all be exactly as they are now. Also, migration between differently configured libtpms could cause these types of issues.

@ben-dav-lytle
Copy link
Contributor Author

causing the device URI not to work anymore (since the device is identified differently) and crypto to fail.

That's what I was afraid of.

If we want to make it flexible then the default values MUST all be exactly as they are now. Also, migration between differently configured libtpms could cause these types of issues.

If we make the default values the exact same as they are now, I can see one obvious issue with differing libtpms versions -
TPM2_GetInfo would return all the hardcoded values at that libtpms version (if not at a version where these were configurable). So this output could differ from the TPM2 fixed properties capability.

@stefanberger
Copy link
Owner

causing the device URI not to work anymore (since the device is identified differently) and crypto to fail.

That's what I was afraid of.

That would be an unnecessary annoyance for any user that doesn't know why things do not work anymore.

Who would be configuring libtpms with differing values than what they have been for years now?

@ben-dav-lytle
Copy link
Contributor Author

That would be an unnecessary annoyance for any user that doesn't know why things do not work anymore

Completely agree.

Who would be configuring libtpms with differing values than what they have been for years now?

If a different company wants to use this project to create a TPM, and brand it as something else (something like Google Cloud: https://cloud.google.com/blog/products/identity-security/virtual-trusted-platform-module-for-shielded-vms-security-in-plaintext, where they use https://sourceforge.net/projects/ibmswtpm2/).

@stefanberger
Copy link
Owner

If a different company wants to use this project to create a TPM, and brand it as something else (something like Google Cloud: https://cloud.google.com/blog/products/identity-security/virtual-trusted-platform-module-for-shielded-vms-security-in-plaintext, where they use https://sourceforge.net/projects/ibmswtpm2/).

Is this an expressed intention from Google Cloud (or anyone else) or a hypothesis?

Define up to 4, 4-byte, vendor-specific strings. The strings must each be 4 bytes long.
These values define the response for TPM_PT_VENDOR_STRING_(1-4) in TPM2_GetCapability(). */
#ifndef CONFIG_VENDOR_STRING_1
#define VENDOR_STRING_1 "fTPM"
Copy link
Owner

Choose a reason for hiding this comment

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

The default here would have to be "SW "


// the less significant 32-bits of a vendor-specific value indicating the version of the firmware
#define FIRMWARE_V2 (0x00163636)
#ifdef CONFIG_VENDOR_STRING_2
Copy link
Owner

Choose a reason for hiding this comment

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

This would have to have a default of " TPM".

#define _STRINGIFY(x) #x
#endif
#ifndef STRINGIFY
#define STRINGIFY(x) _STRINGIFY(x)
Copy link
Owner

Choose a reason for hiding this comment

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

These could be useful elsewhere. Move to a Utils.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Found it already defined in tpm_library_intern.h

#error FIRMWARE_V1 is not provided. \
Please modify VendorString.h to provide a vendor specific firmware \
version
#define FIRMWARE_V1 0x00000000
Copy link
Owner

Choose a reason for hiding this comment

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

Also this here should go back to its previous default value. None of the existing users, like distros, should have to modify their build process and ./configure line to get back the old default values. So all values have to default to what they were before.

@ben-dav-lytle
Copy link
Contributor Author

If a different company wants to use this project to create a TPM, and brand it as something else (something like Google Cloud: https://cloud.google.com/blog/products/identity-security/virtual-trusted-platform-module-for-shielded-vms-security-in-plaintext, where they use https://sourceforge.net/projects/ibmswtpm2/).

Is this an expressed intention from Google Cloud (or anyone else) or a hypothesis?

I believe what Google Cloud has detailed in the article is their current vTPM solution. Other than that, it is a hypothesis. swtpm has broad reach, so I wouldn't be surprised if other companies are basing their solutions off it. That's the intention of this patch; an "open-sourced" way to configure the swtpm, if you will.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 2762

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.005%) to 76.335%

Files with Coverage Reduction New Missed Lines %
src/tpm2/crypto/openssl/Helpers.c 2 84.76%
Totals Coverage Status
Change from base Build 2760: -0.005%
Covered Lines: 33733
Relevant Lines: 44191

💛 - Coveralls

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.

3 participants