Skip to content

Commit

Permalink
Add Correct Names
Browse files Browse the repository at this point in the history
Signed-off-by: Yogesh Deshpande <[email protected]>
  • Loading branch information
yogeshbdeshpande committed Jan 20, 2025
1 parent 9300e5a commit 23c1714
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions comid/tdx-profile/example_seam_refval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Example_encode_tdx_seam_refval_without_profile() {
}

extMap := extensions.NewMap().
Add(comid.ExtReferenceValue, &MvalExtensions{})
Add(comid.ExtReferenceValue, &TDXMvalExtensions{})

coMID := comid.NewComid().
SetTagIdentity("43BBE37F-2E61-4B33-AED3-53CFF1428B20", 0).
Expand All @@ -80,7 +80,7 @@ func Example_encode_tdx_seam_refval_without_profile() {
panic(err)
}

if err := setMValExtensions(&coMID.Triples.ReferenceValues.Values[0].Measurements.Values[0].Val); err != nil {
if err := setTDXSeamMvalExtensions(&coMID.Triples.ReferenceValues.Values[0].Measurements.Values[0].Val); err != nil {
panic(err)
}
if err := coMID.Valid(); err != nil {
Expand Down Expand Up @@ -135,7 +135,7 @@ func Example_encode_tdx_seam_refval_with_profile() {
refVal.Measurements.Add(measurement)
coMID.Triples.AddReferenceValue(*refVal)

err = setMValExtensions(&coMID.Triples.ReferenceValues.Values[0].Measurements.Values[0].Val)
err = setTDXSeamMvalExtensions(&coMID.Triples.ReferenceValues.Values[0].Measurements.Values[0].Val)
if err != nil {
fmt.Printf("unable to set extensions :%s", err.Error())
}
Expand Down Expand Up @@ -173,7 +173,7 @@ func Example_encode_tdx_seam_refval_direct() {
SetModel("TDXSEAM"),
}

extMap := extensions.NewMap().Add(comid.ExtMval, &MvalExtensions{})
extMap := extensions.NewMap().Add(comid.ExtMval, &TDXMvalExtensions{})
coMID := comid.NewComid().
SetTagIdentity("43BBE37F-2E61-4B33-AED3-53CFF1428B20", 0).
AddEntity("INTEL", &TestRegID, comid.RoleCreator, comid.RoleTagCreator, comid.RoleMaintainer)
Expand All @@ -182,7 +182,7 @@ func Example_encode_tdx_seam_refval_direct() {
log.Fatal("could not register mval extensions")
}

if err := setMValExtensions(&measurement.Val); err != nil {
if err := setTDXSeamMvalExtensions(&measurement.Val); err != nil {
log.Fatal("could not set mval extensions")
}

Expand Down Expand Up @@ -213,7 +213,7 @@ func Example_encode_tdx_seam_refval_direct() {
// {"tag-identity":{"id":"43bbe37f-2e61-4b33-aed3-53cff1428b20"},"entities":[{"name":"INTEL","regid":"https://intel.com","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.16.840.1.113741.1.2.3.4.5"},"vendor":"Intel Corporation","model":"TDXSEAM"}},"measurements":[{"value":{"tcbdate":"123","isvsvn":10,"attributes":"AQE=","mrsigner":["sha-256;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU=","sha-384;5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXXkW3L1wMC1cttNjTq36X82"],"isvprodid":"AQE=","tcbevalnum":11}}]}]}}
}

func setMValExtensions(val *comid.Mval) error {
func setTDXSeamMvalExtensions(val *comid.Mval) error {
tcbDate := tdate("123")
isvProdID := teeIsvProdID([]byte{0x01, 0x01})
svn := teeSVN(10)
Expand Down Expand Up @@ -252,7 +252,7 @@ func setMValExtensions(val *comid.Mval) error {
return nil
}

func decodeMValExtensions(m comid.Measurement) error {
func decodeTDXMvalExtensions(m comid.Measurement) error {
val, err := m.Val.Extensions.Get("tcbevalnum")
if err != nil {
return fmt.Errorf("failed to decode tcbevalnum from measurement extensions")
Expand Down Expand Up @@ -408,7 +408,7 @@ func extractSeamMeasurements(m comid.Measurements) error {
return fmt.Errorf("no measurements")
}
for i, m := range m.Values {
if err := decodeMValExtensions(m); err != nil {
if err := decodeTDXMvalExtensions(m); err != nil {
return fmt.Errorf("extracting measurement at index %d: %w", i, err)
}

Expand Down
8 changes: 4 additions & 4 deletions comid/tdx-profile/mval_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

//"github.com/veraison/eat"

// MvalExtensions contains the Intel TDX profile extensions which can appear in
// TDXMvalExtensions contains the Intel TDX profile extensions which can appear in
// both Reference Values and Endorsed Values
type MvalExtensions struct {
type TDXMvalExtensions struct {

Check failure on line 14 in comid/tdx-profile/mval_extensions.go

View workflow job for this annotation

GitHub Actions / Lint

exported: type name will be used as tdx.TDXMvalExtensions by other packages, and that stutters; consider calling this MvalExtensions (revive)
// a string field extension
TcbDate *tdate `cbor:"-72,keyasint,omitempty" json:"tcbdate,omitempty"`
IsvSVN *teeSVN `cbor:"-73,keyasint,omitempty" json:"isvsvn,omitempty"`
Expand Down Expand Up @@ -44,8 +44,8 @@ func init() {
}

extMap := extensions.NewMap().
Add(comid.ExtReferenceValue, &MvalExtensions{}).
Add(comid.ExtEndorsedValue, &MvalExtensions{})
Add(comid.ExtReferenceValue, &TDXMvalExtensions{}).
Add(comid.ExtEndorsedValue, &TDXMvalExtensions{})

if err := corim.RegisterProfile(profileID, extMap); err != nil {
// will not error, assuming our profile ID is unique, and we've
Expand Down

0 comments on commit 23c1714

Please sign in to comment.