Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
463 changes: 389 additions & 74 deletions kds/kds.go

Large diffs are not rendered by default.

48 changes: 47 additions & 1 deletion kds/kds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,63 @@ func TestProductCertChainURL(t *testing.T) {
}
}

func TestVCEKCertURL(t *testing.T) {
func hwid64() []byte {
hwid := make([]byte, abi.ChipIDSize)
hwid[0] = 0xfe
hwid[abi.ChipIDSize-1] = 0xc0
return hwid
}

func hwid8() []byte {
hwid := make([]byte, TurinHWIDSize)
hwid[0] = 0xfe
hwid[TurinHWIDSize-1] = 0xc0
return hwid
}

func TestVCEKCertURL(t *testing.T) {
hwid := hwid64()
got := VCEKCertURL("Milan", hwid, TCBVersion(0))
want := "https://kdsintf.amd.com/vcek/v1/Milan/fe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0?blSPL=0&teeSPL=0&snpSPL=0&ucodeSPL=0"
if got != want {
t.Errorf("VCEKCertURL(\"Milan\", %v, 0) = %q, want %q", hwid, got, want)
}
}

func TestVCEKCertQueryTurin(t *testing.T) {
tcs := []struct {
name string
hwid []byte
productLine string
tcb TCBVersionI
want string
}{
{
name: "milan",
hwid: hwid64(),
productLine: "Milan",
tcb: TCBVersion(0),
want: "https://kdsintf.amd.com/vcek/v1/Milan/fe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0?blSPL=0&teeSPL=0&snpSPL=0&ucodeSPL=0",
},
{
name: "turin",
hwid: hwid8(),
productLine: "Turin",
tcb: TCBVersionTurin(1 | (2 << 56)),
want: "https://kdsintf.amd.com/vcek/v1/Turin/fe000000000000c0?fmcSPL=1&blSPL=0&teeSPL=0&snpSPL=0&ucodeSPL=2",
},
}
for _, tc := range tcs {
t.Run(tc.name, func(t *testing.T) {
got := VCEKCertQuery(tc.productLine, tc.hwid, tc.tcb)

if got != tc.want {
t.Errorf("VCEKCertQuery(%q, %v, 0x%x) = %q, want %q", tc.productLine, tc.hwid, tc.tcb.Raw(), got, tc.want)
}
})
}
}

func TestParseProductBaseURL(t *testing.T) {
tcs := []struct {
name string
Expand Down
4 changes: 3 additions & 1 deletion proto/check.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ message Policy {
bytes host_data = 12; // Should be 32 bytes long
bytes report_id = 13; // Should be 32 bytes long
bytes report_id_ma = 14; // Should be 32 bytes long
bytes chip_id = 15; // Should be 64 bytes long
bytes chip_id = 15; // Should be either 64 or 8 bytes long
uint32 minimum_build = 16;
string minimum_version = 17; // Should be "maj.min", both should be 0-255.
bool permit_provisional_firmware = 18;
Expand All @@ -53,6 +53,8 @@ message Policy {
repeated bytes trusted_id_key_hashes = 23;
// The expected product that generated the attestation report. Stepping optional.
sevsnp.SevProduct product = 24;
uint64 minimum_tcb_turin = 25;
uint64 minimum_launch_tcb_turin = 26;
}

// RootOfTrust represents configuration for which hardware root of trust
Expand Down
81 changes: 52 additions & 29 deletions proto/check/check.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion proto/fakekds/fakekds.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions proto/sevsnp/sevsnp.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading