Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Pranjali-2501
Copy link
Member

When getting a vTPM quote within a TDX VM, the attestation service will utilize go-tdx-guest to generate and verify Intel's TDX hardware based attestation quote.

Add TDX attestation protobuf in the go-tpm-tools attestation message.
Update client changes for TDX device-related attestation quote generation.
Update server changes for TDX quote verification using go-tdx-guest.
Enhance CLI tool for TDX functionality updates.

@google-cla
Copy link

google-cla bot commented Aug 18, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

case pb.GCEConfidentialTechnology_AMD_SEV: // Not verifiable on GCE
return nil
case pb.GCEConfidentialTechnology_AMD_SEV_ES: // Not verifiable on GCE
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

return an error if opts is non-nil for all NONE, SEV, and SEV_ES cases. Add a test case for that expecting to verify SEV-SNP on SEV is an error.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have implemented the changes for NONE, SEV and SEV-ES.
For test :
It tries to parse the Eventlog to get the value for state.Platform.GetTechnology().
for testing we need to modify this. Is it possible?

BTW I have already added a test when --tee_technology flag is set to sev, instead of sev-snp in cmd/attest_test.go .
Error in this case would be tee-technology should be either empty or should have values sev-snp or tdx

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know what possibility you're asking for. I'll defer to Alex.

Copy link
Member Author

Choose a reason for hiding this comment

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

IIUC, it will detect the hardware technology enabled on the cvm by itself only.

client/attest.go Outdated
func (d *TdxDevice) AddAttestation(attestation *pb.Attestation, opts AttestOpts) error {
var tdxNonce [tabi.TdReportDataSize]byte
if len(opts.TEENonce) == 0 {
copy(tdxNonce[:], opts.Nonce[:])
Copy link
Contributor

Choose a reason for hiding this comment

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

opts.Nonce is already a slice, so I think [:] is not needed

Also do we care about the size of opts.Nonce (what if it's zero)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nonce can not be zero. Check for this is already there

if len(opts.Nonce) == 0 {
	return nil, fmt.Errorf("provided nonce must not be empty")
}

nonce can be of any size. For teenonce the size is fixed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, slicing is not required. I have changed it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, looks a little bit weird to me because the tdxNonce can be only the first part of the opt.Nonce (may result not enough entropy for the nonce?). I'm not sure maybe @deeglaze and @alexmwu can confirm if it's okay.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have tested the implementation and it is working fine.

And for copy(tdxNonce[:], opts.Nonce[:]) , if length of nonce is less that 64 then it will concatenate zeros at the end.

Copy link
Member Author

Choose a reason for hiding this comment

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

If the user does not provide a teenonce, then the nonce will be used as the teenonce, either concatenated with zeroes or truncated to make it 64 bytes long.

But If teenonce is present, then it must be 64 bytes in length.

#!/bin/bash

protoc -I. -I`go list -m -f "{{.Dir}}" github.com/google/go-sev-guest` --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto attest.proto
protoc -I. -I`go list -m -f "{{.Dir}}" github.com/google/go-sev-guest` -I`go list -m -f "{{.Dir}}" github.com/google/go-tdx-guest` --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto attest.proto
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: newline EOF

Copy link
Member Author

Choose a reason for hiding this comment

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

There is no new line at the EOF.
Do you want me to add a blank line?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, because I think the original file has a new line at the end

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@jkl73 jkl73 left a comment

Choose a reason for hiding this comment

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

lgtm

#!/bin/bash

protoc -I. -I`go list -m -f "{{.Dir}}" github.com/google/go-sev-guest` --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto attest.proto
protoc -I. -I`go list -m -f "{{.Dir}}" github.com/google/go-sev-guest` -I`go list -m -f "{{.Dir}}" github.com/google/go-tdx-guest` --go_out=. --go_opt=module=github.com/google/go-tpm-tools/proto attest.proto
Copy link
Contributor

Choose a reason for hiding this comment

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

yes, because I think the original file has a new line at the end

client/attest.go Outdated
func (d *TdxDevice) AddAttestation(attestation *pb.Attestation, opts AttestOpts) error {
var tdxNonce [tabi.TdReportDataSize]byte
if len(opts.TEENonce) == 0 {
copy(tdxNonce[:], opts.Nonce[:])
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, looks a little bit weird to me because the tdxNonce can be only the first part of the opt.Nonce (may result not enough entropy for the nonce?). I'm not sure maybe @deeglaze and @alexmwu can confirm if it's okay.

@jkl73 jkl73 merged commit 884b941 into google:master Aug 28, 2023
alexmwu added a commit to alexmwu/go-tpm-tools that referenced this pull request Sep 15, 2023
New Features:
[launcher] Verify FS and mount before launch google#311
Integration of go-tpm-tools with go-tdx-guest google#347

Intra-version Breaking Changes:
Add launcherfile package for path and file consts google#356 breaks google#333
Bug Fixes:
[launcher] Update the token refresh logic google#325
[launcher] Fix logging blocking issue google#338

Other Changes:
[launcher] Add a new metadata flag of signedImageRepos google#320
Update go-sev-guest to v0.7.0 google#329
[launcher] Add SSH test for image. google#314
Add supported architectures to ci.yml google#330
Fix the go version number error google#326
[launcher] Signature discovery: fetch a signed image manifest at for parsing google#324
[launcher] Export attestation token filepath and filename google#333
[launcher] Increase the max file descriptor google#339
[launcher] Add a signature interface and a library to parse signature from image manifest google#328
Rename TdxVerify function to TdxQuote in server package. google#353
[launcher] Use V1 SDK in launcher verifier client google#305
Update and tidy dependencies google#344
@alexmwu alexmwu mentioned this pull request Sep 15, 2023
alexmwu added a commit that referenced this pull request Sep 15, 2023
New Features:
[launcher] Verify FS and mount before launch #311
Integration of go-tpm-tools with go-tdx-guest #347

Intra-version Breaking Changes:
Add launcherfile package for path and file consts #356 breaks #333
Bug Fixes:
[launcher] Update the token refresh logic #325
[launcher] Fix logging blocking issue #338

Other Changes:
[launcher] Add a new metadata flag of signedImageRepos #320
Update go-sev-guest to v0.7.0 #329
[launcher] Add SSH test for image. #314
Add supported architectures to ci.yml #330
Fix the go version number error #326
[launcher] Signature discovery: fetch a signed image manifest at for parsing #324
[launcher] Export attestation token filepath and filename #333
[launcher] Increase the max file descriptor #339
[launcher] Add a signature interface and a library to parse signature from image manifest #328
Rename TdxVerify function to TdxQuote in server package. #353
[launcher] Use V1 SDK in launcher verifier client #305
Update and tidy dependencies #344
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