Skip to content

Commit e668332

Browse files
committed
refactor(comid): remove PSA and CCA specific types and cleanup
feat(profiles/psa): extract and consolidate PSA logic into profile package Signed-off-by: Abhishek kumar <[email protected]>
1 parent 5bdb172 commit e668332

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+748
-2133
lines changed

comid/cbor.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021-2024 Contributors to the Veraison project.
1+
// Copyright 2021-2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package comid
@@ -32,9 +32,6 @@ var (
3232
560: TaggedBytes{},
3333
561: TaggedCertPathThumbprint{},
3434
564: TaggedRawIntRange{},
35-
// PSA profile tags
36-
601: TaggedPSARefValID{},
37-
602: TaggedCCAPlatformConfigID(""),
3835
}
3936
)
4037

comid/ccaplatformconfigid.go

Lines changed: 0 additions & 98 deletions
This file was deleted.

comid/ccaplatformconfigid_test.go

Lines changed: 0 additions & 95 deletions
This file was deleted.

comid/class.go

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2021-2024 Contributors to the Veraison project.
1+
// Copyright 2021-2026 Contributors to the Veraison project.
22
// SPDX-License-Identifier: Apache-2.0
33

44
package comid
@@ -31,17 +31,6 @@ func NewClassUUID(uuid UUID) *Class {
3131
return &Class{ClassID: classID}
3232
}
3333

34-
// NewClassImplID instantiates a new Class object that identifies the specified PSA
35-
// Implementation ID
36-
func NewClassImplID(implID ImplID) *Class {
37-
classID, err := NewImplIDClassID(implID)
38-
if err != nil {
39-
return nil
40-
}
41-
42-
return &Class{ClassID: classID}
43-
}
44-
4534
// NewClassOID instantiates a new Class object that identifies the OID
4635
func NewClassOID(oid string) *Class {
4736
classID, err := NewOIDClassID(oid)

comid/class_test.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,6 @@ func TestClass_MarshalCBOR_UUID_full(t *testing.T) {
3030
assert.Equal(t, expected, actual)
3131
}
3232

33-
func TestClass_MarshalCBOR_ImplID_full(t *testing.T) {
34-
tv := NewClassImplID(TestImplID).
35-
SetVendor("EMCA Ltd").
36-
SetModel("Rennurdaor").
37-
SetLayer(2).
38-
SetIndex(1)
39-
require.NotNil(t, tv)
40-
41-
// {0: 560(h'61636D652D696D706C656D656E746174696F6E2D69642D303030303030303031'), 1: "EMCA Ltd", 2: "Rennurdaor", 3: 2, 4: 1}
42-
expected := MustHexDecode(t, "a500d90230582061636d652d696d706c656d656e746174696f6e2d69642d3030303030303030310168454d4341204c7464026a52656e6e757264616f7203020401")
43-
44-
actual, err := tv.ToCBOR()
45-
46-
fmt.Printf("CBOR: %x\n", actual)
47-
48-
assert.Nil(t, err)
49-
assert.Equal(t, expected, actual)
50-
}
51-
5233
func TestClass_MarshalCBOR_OID_full(t *testing.T) {
5334
tv := NewClassOID(TestOID).
5435
SetVendor("EMCA Ltd").
@@ -233,3 +214,28 @@ func TestClass_UnmarshalJSON_full(t *testing.T) {
233214
assert.NotNil(t, actual.Index)
234215
assert.Equal(t, uint64(2), actual.GetIndex())
235216
}
217+
218+
func TestClass_NewClassBytes(t *testing.T) {
219+
// Valid bytes
220+
c := NewClassBytes([]byte{0x01, 0x02, 0x03})
221+
assert.NotNil(t, c)
222+
223+
// Invalid type returns nil
224+
c = NewClassBytes(12345)
225+
assert.Nil(t, c)
226+
}
227+
228+
func TestClass_ToJSON(t *testing.T) {
229+
// Valid class
230+
c := NewClassUUID(TestUUID).SetVendor("ACME Ltd")
231+
require.NotNil(t, c)
232+
233+
data, err := c.ToJSON()
234+
assert.NoError(t, err)
235+
assert.NotEmpty(t, data)
236+
237+
// Invalid/empty class
238+
var empty Class
239+
_, err = empty.ToJSON()
240+
assert.Error(t, err)
241+
}

0 commit comments

Comments
 (0)