From be7ec48294794682efe017eeae95ea00f6aeac56 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Wed, 14 Aug 2024 05:12:00 +0100 Subject: [PATCH] fix(comid): bring ValueTriple into alignment with rev05 At rev00, for reference/endorsed value triples, the CoRIM spec associated an environment with one or more measurements, allowing for two layers of multiplicity. Since rev01, and up to (current) rev05, the spec removed the second layer, now associating an environment with exactly one measurement. This commit brings our implementation into alignment with the spec, replacing ValueTriple.Measurements collection with the single ValueTriple.Measurement. Signed-off-by: Sergei Trofimov --- cocli/cmd/testcases/psa-refval.cbor | Bin 417 -> 538 bytes cocli/cmd/testcases/signed-corim-invalid.cbor | Bin 166 -> 166 bytes .../signed-corim-valid-with-cots.cbor | Bin 2349 -> 2349 bytes cocli/cmd/testcases/signed-corim-valid.cbor | Bin 799 -> 918 bytes cocli/cmd/testcases/src/psa-refval.yaml | 88 +++--- .../cmd/testcases/src/signed-corim-valid.yaml | 84 ++--- cocli/cmd/testcases/src/test-comid.yaml | 88 +++--- cocli/cmd/testcases/test-comid.cbor | Bin 417 -> 538 bytes cocli/cmd/testcases/test-coswid.cbor | Bin 377 -> 377 bytes cocli/cmd/testcases/test-cots.cbor | Bin 1943 -> 1943 bytes comid/comid_test.go | 18 +- comid/example_cca_realm_refval_test.go | 20 +- comid/example_cca_refval_test.go | 73 ++--- comid/example_psa_refval_test.go | 46 +-- comid/example_test.go | 288 +++++------------- comid/measurement.go | 45 --- comid/test_vars.go | 281 ++++++++++------- comid/testcases/comid-1.cbor | Bin 0 -> 174 bytes comid/testcases/comid-2.cbor | Bin 0 -> 450 bytes comid/testcases/comid-3.cbor | Bin 0 -> 151 bytes comid/testcases/comid-design-cd.cbor | Bin 0 -> 607 bytes comid/testcases/comid-firmware-cd.cbor | Bin 0 -> 339 bytes comid/testcases/regen-from-src.sh | 21 ++ comid/testcases/src/comid-1.diag | 37 +++ comid/testcases/src/comid-2.diag | 97 ++++++ comid/testcases/src/comid-3.diag | 34 +++ comid/testcases/src/comid-design-cd.diag | 119 ++++++++ comid/testcases/src/comid-firmware-cd.diag | 80 +++++ comid/valuetriple.go | 29 +- comid/valuetriple_test.go | 2 +- corim/example_profile_test.go | 27 +- corim/profiles_test.go | 4 +- corim/testcases/comid-ext.json | 28 +- corim/testcases/comid.json | 26 +- .../signed-corim-with-extensions.cbor | Bin 681 -> 800 bytes corim/testcases/signed-example-corim.cbor | Bin 684 -> 803 bytes corim/testcases/signed-good-corim.cbor | Bin 607 -> 726 bytes .../testcases/src/corim-with-extensions.yaml | 92 +++--- corim/testcases/src/example-corim.yaml | 92 +++--- corim/testcases/src/good-corim.yaml | 86 +++--- .../unsigned-corim-with-extensions.cbor | Bin 514 -> 633 bytes corim/testcases/unsigned-example-corim.cbor | Bin 517 -> 636 bytes corim/testcases/unsigned-good-corim.cbor | Bin 440 -> 559 bytes 43 files changed, 1051 insertions(+), 754 deletions(-) create mode 100644 comid/testcases/comid-1.cbor create mode 100644 comid/testcases/comid-2.cbor create mode 100644 comid/testcases/comid-3.cbor create mode 100644 comid/testcases/comid-design-cd.cbor create mode 100644 comid/testcases/comid-firmware-cd.cbor create mode 100644 comid/testcases/regen-from-src.sh create mode 100644 comid/testcases/src/comid-1.diag create mode 100644 comid/testcases/src/comid-2.diag create mode 100644 comid/testcases/src/comid-3.diag create mode 100644 comid/testcases/src/comid-design-cd.diag create mode 100644 comid/testcases/src/comid-firmware-cd.diag diff --git a/cocli/cmd/testcases/psa-refval.cbor b/cocli/cmd/testcases/psa-refval.cbor index 928a9ac0c5baba0347d8fce477a646a14a326dd4..e37b711cb6beda921d18a320c0cc29817e076932 100644 GIT binary patch delta 112 zcmZ3;Jd0(57i)9VLWac?qjhI7?d9}*@aO905^anc>n+a delta 86 zcmbQmvXFU#7i(kFLWaeYI~k29^E0vuH7{bg$rQPmG0Dk?CDlmJP|sjupUT9&>Wqsf lhcjwS?9`m>&Bz1fd}7oPf~ZV!49X8-Ni_hfHJR9_3;?Z&8s-21 diff --git a/cocli/cmd/testcases/signed-corim-invalid.cbor b/cocli/cmd/testcases/signed-corim-invalid.cbor index 06847a2d781fcaec03fb4cdf00661d2875ee1718..53fff8fad1da85902d9c27cc916f97ddeca585bf 100644 GIT binary patch delta 95 zcmV-l0HFV-0j2?vA(1gKRRN*_!5V2)XMg~~8ez^z0H8sjSU}7Sn_CH;x?}X0k0vXT zT$g$#<|+5k=z5)*I+VgHr!BD$$%;bl55P?N(e<R)$h BD;59% delta 96 zcmV-m0H6P+0j2?vArJwg0Kpnz&PV_O!5V2)XMm9*Fh!t2pjbd85kWOoIuaDJv%H5T z(v3yiK``+iD8makm=FgaCRV8y1Oa1^BjMfCBSUV`KG e;khD}?~i(51Fj9rGtM8AOw8jEh%hvB?pfX~!6cUe delta 72 zcmV-O0Js0G60H)j?Fc|cPmfg-UiQGdp#U?VfVe?WwaTb(%Vl5!&8wTCCg(B+`9pTf eljeCr6`)c*g<0;@Lf_*ZQajLmzxAE{j+~maF+_aEkF=GnIl!-r$ z7#B@WW7J?}xXBc`c(M(nHhYqj4@kjeRz@9OrmUd+#FU`Yyu8$+MU%HPnojO#)L?;0 z^B_x4e#02Y%+$DOawU`NS7w>3H7D|ZsbMJCZo8#nS>slNlTvYalV)wW rRjL#DzIpQgg?wtOH*=bw`nhYt?`M@2j7M(o-o&2Nwf)ncwJ8?>`$>X| delta 308 zcmbQnKA&xZVm;#`#)DFsA?Xba2c;6vc`z_6VkmKR_H|Y8DM?W%&P>nC%u83uPOW6T zp-_@hQc_TCrLUiuoSUkbT9KGrkdwL~lBr@D3z{LUjf;WmbCA_BH8L_}!VK192#5)P z@x|?|laTbplN{$KKeYM7*ci#U_$K48B@=Hr2{tw@WLV6U6_lTt5>%R(ms&JAkV!|V zc@e`+rpU#NNlrd2sYZH+dIppGnN%i6GO9B!nykvCG5G_d>EuqPI4*|N)I42xC#J?l zll7TZC%Vg;alE*?|I%CXP()2TKO|FG*~;B i=k&J5{@vg0kYAd!)9&5}wm*H7O!^nzy*Q7za4!Hwvv)KA diff --git a/cocli/cmd/testcases/src/psa-refval.yaml b/cocli/cmd/testcases/src/psa-refval.yaml index 0fae32a4..9a5d71e7 100644 --- a/cocli/cmd/testcases/src/psa-refval.yaml +++ b/cocli/cmd/testcases/src/psa-refval.yaml @@ -22,39 +22,55 @@ # acme-implementation-id-000000001 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDEK + # acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDEK + # acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= diff --git a/cocli/cmd/testcases/src/signed-corim-valid.yaml b/cocli/cmd/testcases/src/signed-corim-valid.yaml index 1a8c4a67..513f2aeb 100644 --- a/cocli/cmd/testcases/src/signed-corim-valid.yaml +++ b/cocli/cmd/testcases/src/signed-corim-valid.yaml @@ -25,42 +25,54 @@ value: acme-implementation-id-000000001 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + - - 0: + 0: + tag: 600 + value: acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + - - 0: + 0: + tag: 600 + value: acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= 2: - 0: tag: 32 diff --git a/cocli/cmd/testcases/src/test-comid.yaml b/cocli/cmd/testcases/src/test-comid.yaml index 0fae32a4..9a5d71e7 100644 --- a/cocli/cmd/testcases/src/test-comid.yaml +++ b/cocli/cmd/testcases/src/test-comid.yaml @@ -22,39 +22,55 @@ # acme-implementation-id-000000001 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDEK + # acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDEK + # acme-implementation-id-000000001 + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= diff --git a/cocli/cmd/testcases/test-comid.cbor b/cocli/cmd/testcases/test-comid.cbor index ddb69dcc2cfb54984edf332a5aa81e9df1e62c44..42a79e38bb812fa3ceafc4f2550c66982ded5263 100644 GIT binary patch delta 85 zcmZ3;Jd1^M3Clu;=B9-ViziB}3o)iRI{UgZWd-FYrUaGd<)s!)bdH(GYCCa$919*b Re`_Y!F)Fh%H8U_W0RXX%8=U|E delta 35 rcmbQmvXGf|3Clu;#)g8V7fVRw6&0nVmZT<^E6G2=ppfYtmi8~5LFV_EHG@Pmc@^_h)~P3!=y5euaN delta 13 UcmbQvKb@a(@kY@m_KA!l03Kum<^TWy diff --git a/comid/comid_test.go b/comid/comid_test.go index 7aed60dd..a708b115 100644 --- a/comid/comid_test.go +++ b/comid/comid_test.go @@ -48,11 +48,11 @@ func Test_Comid_ToJSONPretty(t *testing.T) { Environment: Environment{ Instance: MustNewUUIDInstance(TestUUID), }, - Measurements: *NewMeasurements().Add(&Measurement{ + Measurement: Measurement{ Val: Mval{ RawValue: NewRawValue().SetBytes(MustHexDecode(t, "deadbeef")), }, - }), + }, }), } @@ -70,16 +70,14 @@ func Test_Comid_ToJSONPretty(t *testing.T) { "value": "31fb5abf-023e-4992-aa4e-95f9c1503bfa" } }, - "measurements": [ - { - "value": { - "raw-value": { - "type": "bytes", - "value": "3q2+7w==" - } + "measurement": { + "value": { + "raw-value": { + "type": "bytes", + "value": "3q2+7w==" } } - ] + } } ] } diff --git a/comid/example_cca_realm_refval_test.go b/comid/example_cca_realm_refval_test.go index b2965eb7..fa17fb74 100644 --- a/comid/example_cca_realm_refval_test.go +++ b/comid/example_cca_realm_refval_test.go @@ -71,24 +71,8 @@ func extractRealmRefVal(rv ValueTriple) error { return fmt.Errorf("extracting realm instanceID: %w", err) } - measurements := rv.Measurements - - if err := extractMeasurements(measurements); err != nil { - return fmt.Errorf("extracting measurements: %w", err) - } - - return nil -} - -func extractMeasurements(m Measurements) error { - if len(m.Values) == 0 { - return fmt.Errorf("no measurements") - } - - for i, meas := range m.Values { - if err := extractMeasurement(meas); err != nil { - return fmt.Errorf("extracting measurement at index %d: %w", i, err) - } + if err := extractMeasurement(rv.Measurement); err != nil { + return fmt.Errorf("extracting measurement: %w", err) } return nil diff --git a/comid/example_cca_refval_test.go b/comid/example_cca_refval_test.go index 92d0d49d..1e6787b7 100644 --- a/comid/example_cca_refval_test.go +++ b/comid/example_cca_refval_test.go @@ -21,21 +21,24 @@ func Example_cca_refval() { } // output: - // ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: BL - // Version: 2.1.0 - // Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: PRoT - // Version: 1.3.5 - // Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: ARoT - // Version: 0.1.4 - // Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 - // Label: a non-empty (unique) label - // Raw value: 72617776616c75650a72617776616c75650a + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: BL + //Version: 2.1.0 + //Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: PRoT + //Version: 1.3.5 + //Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: ARoT + //Version: 0.1.4 + //Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //Label: a non-empty (unique) label + //Raw value: 72617776616c75650a72617776616c75650a } func extractCcaRefVals(c *Comid) error { @@ -54,35 +57,33 @@ func extractCcaRefVals(c *Comid) error { func extractCCARefVal(rv ValueTriple) error { class := rv.Environment.Class + m := rv.Measurement if err := extractImplementationID(class); err != nil { return fmt.Errorf("extracting impl-id: %w", err) } - for i, m := range rv.Measurements.Values { - if m.Key == nil { - return fmt.Errorf("missing mKey at index %d", i) + if m.Key == nil { + return fmt.Errorf("missing mKey") + } + if !m.Key.IsSet() { + return fmt.Errorf("mKey not set") + } + + switch t := m.Key.Value.(type) { + case *TaggedPSARefValID: + if err := extractSwMeasurement(m); err != nil { + return fmt.Errorf("extracting measurement: %w", err) } - if !m.Key.IsSet() { - return fmt.Errorf("mKey not set at index %d", i) + case *TaggedCCAPlatformConfigID: + if err := extractCCARefValID(m.Key); err != nil { + return fmt.Errorf("extracting cca-refval-id: %w", err) } - - switch t := m.Key.Value.(type) { - case *TaggedPSARefValID: - if err := extractSwMeasurement(m); err != nil { - return fmt.Errorf("extracting measurement at index %d: %w", i, err) - } - case *TaggedCCAPlatformConfigID: - if err := extractCCARefValID(m.Key); err != nil { - return fmt.Errorf("extracting cca-refval-id: %w", err) - } - if err := extractRawValue(m.Val.RawValue); err != nil { - return fmt.Errorf("extracting raw vlue: %w", err) - } - default: - return fmt.Errorf("unexpected Mkey type: %T", t) + if err := extractRawValue(m.Val.RawValue); err != nil { + return fmt.Errorf("extracting raw vlue: %w", err) } - + default: + return fmt.Errorf("unexpected Mkey type: %T", t) } return nil diff --git a/comid/example_psa_refval_test.go b/comid/example_psa_refval_test.go index 7fa78313..1d7c7bb0 100644 --- a/comid/example_psa_refval_test.go +++ b/comid/example_psa_refval_test.go @@ -21,19 +21,21 @@ func Example_psa_refval() { } // output: - // ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: BL - // Version: 2.1.0 - // Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: PRoT - // Version: 1.3.5 - // Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f - // SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b - // Label: ARoT - // Version: 0.1.4 - // Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: BL + //Version: 2.1.0 + //Digest: 87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7 + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: PRoT + //Version: 1.3.5 + //Digest: 0263829989b6fd954f72baaf2fc64bc2e2f01d692d4de72986ea808f6e99813f + //ImplementationID: 61636d652d696d706c656d656e746174696f6e2d69642d303030303030303031 + //SignerID: acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b + //Label: ARoT + //Version: 0.1.4 + //Digest: a3a5e715f0cc574a73c3f9bebb6bc24f32ffd5b67b387244c2c909da779a1478 } func extractRefVals(c *Comid) error { @@ -57,29 +59,13 @@ func extractPSARefVal(rv ValueTriple) error { return fmt.Errorf("extracting impl-id: %w", err) } - measurements := rv.Measurements - - if err := extractSwMeasurements(measurements); err != nil { + if err := extractSwMeasurement(rv.Measurement); err != nil { return fmt.Errorf("extracting measurements: %w", err) } return nil } -func extractSwMeasurements(m Measurements) error { - if len(m.Values) == 0 { - return fmt.Errorf("no measurements") - } - - for i, m := range m.Values { - if err := extractSwMeasurement(m); err != nil { - return fmt.Errorf("extracting measurement at index %d: %w", i, err) - } - } - - return nil -} - func extractSwMeasurement(m Measurement) error { if err := extractPSARefValID(m.Key); err != nil { return fmt.Errorf("extracting PSA refval id: %w", err) diff --git a/comid/example_test.go b/comid/example_test.go index d94b8fa8..ce9a36a5 100644 --- a/comid/example_test.go +++ b/comid/example_test.go @@ -4,6 +4,7 @@ package comid import ( + _ "embed" "fmt" "github.com/google/uuid" @@ -29,21 +30,18 @@ func Example_encode() { Instance: MustNewUEIDInstance(TestUEID), Group: MustNewUUIDGroup(TestUUID), }, - Measurements: *NewMeasurements(). - Add( - MustNewUUIDMeasurement(TestUUID). - SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). - SetSVN(2). - AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). - AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). - SetFlagsTrue(FlagIsDebug). - SetFlagsFalse(FlagIsSecure). - SetSerialNumber("C02X70VHJHD5"). - SetUEID(TestUEID). - SetUUID(TestUUID). - SetMACaddr(MACaddr(TestMACaddr)). - SetIPaddr(TestIPaddr), - ), + Measurement: *MustNewUUIDMeasurement(TestUUID). + SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). + SetSVN(2). + AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). + AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). + SetFlagsTrue(FlagIsDebug). + SetFlagsFalse(FlagIsSecure). + SetSerialNumber("C02X70VHJHD5"). + SetUEID(TestUEID). + SetUUID(TestUUID). + SetMACaddr(MACaddr(TestMACaddr)). + SetIPaddr(TestIPaddr), }, ). AddEndorsedValue( @@ -57,21 +55,18 @@ func Example_encode() { Instance: MustNewUEIDInstance(TestUEID), Group: MustNewUUIDGroup(TestUUID), }, - Measurements: *NewMeasurements(). - Add( - MustNewUUIDMeasurement(TestUUID). - SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). - SetMinSVN(2). - AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). - AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). - SetFlagsTrue(FlagIsDebug). - SetFlagsFalse(FlagIsSecure, FlagIsConfigured). - SetSerialNumber("C02X70VHJHD5"). - SetUEID(TestUEID). - SetUUID(TestUUID). - SetMACaddr(MACaddr(TestMACaddr)). - SetIPaddr(TestIPaddr), - ), + Measurement: *MustNewUUIDMeasurement(TestUUID). + SetRawValueBytes([]byte{0x01, 0x02, 0x03, 0x04}, []byte{0xff, 0xff, 0xff, 0xff}). + SetMinSVN(2). + AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}). + AddDigest(swid.Sha256_32, []byte{0xff, 0xff, 0xff, 0xff}). + SetFlagsTrue(FlagIsDebug). + SetFlagsFalse(FlagIsSecure, FlagIsConfigured). + SetSerialNumber("C02X70VHJHD5"). + SetUEID(TestUEID). + SetUUID(TestUUID). + SetMACaddr(MACaddr(TestMACaddr)). + SetIPaddr(TestIPaddr), }, ). AddAttestVerifKey( @@ -107,8 +102,8 @@ func Example_encode() { } // Output: - //a50065656e2d474201a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740282a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c6502820100a20069454d4341204c74642e0281020382a200781a6d792d6e733a61636d652d726f616472756e6e65722d626173650100a20078196d792d6e733a61636d652d726f616472756e6e65722d6f6c64010104a4008182a300a500d86f445502c000016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfa81a200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90228020282820644abcdef00820644ffffffff03a201f403f504d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa018182a300a500d8255031fb5abf023e4992aa4e95f9c1503bfa016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfa81a200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90229020282820644abcdef00820644ffffffff03a300f401f403f504d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa028182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d038182a101d8255031fb5abf023e4992aa4e95f9c1503bfa81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d - //{"lang":"en-GB","tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator"]},{"name":"EMCA Ltd.","roles":["maintainer"]}],"linked-tags":[{"target":"my-ns:acme-roadrunner-base","rel":"supplements"},{"target":"my-ns:acme-roadrunner-old","rel":"replaces"}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.5.2.8192"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurements":[{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"exact-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"flags":{"is-secure":false,"is-debug":true},"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}]}],"endorsed-values":[{"environment":{"class":{"id":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurements":[{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"min-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"flags":{"is-configured":false,"is-secure":false,"is-debug":true},"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}]}],"dev-identity-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}],"attester-verification-keys":[{"environment":{"instance":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}} + //a50065656e2d474201a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740282a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c6502820100a20069454d4341204c74642e0281020382a200781a6d792d6e733a61636d652d726f616472756e6e65722d626173650100a20078196d792d6e733a61636d652d726f616472756e6e65722d6f6c64010104a4008182a300a500d86f445502c000016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfaa200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90228020282820644abcdef00820644ffffffff03a201f403f504d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa018182a300a500d8255031fb5abf023e4992aa4e95f9c1503bfa016941434d45204c74642e026a526f616452756e6e65720300040101d902264702deadbeefdead02d8255031fb5abf023e4992aa4e95f9c1503bfaa200d8255031fb5abf023e4992aa4e95f9c1503bfa01aa01d90229020282820644abcdef00820644ffffffff03a300f401f403f504d9023044010203040544ffffffff064802005e1000000001075020010db8000000000000000000000068086c43303258373056484a484435094702deadbeefdead0a5031fb5abf023e4992aa4e95f9c1503bfa028182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d038182a101d8255031fb5abf023e4992aa4e95f9c1503bfa81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d + //{"lang":"en-GB","tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator"]},{"name":"EMCA Ltd.","roles":["maintainer"]}],"linked-tags":[{"target":"my-ns:acme-roadrunner-base","rel":"supplements"},{"target":"my-ns:acme-roadrunner-old","rel":"replaces"}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"oid","value":"2.5.2.8192"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurement":{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"exact-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"flags":{"is-secure":false,"is-debug":true},"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}}],"endorsed-values":[{"environment":{"class":{"id":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"vendor":"ACME Ltd.","model":"RoadRunner","layer":0,"index":1},"instance":{"type":"ueid","value":"At6tvu/erQ=="},"group":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"measurement":{"key":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"},"value":{"svn":{"type":"min-value","value":2},"digests":["sha-256-32;q83vAA==","sha-256-32;/////w=="],"flags":{"is-configured":false,"is-secure":false,"is-debug":true},"raw-value":{"type":"bytes","value":"AQIDBA=="},"raw-value-mask":"/////w==","mac-addr":"02:00:5e:10:00:00:00:01","ip-addr":"2001:db8::68","serial-number":"C02X70VHJHD5","ueid":"At6tvu/erQ==","uuid":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}}}],"dev-identity-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}],"attester-verification-keys":[{"environment":{"instance":{"type":"uuid","value":"31fb5abf-023e-4992-aa4e-95f9c1503bfa"}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}} } func Example_encode_PSA() { @@ -122,19 +117,23 @@ func Example_encode_PSA() { SetVendor("ACME Ltd."). SetModel("RoadRunner 2.0"), }, - Measurements: *NewMeasurements(). - Add( - MustNewPSAMeasurement( - MustCreatePSARefValID( - TestSignerID, "BL", "5.0.5", - )).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), - ). - Add( - MustNewPSAMeasurement( - MustCreatePSARefValID( - TestSignerID, "PRoT", "1.3.5", - )).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), - ), + Measurement: *MustNewPSAMeasurement( + MustCreatePSARefValID( + TestSignerID, "BL", "5.0.5", + )).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), + }, + ). + AddReferenceValue( + ValueTriple{ + Environment: Environment{ + Class: NewClassImplID(TestImplID). + SetVendor("ACME Ltd."). + SetModel("RoadRunner 2.0"), + }, + Measurement: *MustNewPSAMeasurement( + MustCreatePSARefValID( + TestSignerID, "PRoT", "1.3.5", + )).AddDigest(swid.Sha256_32, []byte{0xab, 0xcd, 0xef, 0x00}), }, ). AddAttestVerifKey( @@ -160,8 +159,8 @@ func Example_encode_PSA() { } // Output: - //a301a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740281a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028301000204a2008182a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e3082a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00a200d90259a3016450526f540465312e332e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00038182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d - //{"tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"psa.impl-id","value":"YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE="},"vendor":"ACME Ltd.","model":"RoadRunner 2.0"}},"measurements":[{"key":{"type":"psa.refval-id","value":{"label":"BL","version":"5.0.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}},{"key":{"type":"psa.refval-id","value":{"label":"PRoT","version":"1.3.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}}]}],"attester-verification-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}} + //a301a10078206d792d6e733a61636d652d726f616472756e6e65722d737570706c656d656e740281a3006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028301000204a2008282a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e30a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef0082a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e30a200d90259a3016450526f540465312e332e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00038182a101d902264702deadbeefdead81d9022a78b12d2d2d2d2d424547494e205055424c4943204b45592d2d2d2d2d0a4d466b77457759484b6f5a497a6a3043415159494b6f5a497a6a304441516344516741455731427671462b2f727938425761375a454d553178595948455138420a6c4c54344d46484f614f2b4943547449767245654570722f7366544150363648326843486462354845584b74524b6f6436514c634f4c504131513d3d0a2d2d2d2d2d454e44205055424c4943204b45592d2d2d2d2d + //{"tag-identity":{"id":"my-ns:acme-roadrunner-supplement"},"entities":[{"name":"ACME Ltd.","regid":"https://acme.example","roles":["creator","tagCreator","maintainer"]}],"triples":{"reference-values":[{"environment":{"class":{"id":{"type":"psa.impl-id","value":"YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE="},"vendor":"ACME Ltd.","model":"RoadRunner 2.0"}},"measurement":{"key":{"type":"psa.refval-id","value":{"label":"BL","version":"5.0.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}}},{"environment":{"class":{"id":{"type":"psa.impl-id","value":"YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE="},"vendor":"ACME Ltd.","model":"RoadRunner 2.0"}},"measurement":{"key":{"type":"psa.refval-id","value":{"label":"PRoT","version":"1.3.5","signer-id":"rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs="}},"value":{"digests":["sha-256-32;q83vAA=="]}}}],"attester-verification-keys":[{"environment":{"instance":{"type":"ueid","value":"At6tvu/erQ=="}},"verification-keys":[{"type":"pkix-base64-key","value":"-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEW1BvqF+/ry8BWa7ZEMU1xYYHEQ8B\nlLT4MFHOaO+ICTtIvrEeEpr/sfTAP66H2hCHdb5HEXKtRKod6QLcOLPA1Q==\n-----END PUBLIC KEY-----"}]}]}} } func Example_encode_PSA_attestation_verification() { @@ -381,28 +380,29 @@ func Example_decode_JSON() { // Output: OK } -func Example_decode_CBOR_1() { - // https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-1.diag - in := []byte{ - 0xa3, 0x01, 0xa1, 0x00, 0x50, 0x3f, 0x06, 0xaf, 0x63, 0xa9, 0x3c, 0x11, - 0xe4, 0x97, 0x97, 0x00, 0x50, 0x56, 0x90, 0x77, 0x3f, 0x02, 0x81, 0xa3, - 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, - 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, - 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, - 0x81, 0x00, 0x04, 0xa1, 0x00, 0x81, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, - 0x25, 0x50, 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, - 0xab, 0x5b, 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, - 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x6f, 0x41, 0x43, 0x4d, 0x45, 0x20, - 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x03, 0x01, - 0x81, 0xa1, 0x01, 0xa2, 0x00, 0xa2, 0x00, 0x65, 0x31, 0x2e, 0x30, 0x2e, - 0x30, 0x01, 0x19, 0x40, 0x00, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0x44, - 0xaa, 0x33, 0x6a, 0xf4, 0xcb, 0x14, 0xa8, 0x79, 0x43, 0x2e, 0x53, 0xdd, - 0x65, 0x71, 0xc7, 0xfa, 0x9b, 0xcc, 0xaf, 0xb7, 0x5f, 0x48, 0x82, 0x59, - 0x26, 0x2d, 0x6e, 0xa3, 0xa4, 0xd9, 0x1b, - } +var ( + // test cases are based on diag files here: + // https://github.com/ietf-rats-wg/draft-ietf-rats-corim/tree/main/cddl/examples + + //go:embed testcases/comid-1.cbor + testComid1 []byte + + //go:embed testcases/comid-2.cbor + testComid2 []byte + + //go:embed testcases/comid-design-cd.cbor + testComidDesignCD []byte + + //go:embed testcases/comid-firmware-cd.cbor + testComidFirmwareCD []byte + + //go:embed testcases/comid-3.cbor + testComid3 []byte +) +func Example_decode_CBOR_1() { comid := Comid{} - err := comid.FromCBOR(in) + err := comid.FromCBOR(testComid1) if err != nil { fmt.Printf("FAIL: %v", err) } else { @@ -413,50 +413,8 @@ func Example_decode_CBOR_1() { } func Example_decode_CBOR_2() { - // https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-2.diag - in := []byte{ - 0xa3, 0x01, 0xa1, 0x00, 0x50, 0x3f, 0x06, 0xaf, 0x63, 0xa9, 0x3c, 0x11, - 0xe4, 0x97, 0x97, 0x00, 0x50, 0x56, 0x90, 0x77, 0x3f, 0x02, 0x81, 0xa3, - 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, - 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x61, - 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, - 0x81, 0x00, 0x04, 0xa2, 0x00, 0x83, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, - 0x25, 0x50, 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, - 0xab, 0x5b, 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, - 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x78, 0x18, 0x41, 0x43, 0x4d, 0x45, - 0x20, 0x52, 0x6f, 0x61, 0x64, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x20, - 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x03, 0x01, 0x81, 0xa1, - 0x01, 0xa1, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0x44, 0xaa, 0x33, 0x6a, - 0xf4, 0xcb, 0x14, 0xa8, 0x79, 0x43, 0x2e, 0x53, 0xdd, 0x65, 0x71, 0xc7, - 0xfa, 0x9b, 0xcc, 0xaf, 0xb7, 0x5f, 0x48, 0x82, 0x59, 0x26, 0x2d, 0x6e, - 0xa3, 0xa4, 0xd9, 0x1b, 0x82, 0xa1, 0x00, 0xa5, 0x00, 0xd8, 0x25, 0x50, - 0xa7, 0x1b, 0x3e, 0x38, 0x8d, 0x45, 0x4a, 0x05, 0x81, 0xf3, 0x52, 0xe5, - 0x8c, 0x83, 0x2c, 0x5c, 0x01, 0x6a, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, - 0x49, 0x6e, 0x63, 0x2e, 0x02, 0x77, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, - 0x43, 0x6f, 0x79, 0x6f, 0x74, 0x65, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, - 0x65, 0x64, 0x20, 0x4f, 0x53, 0x03, 0x02, 0x04, 0x00, 0x81, 0xa1, 0x01, - 0xa1, 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0xbb, 0x71, 0x19, 0x8e, 0xd6, - 0x0a, 0x95, 0xdc, 0x3c, 0x61, 0x9e, 0x55, 0x5c, 0x2c, 0x0b, 0x8d, 0x75, - 0x64, 0xa3, 0x80, 0x31, 0xb0, 0x34, 0xa1, 0x95, 0x89, 0x25, 0x91, 0xc6, - 0x53, 0x65, 0xb0, 0x82, 0xa1, 0x00, 0xa5, 0x00, 0xd8, 0x25, 0x50, 0xa7, - 0x1b, 0x3e, 0x38, 0x8d, 0x45, 0x4a, 0x05, 0x81, 0xf3, 0x52, 0xe5, 0x8c, - 0x83, 0x2c, 0x5c, 0x01, 0x6a, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x49, - 0x6e, 0x63, 0x2e, 0x02, 0x77, 0x57, 0x59, 0x4c, 0x49, 0x45, 0x20, 0x43, - 0x6f, 0x79, 0x6f, 0x74, 0x65, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x65, - 0x64, 0x20, 0x4f, 0x53, 0x03, 0x02, 0x04, 0x01, 0x81, 0xa1, 0x01, 0xa1, - 0x02, 0x81, 0x82, 0x01, 0x58, 0x20, 0xbb, 0x71, 0x19, 0x8e, 0xd6, 0x0a, - 0x95, 0xdc, 0x3c, 0x61, 0x9e, 0x55, 0x5c, 0x2c, 0x0b, 0x8d, 0x75, 0x64, - 0xa3, 0x80, 0x31, 0xb0, 0x34, 0xa1, 0x95, 0x89, 0x25, 0x91, 0xc6, 0x53, - 0x65, 0xb0, 0x01, 0x81, 0x82, 0xa1, 0x00, 0xa4, 0x00, 0xd8, 0x25, 0x50, - 0x67, 0xb2, 0x8b, 0x6c, 0x34, 0xcc, 0x40, 0xa1, 0x91, 0x17, 0xab, 0x5b, - 0x05, 0x91, 0x1e, 0x37, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, - 0x6e, 0x63, 0x2e, 0x02, 0x72, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, - 0x6f, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x03, - 0x00, 0x81, 0xa1, 0x01, 0xa1, 0x01, 0xd9, 0x02, 0x28, 0x01, - } - comid := Comid{} - err := comid.FromCBOR(in) + err := comid.FromCBOR(testComid2) if err != nil { fmt.Printf("FAIL: %v", err) } else { @@ -467,63 +425,8 @@ func Example_decode_CBOR_2() { } func Example_decode_CBOR_3() { - // https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-design-cd.diag - in := []byte{ - 0xa4, 0x01, 0xa1, 0x00, 0x50, 0x1e, 0xac, 0xd5, 0x96, 0xf4, 0xa3, 0x4f, - 0xb6, 0x99, 0xbf, 0xae, 0xb5, 0x8e, 0x0a, 0x4e, 0x47, 0x02, 0x81, 0xa3, - 0x00, 0x71, 0x46, 0x50, 0x47, 0x41, 0x20, 0x44, 0x65, 0x73, 0x69, 0x67, - 0x6e, 0x73, 0x2d, 0x52, 0x2d, 0x55, 0x73, 0x01, 0xd8, 0x20, 0x78, 0x1e, - 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x66, 0x70, 0x67, 0x61, - 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, - 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x81, 0x00, 0x03, 0x81, 0xa2, - 0x00, 0x50, 0x97, 0xf5, 0xa7, 0x07, 0x1c, 0x6f, 0x43, 0x8f, 0x87, 0x7a, - 0x4a, 0x02, 0x07, 0x80, 0xeb, 0xe9, 0x01, 0x00, 0x04, 0xa2, 0x00, 0x84, - 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, - 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x01, 0x01, 0x76, 0x66, 0x70, 0x67, - 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, - 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, - 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x02, 0x01, 0x76, 0x66, 0x70, 0x67, - 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, - 0xa1, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x3f, 0xe1, 0x8e, 0xca, 0x40, - 0x53, 0x87, 0x9e, 0x01, 0x7e, 0xf5, 0xeb, 0x7a, 0x3e, 0x51, 0x57, 0x65, - 0x9c, 0x5f, 0x9b, 0xb1, 0x5b, 0x7d, 0x09, 0x95, 0x9b, 0x8b, 0x86, 0x47, - 0x82, 0x2a, 0x4c, 0xc2, 0x1c, 0x3a, 0xa6, 0x72, 0x1c, 0xef, 0x87, 0xf5, - 0xbf, 0xa5, 0x34, 0x95, 0xdb, 0x08, 0x33, 0x82, 0xa1, 0x00, 0xa3, 0x00, - 0xd8, 0x6f, 0x4b, 0x60, 0x86, 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, - 0x04, 0x03, 0x01, 0x76, 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, - 0x67, 0x6e, 0x73, 0x72, 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, - 0x6c, 0x65, 0x03, 0x02, 0x81, 0xa1, 0x01, 0xa1, 0x02, 0x81, 0x82, 0x07, - 0x58, 0x30, 0x20, 0xff, 0x68, 0x1a, 0x08, 0x82, 0xe2, 0x9b, 0x48, 0x19, - 0x53, 0x88, 0x89, 0x36, 0x20, 0x9c, 0xb5, 0x3d, 0xf9, 0xc5, 0xaa, 0xec, - 0x60, 0x6a, 0x2c, 0x24, 0xa0, 0xfb, 0x13, 0x85, 0x95, 0x12, 0x4b, 0x8e, - 0x3f, 0x24, 0xa1, 0x27, 0x71, 0xbc, 0x38, 0x54, 0xcc, 0x68, 0xb4, 0x03, - 0x61, 0xad, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, - 0x48, 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x01, 0x01, 0x76, - 0x66, 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, - 0x75, 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x81, 0xa1, - 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x58, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x58, 0x30, 0x46, - 0x62, 0x24, 0x34, 0x3d, 0x68, 0x18, 0x02, 0xc1, 0x50, 0x6b, 0xbe, 0xd7, - 0xd7, 0xf0, 0x0b, 0x96, 0x9b, 0xad, 0xdd, 0x63, 0x46, 0xe4, 0xf2, 0xe7, - 0xce, 0x14, 0x66, 0x92, 0x99, 0x6f, 0x22, 0xa4, 0x58, 0x14, 0xde, 0x81, - 0xd2, 0x48, 0xf5, 0x83, 0xb6, 0x5f, 0x81, 0x7b, 0x5f, 0xce, 0xab, 0x01, - 0x81, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, 0x48, - 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x02, 0x01, 0x76, 0x66, - 0x70, 0x67, 0x61, 0x64, 0x65, 0x73, 0x69, 0x67, 0x6e, 0x73, 0x72, 0x75, - 0x73, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x81, 0xa1, 0x01, - 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - } - comid := Comid{} - err := comid.FromCBOR(in) + err := comid.FromCBOR(testComidDesignCD) if err != nil { fmt.Printf("FAIL: %v", err) } else { @@ -534,41 +437,8 @@ func Example_decode_CBOR_3() { } func Example_decode_CBOR_4() { - // https://github.com/ietf-rats/ietf-corim-cddl/blob/main/examples/comid-firmware-cd.diag - in := []byte{ - 0xa3, 0x01, 0xa1, 0x00, 0x50, 0xaf, 0x1c, 0xd8, 0x95, 0xbe, 0x78, 0x4a, - 0xdb, 0xb7, 0xe9, 0xad, 0xd4, 0x4a, 0x65, 0xab, 0xf3, 0x02, 0x81, 0xa3, - 0x00, 0x71, 0x46, 0x69, 0x72, 0x6d, 0x77, 0x61, 0x72, 0x65, 0x20, 0x4d, - 0x46, 0x47, 0x20, 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x78, 0x18, - 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x66, 0x77, 0x6d, 0x66, - 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, - 0x02, 0x81, 0x00, 0x04, 0xa2, 0x00, 0x82, 0x82, 0xa1, 0x00, 0xa4, 0x01, - 0x70, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, - 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x67, 0x66, 0x77, 0x59, 0x5f, 0x6e, - 0x35, 0x78, 0x03, 0x00, 0x04, 0x00, 0x81, 0xa1, 0x01, 0xa2, 0x01, 0xd9, - 0x02, 0x28, 0x01, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x15, 0xe7, 0x7d, - 0x6f, 0x13, 0x32, 0x52, 0xf1, 0xdb, 0x70, 0x44, 0x90, 0x13, 0x13, 0x88, - 0x4f, 0x29, 0x77, 0xd2, 0x10, 0x9b, 0x33, 0xc7, 0x9f, 0x33, 0xe0, 0x79, - 0xbf, 0xc7, 0x88, 0x65, 0x25, 0x5c, 0x0f, 0xb7, 0x33, 0xc2, 0x40, 0xfd, - 0xda, 0x54, 0x4b, 0x82, 0x15, 0xd7, 0xb8, 0xf8, 0x15, 0x82, 0xa1, 0x00, - 0xa4, 0x01, 0x70, 0x66, 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, - 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x67, 0x66, 0x77, 0x58, - 0x5f, 0x6e, 0x35, 0x78, 0x03, 0x01, 0x04, 0x00, 0x81, 0xa1, 0x01, 0xa2, - 0x01, 0xd9, 0x02, 0x28, 0x01, 0x02, 0x81, 0x82, 0x07, 0x58, 0x30, 0x3d, - 0x90, 0xb6, 0xbf, 0x00, 0x3d, 0xa2, 0xd9, 0x4e, 0xa5, 0x46, 0x3f, 0x97, - 0xfb, 0x3c, 0x53, 0xdd, 0xc5, 0x1c, 0xfb, 0xa1, 0xe3, 0xe3, 0x8e, 0xef, - 0x7a, 0xf0, 0x71, 0xa6, 0x79, 0x86, 0x59, 0x5d, 0x22, 0x72, 0x91, 0x31, - 0xdf, 0x9f, 0xe8, 0x0f, 0x54, 0x51, 0xee, 0xf1, 0x54, 0xf8, 0x5e, 0x01, - 0x81, 0x82, 0xa1, 0x00, 0xa2, 0x00, 0xd8, 0x6f, 0x4c, 0x60, 0x86, 0x48, - 0x01, 0x86, 0xf8, 0x4d, 0x01, 0x0f, 0x04, 0x63, 0x01, 0x01, 0x70, 0x66, - 0x77, 0x6d, 0x66, 0x67, 0x69, 0x6e, 0x63, 0x2e, 0x65, 0x78, 0x61, 0x6d, - 0x70, 0x6c, 0x65, 0x81, 0xa1, 0x01, 0xa2, 0x04, 0xd9, 0x02, 0x30, 0x48, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x48, 0xff, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, - } - comid := Comid{} - err := comid.FromCBOR(in) + err := comid.FromCBOR(testComidFirmwareCD) if err != nil { fmt.Printf("FAIL: %v", err) } else { @@ -579,24 +449,8 @@ func Example_decode_CBOR_4() { } func Example_decode_CBOR_5() { - // Taken from https://github.com/ietf-corim-cddl/blob/main/examples/comid-3.diag - in := []byte{ - 0xa3, 0x01, 0xa1, 0x00, 0x78, 0x20, 0x6d, 0x79, 0x2d, 0x6e, 0x73, 0x3a, - 0x61, 0x63, 0x6d, 0x65, 0x2d, 0x72, 0x6f, 0x61, 0x64, 0x72, 0x75, 0x6e, - 0x6e, 0x65, 0x72, 0x2d, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x65, 0x6d, 0x65, - 0x6e, 0x74, 0x02, 0x81, 0xa3, 0x00, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, - 0x49, 0x6e, 0x63, 0x2e, 0x01, 0xd8, 0x20, 0x74, 0x68, 0x74, 0x74, 0x70, - 0x73, 0x3a, 0x2f, 0x2f, 0x61, 0x63, 0x6d, 0x65, 0x2e, 0x65, 0x78, 0x61, - 0x6d, 0x70, 0x6c, 0x65, 0x02, 0x83, 0x01, 0x00, 0x02, 0x04, 0xa1, 0x00, - 0x81, 0x82, 0xa1, 0x00, 0xa3, 0x00, 0xd8, 0x6f, 0x44, 0x55, 0x02, 0xc0, - 0x00, 0x01, 0x69, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x49, 0x6e, 0x63, 0x2e, - 0x02, 0x78, 0x18, 0x41, 0x43, 0x4d, 0x45, 0x20, 0x52, 0x6f, 0x61, 0x64, - 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x20, 0x46, 0x69, 0x72, 0x6d, 0x77, - 0x61, 0x72, 0x65, 0x81, 0xa2, 0x00, 0x19, 0x02, 0xbc, 0x01, 0xa1, 0x02, - 0x81, 0x82, 0x06, 0x44, 0xab, 0xcd, 0xef, 0x00, - } comid := Comid{} - err := comid.FromCBOR(in) + err := comid.FromCBOR(testComid3) if err != nil { fmt.Printf("FAIL: %v", err) } else { diff --git a/comid/measurement.go b/comid/measurement.go index ac626246..15d511e5 100644 --- a/comid/measurement.go +++ b/comid/measurement.go @@ -773,48 +773,3 @@ func (o Measurement) Valid() error { return o.Val.Valid() } - -// Measurements is a container for Measurement instances and their extensions. -// It is a thin wrapper around extensions.Collection. -type Measurements extensions.Collection[Measurement, *Measurement] - -func NewMeasurements() *Measurements { - return (*Measurements)(extensions.NewCollection[Measurement]()) -} - -func (o *Measurements) RegisterExtensions(exts extensions.Map) error { - return (*extensions.Collection[Measurement, *Measurement])(o).RegisterExtensions(exts) -} - -func (o *Measurements) GetExtensions() extensions.IMapValue { - return (*extensions.Collection[Measurement, *Measurement])(o).GetExtensions() -} - -func (o *Measurements) Valid() error { - return (*extensions.Collection[Measurement, *Measurement])(o).Valid() -} - -func (o *Measurements) IsEmpty() bool { - return (*extensions.Collection[Measurement, *Measurement])(o).IsEmpty() -} - -func (o *Measurements) Add(val *Measurement) *Measurements { - ret := (*extensions.Collection[Measurement, *Measurement])(o).Add(val) - return (*Measurements)(ret) -} - -func (o Measurements) MarshalCBOR() ([]byte, error) { - return (extensions.Collection[Measurement, *Measurement])(o).MarshalCBOR() -} - -func (o *Measurements) UnmarshalCBOR(data []byte) error { - return (*extensions.Collection[Measurement, *Measurement])(o).UnmarshalCBOR(data) -} - -func (o Measurements) MarshalJSON() ([]byte, error) { - return (extensions.Collection[Measurement, *Measurement])(o).MarshalJSON() -} - -func (o *Measurements) UnmarshalJSON(data []byte) error { - return (*extensions.Collection[Measurement, *Measurement])(o).UnmarshalJSON(data) -} diff --git a/comid/test_vars.go b/comid/test_vars.go index ce3b59fa..8b993e6d 100644 --- a/comid/test_vars.go +++ b/comid/test_vars.go @@ -234,53 +234,75 @@ var ( "model": "RoadRunner" } }, - "measurements": [ - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "BL", - "version": "2.1.0", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } - }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc=" - ] + "label": "BL", + "version": "2.1.0", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "PRoT", - "version": "1.3.5", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } + "value": { + "digests": [ + "sha-256:h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc=" + ] + } + } + }, + { + "environment": { + "class": { + "id": { + "type": "psa.impl-id", + "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, + "vendor": "ACME", + "model": "RoadRunner" + } + }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8=" - ] + "label": "PRoT", + "version": "1.3.5", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "ARoT", - "version": "0.1.4", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } + "value": { + "digests": [ + "sha-256:AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8=" + ] + } + } + }, + { + "environment": { + "class": { + "id": { + "type": "psa.impl-id", + "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, + "vendor": "ACME", + "model": "RoadRunner" + } + }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg=" - ] + "label": "ARoT", + "version": "0.1.4", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } + }, + "value": { + "digests": [ + "sha-256:o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg=" + ] } - ] + } } ] } @@ -349,7 +371,7 @@ var ( } } ` - CCARefValJSONTemplate = `{ + CCARefValJSONTemplate = ` { "lang": "en-GB", "tag-identity": { "id": "43BBE37F-2E61-4B33-AED3-53CFF1428B16", @@ -375,65 +397,99 @@ var ( "model": "RoadRunner" } }, - "measurements": [ - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "BL", - "version": "2.1.0", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } - }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc=" - ] + "label": "BL", + "version": "2.1.0", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "PRoT", - "version": "1.3.5", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } + "value": { + "digests": [ + "sha-256:h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc=" + ] + } + } + }, + { + "environment": { + "class": { + "id": { + "type": "psa.impl-id", + "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, + "vendor": "ACME", + "model": "RoadRunner" + } + }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8=" - ] + "label": "PRoT", + "version": "1.3.5", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, - { - "key": { - "type": "psa.refval-id", - "value": { - "label": "ARoT", - "version": "0.1.4", - "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" - } + "value": { + "digests": [ + "sha-256:AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8=" + ] + } + } + }, + { + "environment": { + "class": { + "id": { + "type": "psa.impl-id", + "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, + "vendor": "ACME", + "model": "RoadRunner" + } + }, + "measurement": { + "key": { + "type": "psa.refval-id", "value": { - "digests": [ - "sha-256:o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg=" - ] + "label": "ARoT", + "version": "0.1.4", + "signer-id": "rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs=" } }, - { - "key": { - "type": "cca.platform-config-id", - "value": "a non-empty (unique) label" + "value": { + "digests": [ + "sha-256:o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg=" + ] + } + } + }, + { + "environment": { + "class": { + "id": { + "type": "psa.impl-id", + "value": "YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE=" }, - "value": { - "raw-value": { - "type": "bytes", - "value": "cmF3dmFsdWUKcmF3dmFsdWUK" - } + "vendor": "ACME", + "model": "RoadRunner" + } + }, + "measurement": { + "key": { + "type": "cca.platform-config-id", + "value": "a non-empty (unique) label" + }, + "value": { + "raw-value": { + "type": "bytes", + "value": "cmF3dmFsdWUKcmF3dmFsdWUK" } } - ] + } } ] } @@ -444,36 +500,35 @@ var ( "tag-identity": { "id": "99019224-57AA-44BC-BEF8-D36BDD6BD035", "version": 0 -}, -"entities": [ - { - "name": "Workload Client Ltd.", - "regid": "https://workloadclient.example", - "roles": [ - "tagCreator", - "creator", - "maintainer" - ] - } -], -"triples": { - "reference-values": [ + }, + "entities": [ { - "environment": { - "class": { - "id": { - "type": "uuid", - "value": "CD1F0E55-26F9-460D-B9D8-F7FDE171787C" + "name": "Workload Client Ltd.", + "regid": "https://workloadclient.example", + "roles": [ + "tagCreator", + "creator", + "maintainer" + ] + } + ], + "triples": { + "reference-values": [ + { + "environment": { + "class": { + "id": { + "type": "uuid", + "value": "CD1F0E55-26F9-460D-B9D8-F7FDE171787C" + }, + "vendor": "Workload Client Ltd" }, - "vendor": "Workload Client Ltd" + "instance": { + "type": "bytes", + "value": "QoS1aUymwNLPR4mguVrIAlyBjeUjBDZL580pgbLS7caFsyInfsJYGZYkE9jJssH1" + } }, - "instance": { - "type": "bytes", - "value": "QoS1aUymwNLPR4mguVrIAlyBjeUjBDZL580pgbLS7caFsyInfsJYGZYkE9jJssH1" - } - }, - "measurements": [ - { + "measurement": { "value": { "raw-value": { "type": "bytes", @@ -513,9 +568,9 @@ var ( } } } - ] - } - ] + } + ] + } } -}` +` ) diff --git a/comid/testcases/comid-1.cbor b/comid/testcases/comid-1.cbor new file mode 100644 index 0000000000000000000000000000000000000000..033b8ddd0ab3c3e1f7631e9b23ad845aab029e56 GIT binary patch literal 174 zcmZ3?xR4>ho^5^dN*lo^)2A~8giR>7XKGx`km=~`>#E?Hm#oKlL!l(2q@Cx`E@D{3kZP!Bpl84+>A=9$*u)s2;Ihg%>&t186_w6ho^5^dN*lo^)2A~8giR>7XKGx`km=~`>#E?Hm#oKlL!l(2q@9G)9NJw=`vOgW(2~g;P6KCmst<-9V{L h2tN_BiLsHG;46ZLUVe!}ej3D6%pl(|-el5X1OT>wqEP?< literal 0 HcmV?d00001 diff --git a/comid/testcases/comid-3.cbor b/comid/testcases/comid-3.cbor new file mode 100644 index 0000000000000000000000000000000000000000..f47d1d1a6138ce4c7572037280425c7c66f8ded7 GIT binary patch literal 151 zcmZ3?xR9YjA-7UDuh=RvIX6|eC_gc!s5CDxwMe(Pw4fj-H8(Y{gsE{cL#Cs%ud9M* zUa}tJ4TX}7l9GaAD}8;C9=+6x#9W|Cre;P4CYFT^jZF&~7Bk$)cL`-Wz`%&m$5bH! mHX{gVMG)8u1-Hzi-15Yt)I|)EOnVp?GBq}_xvW0>o&f-IFf(!h literal 0 HcmV?d00001 diff --git a/comid/testcases/comid-design-cd.cbor b/comid/testcases/comid-design-cd.cbor new file mode 100644 index 0000000000000000000000000000000000000000..d736d6c5a7b1c70db5324001f6d149997af71a56 GIT binary patch literal 607 zcmZ3&xR4=0Zq3zcUl#jso4J48);=yjcc#Y0425n1?v4sBsl}P;dBwUxx}n94Hxw%5 zGD=DcimmkZ(+biPQy`K>rNw%w6^Xe8IjKyI49ty-7y_n$UCu6(@7&*B<;BF_@cJbq z1Ir?YmZpUaiy3a@dndGcFt+{hW#ngJWGusO5Hr(4#zibQnG8G_pn%omKM;U8n8q;S zGiD)EV-tIXf&Ih2Qx3uH^BC*CzOJ$h3{RaCKYL?zE$7tP-EHnoT0VzltdG?U4v`I7bm6k+^+-tn#@wItdd}DR|xz&t~SX_oPm~qDy057lAq5uE@ literal 0 HcmV?d00001 diff --git a/comid/testcases/comid-firmware-cd.cbor b/comid/testcases/comid-firmware-cd.cbor new file mode 100644 index 0000000000000000000000000000000000000000..cb876a6e521693fb0928e2f13f69a06a746233f4 GIT binary patch literal 339 zcmZ3?xR4=Wz08fN`zpL{Z-2S=idX9D&rFSr84BGpi*m~oi&7PQ-P{#C^OE%#Zzxnq zWR#Q?6kF-*rV z@b^}Tca!M#9X~{ITMz-ZfDzpS+X>tDGuSS=>9^F)e)?~l;JZg /dev/null && pwd ) + +if [[ "$(type -p diag2cbor.rb)" == "" ]]; then + echo "ERROR: please install ruby-cbor-diag package" + exit 1 +fi + +for case in "$THIS_DIR"/src/*.diag; do + outfile=$(basename "${case%%.diag}").cbor + + echo "generating $outfile" + + diag2cbor.rb "$case" > "$THIS_DIR/$outfile" +done + +echo "done." diff --git a/comid/testcases/src/comid-1.diag b/comid/testcases/src/comid-1.diag new file mode 100644 index 00000000..c756da18 --- /dev/null +++ b/comid/testcases/src/comid-1.diag @@ -0,0 +1,37 @@ +/ concise-mid-tag / { + / comid.tag-identity / 1 : { + / comid.tag-id / 0 : h'3f06af63a93c11e4979700505690773f' + }, + / comid.entity / 2 : [ { + / comid.entity-name / 0 : "ACME Inc.", + / comid.reg-id / 1 : 32("https://acme.example"), + / comid.role / 2 : [ 0 ] / tag-creator / + } ], + / comid.triples / 4 : { + / comid.reference-triples / 0 : [ [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-uuid-type / 37( + h'67b28b6c34cc40a19117ab5b05911e37' + ), + / comid.vendor / 1 : "ACME Inc.", + / comid.model / 2 : "ACME RoadRunner", + / comid.layer / 3 : 1 + } + }, + / measurement-map / { + / comid.mval / 1 : { + / comid.ver / 0 : { + / comid.version / 0 : "1.0.0", + / comid.version-scheme / 1 : 16384 / semver / + }, + / comid.digests / 2 : [ [ + / hash-alg-id / 1, / sha256 / + / hash-value / h'44aa336af4cb14a879432e53dd6571c7fa9bccafb75f488259262d6ea3a4d91b' + ] ] + } + } + ] ] + } +} diff --git a/comid/testcases/src/comid-2.diag b/comid/testcases/src/comid-2.diag new file mode 100644 index 00000000..ce3c2752 --- /dev/null +++ b/comid/testcases/src/comid-2.diag @@ -0,0 +1,97 @@ +/ concise-mid-tag / { + / comid.tag-identity / 1 : { + / comid.tag-id / 0 : h'3f06af63a93c11e4979700505690773f' + }, + / comid.entity / 2 : [ { + / comid.entity-name / 0 : "ACME Inc.", + / comid.reg-id / 1 : 32("https://acme.example"), + / comid.role / 2 : [ 0 ] / tag-creator / + } ], + / comid.triples / 4 : { + / comid.reference-triples / 0 : [ + [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-uuid-type / 37( + h'67b28b6c34cc40a19117ab5b05911e37' + ), + / comid.vendor / 1 : "ACME Inc.", + / comid.model / 2 : "ACME RoadRunner Firmware", + / comid.layer / 3 : 1 + } + }, + / measurement-map / { + / comid.mval / 1 : { + / comid.digests / 2 : [ [ + / hash-alg-id / 1, / sha256 / + / hash-value / h'44aa336af4cb14a879432e53dd6571c7fa9bccafb75f488259262d6ea3a4d91b' + ] ] + } + } + ], + [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-uuid-type / 37( + h'a71b3e388d454a0581f352e58c832c5c' + ), + / comid.vendor / 1 : "WYLIE Inc.", + / comid.model / 2 : "WYLIE Coyote Trusted OS", + / comid.layer / 3 : 2, + / comid.index / 4 : 0 + } + }, + / measurement-map / { + / comid.mval / 1 : { + / comid.digests / 2 : [ [ + / hash-alg-id / 1, / sha256 / + / hash-value / h'bb71198ed60a95dc3c619e555c2c0b8d7564a38031b034a195892591c65365b0' + ] ] + } + } + ], + [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-uuid-type / 37( + h'a71b3e388d454a0581f352e58c832c5c' + ), + / comid.vendor / 1 : "WYLIE Inc.", + / comid.model / 2 : "WYLIE Coyote Trusted OS", + / comid.layer / 3 : 2, + / comid.index / 4 : 1 + } + }, + / measurement-map / { + / comid.mval / 1 : { + / comid.digests / 2 : [ [ + / hash-alg-id / 1, / sha256 / + / hash-value / h'bb71198ed60a95dc3c619e555c2c0b8d7564a38031b034a195892591c65365b0' + ] ] + } + } + ] + ], + / comid.endorsed-triples / 1 : [ [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-uuid-type / 37( + h'67b28b6c34cc40a19117ab5b05911e37' + ), + / comid.vendor / 1 : "ACME Inc.", + / comid.model / 2 : "ACME Root of Trust", + / comid.layer / 3 : 0 + } + }, + / measurement-map / { + / comid.mval / 1 : { + / comid.svn / 1 : 552(1) + } + } + ] ] + } +} diff --git a/comid/testcases/src/comid-3.diag b/comid/testcases/src/comid-3.diag new file mode 100644 index 00000000..c11fc237 --- /dev/null +++ b/comid/testcases/src/comid-3.diag @@ -0,0 +1,34 @@ +/ concise-mid-tag / { + / comid.tag-identity / 1 : { + / comid.tag-id / 0 : "my-ns:acme-roadrunner-supplement" + }, + / comid.entity / 2 : [ { + / comid.entity-name / 0 : "ACME Inc.", + / comid.reg-id / 1 : 32("https://acme.example"), + / comid.role / 2 : [ 1,0,2 ] / creator, tag-creator, maintainer / + } ], + / comid.triples / 4 : { + / comid.reference-triples / 0 : [ + [ + / environment-map / { + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111( + h'5502C000' + ), + / comid.vendor / 1 : "ACME Inc.", + / comid.model / 2 : "ACME RoadRunner Firmware" + } + }, + / measurement-map / { + / comid.mkey / 0: 700, + / comid.mval / 1 : { + / comid.digests / 2 : [[ + / hash-alg-id / 6, / sha-256-32 / + / hash-value / h'ABCDEF00' ]] + } + } + ] + ] + } +} diff --git a/comid/testcases/src/comid-design-cd.diag b/comid/testcases/src/comid-design-cd.diag new file mode 100644 index 00000000..d3305b56 --- /dev/null +++ b/comid/testcases/src/comid-design-cd.diag @@ -0,0 +1,119 @@ +/ concise-mid-tag / { + / comid.tag-identity / 1 : { + / comid.tag-id / 0 : h'1EACD596F4A34FB699BFAEB58E0A4E47' + }, + / comid.entity / 2 : [ { + / comid.entity-name / 0 : "FPGA Designs-R-Us", + / comid.reg-id / 1 : 32("https://fpgadesignsrus.example"), + / comid.role / 2 : [ 0 ] / tag-creator / + } ], + / comid.linked-tags / 3 : [ { + / comid.linked-tag-id / 0 : h'97F5A7071C6F438F877A4A020780EBE9', + / comid.tag-rel / 1 : / comid.supplements / 0 + } + ], + / comid.triples / 4 : { + / comid.reference-triples / 0 : [ + [ + / environment-map / { + / ** Layer 3 device state ** / + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F0401'), / 2.16.840.1.113741.1.15.4.1 / + / comid.vendor / 1 : "fpgadesignsrus.example", + / comid.layer / 3 : 2 + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / raw-value-group / + / comid.raw-value / 4 : 560(h'0000000000000000'), + / comid.raw-value-mask / 5 : h'FFFFFFFF00000000' + } + } + ], + [ + / environment-map / { + / ** Layer 2 design (IO descriptor) hash ** / + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F0402'), / 2.16.840.1.113741.1.15.4.2 / + / comid.vendor / 1 : "fpgadesignsrus.example", + / comid.layer / 3 : 2 + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / comid.digests / 2 : [ + [ + / hash-alg-id / 7, / SHA384 / + / hash-value / h'3FE18ECA4053879E017EF5EB7A3E5157659C5F9BB15B7D09959B8B8647822A4CC21C3AA6721CEF87F5BFA53495DB0833' + ] + ] + } + } + ], + [ + / environment-map / { + / ** Layer 2 design (CORE descriptor) hash ** / + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F0403'), / 2.16.840.1.113741.1.15.4.3 / + / comid.vendor / 1 : "fpgadesignsrus.example", + / comid.layer / 3 : 2 + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / comid.digests / 2 : [ + [ + / hash-alg-id / 7, / SHA384 / + / hash-value / h'20FF681A0882E29B481953888936209CB53DF9C5AAEC606A2C24A0FB138595124B8E3F24A12771BC3854CC68B40361AD' + ] + ] + } + } + ], + [ + / environment-map / { + / ** Firmware is valid (example assertion) ** / + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F046301'), / 2.16.840.1.113741.1.15.4.99.1 / + / comid.vendor / 1 : "fpgadesignsrus.example" + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / raw-value-group / + / comid.raw-value / 4 : 560(h'000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'), + / comid.raw-value-mask / 5 : h'466224343D681802C1506BBED7D7F00B969BADDD6346E4F2E7CE146692996F22A45814DE81D248F583B65F817B5FCEAB' + } + } + ] + ], + / comid.endorsed-triples / 1 : [ + [ + / environment-map / { + / ** Design is valid (example assertion) ** / + / comid.class / 0 : { + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F046302'), / 2.16.840.1.113741.1.15.4.99.2 / + / comid.vendor / 1 : "fpgadesignsrus.example" + } + }, + / measurement-map / { + / comid.mval / 1 : { + / raw-value-group / + / comid.raw-value / 4 : 560(h'0000000000000000'), + / comid.raw-value-mask / 5 : h'FFFFFFFF00000000' + } + } + ] + ] + } + } diff --git a/comid/testcases/src/comid-firmware-cd.diag b/comid/testcases/src/comid-firmware-cd.diag new file mode 100644 index 00000000..1e8625fc --- /dev/null +++ b/comid/testcases/src/comid-firmware-cd.diag @@ -0,0 +1,80 @@ + + / concise-mid-tag / { + / comid.tag-identity / 1 : { + / comid.tag-id / 0 : h'AF1CD895BE784ADBB7E9ADD44A65ABF3' + }, + / comid.entity / 2 : [ { + / comid.entity-name / 0 : "Firmware MFG Inc.", + / comid.reg-id / 1 : 32("https://fwmfginc.example"), + / comid.role / 2 : [ 0 ] / tag-creator / + } ], + / comid.triples / 4 : { + / comid.reference-triples / 0 : [ + [ + / environment-map / { + / ** Hash of layer 0 firmware ** / + / comid.class / 0 : { + / comid.vendor / 1 : "fwmfginc.example", + / comid.model / 2 : "fwY_n5x", + / comid.layer / 3 : 0, + / comid.index / 4 : 0 + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / comid.svn / 1 : 552(1), + / comid.digests / 2 : [ + [ + / hash-alg-id / 7, / SHA384 / + / hash-value / h'15E77D6F133252F1DB7044901313884F2977D2109B33C79F33E079BFC78865255C0FB733C240FDDA544B8215D7B8F815' + ] + ] + } + } + ], + [ + / environment-map / { + / ** Hash of layer 1 firmware ** / + / comid.class / 0 : { + / comid.vendor / 1 : "fwmfginc.example", + / comid.model / 2 : "fwX_n5x", + / comid.layer / 3 : 1, + / comid.index / 4 : 0 + } + }, + / measurement-map / + { + / comid.mval / 1 : { + / comid.svn / 1 : 552(1), + / comid.digests / 2 : [ + [ + / hash-alg-id / 7, / SHA384 / + / hash-value / h'3D90B6BF003DA2D94EA5463F97FB3C53DDC51CFBA1E3E38EEF7AF071A67986595D22729131DF9FE80F5451EEF154F85E' + ] + ] + } + } + ] + ], + / comid.endorsed-triples / 1 : [ + [ + / environment-map / { + / comid.class / 0 : { + / ** Firmware is valid (example) ** / + / comid.class-id / 0 : + / tagged-oid-type / 111(h'6086480186F84D010F046301'), / 2.16.840.1.113741.1.15.4.99.1 / + / comid.vendor / 1 : "fwmfginc.example" + } + }, + / measurement-map / { + / comid.mval / 1 : { + / raw-value-group / + / comid.raw-value / 4 : 560(h'0000000000000000'), + / comid.raw-value-mask / 5 : h'FFFFFFFF00000000' + } + } + ] + ] + } + } diff --git a/comid/valuetriple.go b/comid/valuetriple.go index a7662ea0..9e175ce8 100644 --- a/comid/valuetriple.go +++ b/comid/valuetriple.go @@ -4,29 +4,28 @@ package comid import ( - "errors" "fmt" "github.com/veraison/corim/extensions" ) -// ValueTriple relates measurements to a target environment, essentially -// forming a subject-predicate-object triple of "measurements-pertain -// to-environment". This structure is used to represent both -// reference-triple-record and endorsed-triple-record in the CoRIM spec (as of -// rev. 04). +// ValueTriple relates a measurement to a target environment, essentially +// forming a subject-predicate-object triple of +// "measurement-pertains-to-environment". This structure is used to represent +// both reference-triple-record and endorsed-triple-record in the CoRIM spec +// (as of rev. 04). type ValueTriple struct { - _ struct{} `cbor:",toarray"` - Environment Environment `json:"environment"` - Measurements Measurements `json:"measurements"` + _ struct{} `cbor:",toarray"` + Environment Environment `json:"environment"` + Measurement Measurement `json:"measurement"` } func (o *ValueTriple) RegisterExtensions(exts extensions.Map) error { - return o.Measurements.RegisterExtensions(exts) + return o.Measurement.RegisterExtensions(exts) } func (o *ValueTriple) GetExtensions() extensions.IMapValue { - return o.Measurements.GetExtensions() + return o.Measurement.GetExtensions() } func (o ValueTriple) Valid() error { @@ -34,12 +33,8 @@ func (o ValueTriple) Valid() error { return fmt.Errorf("environment validation failed: %w", err) } - if o.Measurements.IsEmpty() { - return errors.New("measurements validation failed: no measurement entries") - } - - if err := o.Measurements.Valid(); err != nil { - return fmt.Errorf("measurements validation failed: %w", err) + if err := o.Measurement.Valid(); err != nil { + return fmt.Errorf("measurement validation failed: %w", err) } return nil diff --git a/comid/valuetriple_test.go b/comid/valuetriple_test.go index 0888e32c..857bcf2b 100644 --- a/comid/valuetriple_test.go +++ b/comid/valuetriple_test.go @@ -19,5 +19,5 @@ func Test_ReferenceValue(t *testing.T) { require.NoError(t, err) rv.Environment.Instance = MustNewUUIDInstance(id) err = rv.Valid() - assert.EqualError(t, err, "measurements validation failed: no measurement entries") + assert.EqualError(t, err, "measurement validation failed: no measurement value set") } diff --git a/corim/example_profile_test.go b/corim/example_profile_test.go index becff460..b62a9da5 100644 --- a/corim/example_profile_test.go +++ b/corim/example_profile_test.go @@ -104,10 +104,10 @@ func Example_profile_unmarshal() { Extensions.MustGetString("Address")) fmt.Printf("Measurements:\n") - for _, m := range extractedComid.Triples.ReferenceValues.Values[0].Measurements.Values { + for _, refVal := range extractedComid.Triples.ReferenceValues.Values { - val := hex.EncodeToString((*m.Val.Digests)[0].HashValue) - tsInt := m.Val.Extensions.MustGetInt64("timestamp") + val := hex.EncodeToString((*refVal.Measurement.Val.Digests)[0].HashValue) + tsInt := refVal.Measurement.Val.Extensions.MustGetInt64("timestamp") ts := time.Unix(tsInt, 0).UTC() fmt.Printf(" %v taken at %s\n", val, ts.Format("2006-01-02T15:04:05")) @@ -152,15 +152,6 @@ func Example_profile_marshal() { log.Fatalf("could not set entity Address: %v", err) } - refVal := comid.ValueTriple{ - Environment: comid.Environment{ - Class: comid.NewClassImplID(comid.TestImplID). - SetVendor("ACME Ltd."). - SetModel("RoadRunner 2.0"), - }, - Measurements: *comid.NewMeasurements(), - } - measurement := comid.MustNewPSAMeasurement( comid.MustCreatePSARefValID( comid.TestSignerID, "BL", "5.0.5", @@ -177,7 +168,15 @@ func Example_profile_marshal() { log.Fatal("could not register refval extensions") } - refVal.Measurements.Add(measurement) + refVal := comid.ValueTriple{ + Environment: comid.Environment{ + Class: comid.NewClassImplID(comid.TestImplID). + SetVendor("ACME Ltd."). + SetModel("RoadRunner 2.0"), + }, + Measurement: *measurement, + } + myComid.Triples.AddReferenceValue(refVal) err = myComid.Valid() @@ -195,5 +194,5 @@ func Example_profile_marshal() { fmt.Printf("corim: %v", hex.EncodeToString(buf)) // output: - // corim: a300f6018158d9d901faa40065656e2d474201a100676578616d706c650281a4006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028101206f3132332046616b652053747265657404a1008182a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e3081a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00037822687474703a2f2f6578616d706c652e636f6d2f6578616d706c652d70726f66696c65 + // corim: a300f6018158d8d901faa40065656e2d474201a100676578616d706c650281a4006941434d45204c74642e01d8207468747470733a2f2f61636d652e6578616d706c65028101206f3132332046616b652053747265657404a1008182a100a300d90258582061636d652d696d706c656d656e746174696f6e2d69642d303030303030303031016941434d45204c74642e026e526f616452756e6e657220322e30a200d90259a30162424c0465352e302e35055820acbb11c7e4da217205523ce4ce1a245ae1a239ae3c6bfd9e7871f7e5d8bae86b01a10281820644abcdef00037822687474703a2f2f6578616d706c652e636f6d2f6578616d706c652d70726f66696c65 } diff --git a/corim/profiles_test.go b/corim/profiles_test.go index 4b4a917e..34c5e89e 100644 --- a/corim/profiles_test.go +++ b/corim/profiles_test.go @@ -126,7 +126,7 @@ func TestProfile_marshaling(t *testing.T) { address := cmd.Entities.Values[0].Extensions.MustGetString("Address") assert.Equal(t, "123 Fake Street", address) - ts := cmd.Triples.ReferenceValues.Values[0].Measurements.Values[0]. + ts := cmd.Triples.ReferenceValues.Values[0].Measurement. Val.Extensions.MustGetInt("timestamp") assert.Equal(t, 1720782190, ts) @@ -169,7 +169,7 @@ func TestProfile_marshaling(t *testing.T) { address = cmd.Entities.Values[0].Extensions.MustGetString("Address") assert.Equal(t, "123 Fake Street", address) - ts = cmd.Triples.ReferenceValues.Values[0].Measurements.Values[0]. + ts = cmd.Triples.ReferenceValues.Values[0].Measurement. Val.Extensions.MustGetInt("timestamp") assert.Equal(t, 1720782190, ts) diff --git a/corim/testcases/comid-ext.json b/corim/testcases/comid-ext.json index 541113ec..a670c1ca 100644 --- a/corim/testcases/comid-ext.json +++ b/corim/testcases/comid-ext.json @@ -29,21 +29,19 @@ "model": "RoadRunner" } }, - "measurements": [ - { - "key": { - "type": "cca.platform-config-id", - "value": "cfg v1.0.0" - }, - "value": { - "timestamp": 1720782190, - "raw-value": { - "type": "bytes", - "value": "cmF3dmFsdWUKcmF3dmFsdWUK" - } - } - } - ] + "measurement": { + "key": { + "type": "cca.platform-config-id", + "value": "cfg v1.0.0" + }, + "value": { + "timestamp": 1720782190, + "raw-value": { + "type": "bytes", + "value": "cmF3dmFsdWUKcmF3dmFsdWUK" + } + } + } } ] } diff --git a/corim/testcases/comid.json b/corim/testcases/comid.json index 974a473b..9c4125bc 100644 --- a/corim/testcases/comid.json +++ b/corim/testcases/comid.json @@ -28,20 +28,18 @@ "model": "RoadRunner" } }, - "measurements": [ - { - "key": { - "type": "cca.platform-config-id", - "value": "cfg v1.0.0" - }, - "value": { - "raw-value": { - "type": "bytes", - "value": "cmF3dmFsdWUKcmF3dmFsdWUK" - } - } - } - ] + "measurement": { + "key": { + "type": "cca.platform-config-id", + "value": "cfg v1.0.0" + }, + "value": { + "raw-value": { + "type": "bytes", + "value": "cmF3dmFsdWUKcmF3dmFsdWUK" + } + } + } } ] } diff --git a/corim/testcases/signed-corim-with-extensions.cbor b/corim/testcases/signed-corim-with-extensions.cbor index 4bfca682959be82d3ace80585e5e20241a5f7759..eb03f4ad7520bb67d733aa12b390beacf7840314 100644 GIT binary patch delta 271 zcmZ3wKo0G}*CgZOqOpQw>o>4Sn zyrEE%QBqP+Y^ATCn4Fucms*jSTac5=vXG&++>PeJeiS6g)7O)hb7fW&rr``auTDS07wt2Y8}Q!llL>4PM*l9H}Rv*pxfusT0AarPSbZ~PzFE3$ZZDlTHcwudDY-N#| zAqWJa0D*#`0HcxYCX+q_5)y-=0NDarqXA+A~BWLQ8DEQn~y6W)ZU!NT-eKje9#78O`Hv*Y4*b=BOCfl2gzm_mHE}3{jX5wmD7M6t! z%@bePFfN)L$*3p5aFZ!=F=LXG4@;_%o}r$>SHfYJ&Iqt<9X`hwY&G{7`wO|{`mXO#%V5}$~$K!1%@J(<@%Dj>W|h* buR9Q$dauOr(ws#CnTjtL31;0{Xd(mvu3T%+ delta 261 zcmZ3?wuW_rVhF<`h7w0-Usna6k`#sF%=Em>ymW=^)Jn!13MCmOB?ZM+`ud5cOp zEn#Y0GI59O#5po7EDISLC*HJSZ(hW3lPPlXLp_7ZVvKsi5E;gl zfS~*kmQ+JMV?9%lvdLQ+b$MWNjzGD|kxbf?yO=zjA{=hFHcHob?RyU_~bLD)iLq6GU%X?b7X~S*{#Z#YlS;+7#F986; CBVkh2qTgyv)3G zh3wSI1(8hpix_fCQj1FzlJko)a}_dE7#ky*q;4|)S~B@Mqnr~i^O%|$7?~I{VTS6l zEM#bITF9`NF$E;Vlogbpm=aW)mzP>Ju}y8_{ulv}B&x8^WNF5@iA^?)izcsU)a1U& z6uFos)j-cs&t$S5ql$ZqV^Drbgu}FTkF%W*NR}H){Vlkp8n7YFVQ;H>ard3b2gf`* pe*bk5na5yk)zQWN%ytLUBbL8rOExWDbwRO6N%bCo@a1D`%mJW(X)XW& delta 216 zcmcb{dY@&2u^2;%qqDE8f=@|`LUCq#US?jpLUwB9#5oeG3nCeJEMmwlNi8l>NX{?H z%vH!tVQh?KTzr%9*AkY642?|-85U12VAPqc#l*wjyoli@Q{>{w>lsxh>oFQlp2HX? z3=v{XaSX~2VM#U6Gt@Hy%4<)yXHuM4FDt;*%)rRRkO{M24```Vgu{B4m)2*C+!gA= z>>dSaM^t*GOT~7nNnc!P_{=-rGPX;2A%CJpFE2})_P&jC|Hkb6#k@Vc??&wJYdaYo J(<}QQ004VXPDB6z diff --git a/corim/testcases/src/corim-with-extensions.yaml b/corim/testcases/src/corim-with-extensions.yaml index 2f1a45f1..0eec372e 100644 --- a/corim/testcases/src/corim-with-extensions.yaml +++ b/corim/testcases/src/corim-with-extensions.yaml @@ -33,43 +33,57 @@ YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - -1: 1720782190 - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - -1: 1720782190 - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= - -1: 1720782190 + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + -1: 1720782190 + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + -1: 1720782190 + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + -1: 1720782190 diff --git a/corim/testcases/src/example-corim.yaml b/corim/testcases/src/example-corim.yaml index 55d45847..7dff7941 100644 --- a/corim/testcases/src/example-corim.yaml +++ b/corim/testcases/src/example-corim.yaml @@ -36,43 +36,57 @@ YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - -1: 1720782190 - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - -1: 1720782190 - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= - -1: 1720782190 + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + -1: 1720782190 + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + -1: 1720782190 + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + -1: 1720782190 diff --git a/corim/testcases/src/good-corim.yaml b/corim/testcases/src/good-corim.yaml index 4e61fee6..ca12ebe8 100644 --- a/corim/testcases/src/good-corim.yaml +++ b/corim/testcases/src/good-corim.yaml @@ -27,40 +27,54 @@ YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= 1: ACME 2: RoadRunner - - - 0: - tag: 601 - value: - 1: BL - 4: 2.1.0 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= - - 0: - tag: 601 - value: - 1: PRoT - 4: 1.3.5 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= - - 0: - tag: 601 - value: - 1: ARoT - 4: 0.1.4 - 5: !!binary |- - rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= - 1: - 2: - - - 1 - - !!binary |- - o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= + - 0: + tag: 601 + value: + 1: BL + 4: 2.1.0 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + h0KPxSKAPTEGXnvOPPA/5HUJZjHl4Hu9eg/eYMTPJcc= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: PRoT + 4: 1.3.5 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + AmOCmYm2/ZVPcrqvL8ZLwuLwHWktTecphuqAj26ZgT8= + - - 0: + 0: + tag: 600 + value: !!binary |- + YWNtZS1pbXBsZW1lbnRhdGlvbi1pZC0wMDAwMDAwMDE= + 1: ACME + 2: RoadRunner + - 0: + tag: 601 + value: + 1: ARoT + 4: 0.1.4 + 5: !!binary |- + rLsRx+TaIXIFUjzkzhokWuGiOa48a/2eeHH35di66Gs= + 1: + 2: + - - 1 + - !!binary |- + o6XnFfDMV0pzw/m+u2vCTzL/1bZ7OHJEwskJ2neaFHg= diff --git a/corim/testcases/unsigned-corim-with-extensions.cbor b/corim/testcases/unsigned-corim-with-extensions.cbor index 0e056df92a7d13cf5caff8df0858e92e82bb1894..a67d06388ac3d70013dce48a964dbbeb691974f6 100644 GIT binary patch delta 188 zcmZo-`N=XtTaU^1CgZOqj0+h8oOeI2*Gu#^UUxb8{70v5F{Z{P3i*ac#tLqU*{KS_ zB}J*JB@_KMSXdS^G*9fYVO%uvhw;QydMr%~85U2Rqa(_c6_lTt5>%R(ms+%lagl;l z+C<*G$;pgrlXVzPVXEX&R59FSid@W?;uw@4!jfvBXQ*c~*^W__4XX7xqna2)YHFUY VyAwlhNosM4LUMjlX0AeJ3IJyqK~4Yw delta 124 zcmey#(!?@Bo0sv}O~zkK7*bR7blsgM8j4Sh)DTt3H#9OkT%wSiUzC}vkeLDiK6)tA diff --git a/corim/testcases/unsigned-example-corim.cbor b/corim/testcases/unsigned-example-corim.cbor index 0c715c8f24d0886906a5f8df3eb40b02d6b4d4dd..fff8f2e0c1583e05a9b6e623eb85a1cb218b2c7d 100644 GIT binary patch delta 179 zcmZo=`NP7vWbzqCOKrx+NG98xjK7vJE@TLB-u<{QQbWI8(g zx+?gTr07ka%&5o0vXG&9BA?ATxq