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

Library to communicate with the SVSM and attest the VTPM from the guest #361

Open
ShannonSD opened this issue May 24, 2024 · 6 comments · May be fixed by hpe-security-lab/svsm#1 or #541
Open

Library to communicate with the SVSM and attest the VTPM from the guest #361

ShannonSD opened this issue May 24, 2024 · 6 comments · May be fixed by hpe-security-lab/svsm#1 or #541

Comments

@ShannonSD
Copy link

Is there currently an interface for a guest to communicate with the SVSM to request a VMPL0 attestation report that attests and binds the vTPM to the guest (perhaps by inclduing the vTPM's EK and SK)?

@cclaudio
Copy link
Member

Hi @ShannonSD

Yes, I believe you are looking for the Attestation protocol defined in the SVSM specification (chapter 7). I implemented this protocol some time ago, I can rebase it to latest and submit.

The SVSM spec, section 8.3.3, defines that the vTPM EK is returned to the SVSM_ATTEST_SINGLE_SERVICE caller, but not the vTPM SK.

The Linux patch series below will be required, specially the patch 14. Currently, it is under review.
https://lore.kernel.org/lkml/9a4c4a16d00834c1b7ff458e25c185ac1c9bcf79.1713974291.git.thomas.lendacky@amd.com/

Claudio

@cclaudio
Copy link
Member

The Linux patch series below will be required, specially the patch 14. Currently, it is under review.
https://lore.kernel.org/lkml/9a4c4a16d00834c1b7ff458e25c185ac1c9bcf79.1713974291.git.thomas.lendacky@amd.com/

Sorry, I wanted to share with you a link to our COCONUT/linux repository, but I ended picking up the upstream.
coconut-svsm/linux@84357db

@deeglaze
Copy link
Contributor

deeglaze commented Jul 8, 2024

This issue is stale. Okay to close?

@IT302
Copy link

IT302 commented Jul 23, 2024

Hi @cclaudio

I am interested in using TSM to obtain the vTPM's EK. Would it possible to rebase what you have implemented and commit?

Geoffrey

@cclaudio
Copy link
Member

Hi @IT302
I will try to do that for next week

@Isaac-Matthews
Copy link

Hi @cclaudio is there an update on this?
Thanks

IT302 pushed a commit to hpe-security-lab/svsm that referenced this issue Feb 13, 2025
vTPM service attestation is described in section 8.3 of "Secure VM
Service Module for SEV-SNP Guests, Publication #58019 Revision: 1.00
Issue Date: July 2023". It certifies the Endorsement Key (EK) of the
vTPM by providing the TPMT_PUBLIC structure of the EK. This is crucial
for downstream projects like Keylime, as the SVSM vTPM lacks an EK
certificate found in physical TPMs to anchor trust.

The attestation is part of the SVSM Attestation Protocol and uses the
SVSM_ATTEST_SINGLE_SERVICE call (see section 7 of the specifications).
It is triggered by making an SVSM_ATTEST_SINGLE_SERVICE call with the
GUID set to c476f1eb-0123-45a5-9641-b4e7dde5bfe3. The attestation code
returns the VMPL0 attestation report and the vTPM Service Manifest Data
Structure (TPMT_PUBLIC structure of the EK). The REPORT_DATA in the SNP
attestation request is the SHA-512 digest of the input nonce and the
vTPM Service Manifest Data Structure.

The vTPM initialization function was modified to generate an RSA
2048-bit EK from the TPM's Endorsement Primary Seed (EPS) and cache the
public key as a TPMT_PUBLIC structure. This cached EK public key can be
retrieved later for vTPM service attestation. The EK is created with
the TCG default EK template (see Table 4 of the "TCG EK Credential
Profile For TPM Family 2.0; Level 0 Version 2.5 Revision 2.0"). Since
the EK is derived from the EPS, it can be recreated upstream at any
time. For example, the same EK can be recreated in an OS using the TSS2
command "tpm2_createek -c ek.ctx -G rsa -u ek.pub" and compared against
the one returned by vTPM service attestation.

vTPM service attestation as specified can only return one type of EK, so
the implementation supports RSA 2048-bit EK as defined in Table 4 of
the "TCG EK Credential Profile For TPM Family 2.0; Level 0 Version 2.5
Revision 2.0," which is the most common Trusted Computing Group(TCG) EK
type.

Resolves coconut-svsm#437, resolves coconut-svsm#361

Signed-off-by: Geoffrey Ndu <[email protected]>
IT302 pushed a commit to hpe-security-lab/svsm that referenced this issue Feb 15, 2025
vTPM service attestation is described in section 8.3 of "Secure VM
Service Module for SEV-SNP Guests, Publication #58019 Revision: 1.00
Issue Date: July 2023". It certifies the Endorsement Key (EK) of the
vTPM by providing the TPMT_PUBLIC structure of the EK. This is crucial
for downstream projects like Keylime, as the SVSM vTPM lacks an EK
certificate found in physical TPMs to anchor trust.

The attestation is part of the SVSM Attestation Protocol and uses the
SVSM_ATTEST_SINGLE_SERVICE call (see section 7 of the specifications).
It is triggered by making an SVSM_ATTEST_SINGLE_SERVICE call with the
GUID set to c476f1eb-0123-45a5-9641-b4e7dde5bfe3. The attestation code
returns the VMPL0 attestation report and the vTPM Service Manifest Data
Structure (TPMT_PUBLIC structure of the EK). The REPORT_DATA in the SNP
attestation request is the SHA-512 digest of the input nonce and the
vTPM Service Manifest Data Structure.

The vTPM initialization function was modified to generate an RSA
2048-bit EK from the TPM's Endorsement Primary Seed (EPS) and cache the
public key as a TPMT_PUBLIC structure. This cached EK public key can be
retrieved later for vTPM service attestation. The EK is created with
the TCG default EK template (see Table 4 of the "TCG EK Credential
Profile For TPM Family 2.0; Level 0 Version 2.5 Revision 2.0"). Since
the EK is derived from the EPS, it can be recreated upstream at any
time. For example, the same EK can be recreated in an OS using the TSS2
command "tpm2_createek -c ek.ctx -G rsa -u ek.pub" and compared against
the one returned by vTPM service attestation.

vTPM service attestation as specified can only return one type of EK, so
the implementation supports RSA 2048-bit EK as defined in Table 4 of
the "TCG EK Credential Profile For TPM Family 2.0; Level 0 Version 2.5
Revision 2.0," which is the most common Trusted Computing Group(TCG) EK
type.

Resolves coconut-svsm#437, resolves coconut-svsm#361

Signed-off-by: Geoffrey Ndu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants