mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-11-22 04:50:40 -05:00
explicitly initialize struct
This commit is contained in:
parent
6f53dc90cf
commit
8749cafcbd
2 changed files with 14 additions and 1 deletions
|
|
@ -12,6 +12,7 @@ go_library(
|
||||||
deps = [
|
deps = [
|
||||||
"//internal/attestation",
|
"//internal/attestation",
|
||||||
"//internal/attestation/measurements",
|
"//internal/attestation/measurements",
|
||||||
|
"@com_github_google_go_sev_guest//proto/sevsnp",
|
||||||
"@com_github_google_go_tpm//legacy/tpm2",
|
"@com_github_google_go_tpm//legacy/tpm2",
|
||||||
"@com_github_google_go_tpm_tools//client",
|
"@com_github_google_go_tpm_tools//client",
|
||||||
"@com_github_google_go_tpm_tools//proto/attest",
|
"@com_github_google_go_tpm_tools//proto/attest",
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
|
"github.com/google/go-sev-guest/proto/sevsnp"
|
||||||
tpmClient "github.com/google/go-tpm-tools/client"
|
tpmClient "github.com/google/go-tpm-tools/client"
|
||||||
"github.com/google/go-tpm-tools/proto/attest"
|
"github.com/google/go-tpm-tools/proto/attest"
|
||||||
tpmProto "github.com/google/go-tpm-tools/proto/tpm"
|
tpmProto "github.com/google/go-tpm-tools/proto/tpm"
|
||||||
|
|
@ -183,7 +184,18 @@ func (v *Validator) Validate(ctx context.Context, attDocRaw []byte, nonce []byte
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
var attDoc AttestationDocument
|
// Explicitly initialize this struct, as TeeAttestation
|
||||||
|
// is a "oneof" protobuf field, which needs an explicit
|
||||||
|
// type to be set to be unmarshaled correctly.
|
||||||
|
// Note: this value is incompatible with TDX attestation!
|
||||||
|
// TODO(msanft): select the correct attestation type (SEV-SNP, TDX, ...) here.
|
||||||
|
attDoc := AttestationDocument{
|
||||||
|
Attestation: &attest.Attestation{
|
||||||
|
TeeAttestation: &attest.Attestation_SevSnpAttestation{
|
||||||
|
SevSnpAttestation: &sevsnp.Attestation{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
if err := json.Unmarshal(attDocRaw, &attDoc); err != nil {
|
if err := json.Unmarshal(attDocRaw, &attDoc); err != nil {
|
||||||
return nil, fmt.Errorf("unmarshaling TPM attestation document: %w", err)
|
return nil, fmt.Errorf("unmarshaling TPM attestation document: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue