Skip to content

Commit

Permalink
Incorporated Review Comments
Browse files Browse the repository at this point in the history
Signed-off-by: Yogesh Deshpande <[email protected]>
  • Loading branch information
yogeshbdeshpande committed Mar 7, 2024
1 parent 7862a1b commit c9b9c6d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 25 deletions.
23 changes: 19 additions & 4 deletions cocli/data/comid/templates/comid-cca-realm-refval.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,27 @@
"sha-384;QoS1aUymwNLPR4mguVrIAlyBjeUjBDZL580pgbLS7caFsyInfsJYGZYkE9jJssH1"
]
},
"rem": {
"rem0": {
"key-type": "text",
"value": [
"sha-384;IQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem1": {
"key-type": "text",
"value": [
"sha-384;JQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem2": {
"key-type": "text",
"value": [
"sha-384;MQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem3": {
"key-type": "text",
"value": [
"sha-384;IQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;JQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;MQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;NQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
}
Expand Down
6 changes: 0 additions & 6 deletions cocli/data/corim/templates/corim-cca-realm.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"corim-id": "5c57e8f4-46cd-421b-91c9-08cf93e13cfc",
"dependent-rims": [
{
"href": "https://parent.example/rims/ccb3aa85-61b4-40f1-848e-02ad6e8a254b",
"thumbprint": "sha-256:5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU="
}
],
"profiles": [
"http://arm.com/cca/realm/1"
],
Expand Down
6 changes: 0 additions & 6 deletions cocli/data/corim/templates/corim-cca.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
{
"corim-id": "5c57e8f4-46cd-421b-91c9-08cf93e13cfc",
"dependent-rims": [
{
"href": "https://parent.example/rims/ccb3aa85-61b4-40f1-848e-02ad6e8a254b",
"thumbprint": "sha-256:5Fty9cDAtXLbTY06t+l/No/3TmI0eoJN7LZ6hOUiTXU="
}
],
"profiles": [
"http://arm.com/cca/ssd/1"
],
Expand Down
19 changes: 14 additions & 5 deletions comid/example_cca_realm_refval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@ func Example_cca_realm_refval() {
// Index: rim
// Alg: sha-384
// Digest: 4284b5694ca6c0d2cf4789a0b95ac8025c818de52304364be7cd2981b2d2edc685b322277ec25819962413d8c9b2c1f5
// Index: rem
// Index: rem0
// Alg: sha-384
// Digest: 2107bbe761fca52d95136a1354db7a4dd57b1b26be0d3da71d9eb23986b34ba615abf6514cf35e5a9ea55a032d068a78
// Index: rem1
// Alg: sha-384
// Digest: 2507bbe761fca52d95136a1354db7a4dd57b1b26be0d3da71d9eb23986b34ba615abf6514cf35e5a9ea55a032d068a78
// Index: rem2
// Alg: sha-384
// Digest: 3107bbe761fca52d95136a1354db7a4dd57b1b26be0d3da71d9eb23986b34ba615abf6514cf35e5a9ea55a032d068a78
// Index: rem3
// Alg: sha-384
// Digest: 3507bbe761fca52d95136a1354db7a4dd57b1b26be0d3da71d9eb23986b34ba615abf6514cf35e5a9ea55a032d068a78

Expand Down Expand Up @@ -144,7 +147,7 @@ func extractIntegrityRegisters(r *IntegrityRegisters) error {
return fmt.Errorf("no integrity registers")
}

keys, err := extractRegisterIndex(r)
keys, err := extractRegisterIndexes(r)
if err != nil {
return fmt.Errorf("unable to extract register index: %v", err)
}
Expand Down Expand Up @@ -176,17 +179,23 @@ func extractRealmDigests(digests Digests) error {
return nil
}

func extractRegisterIndex(r *IntegrityRegisters) ([]string, error) {
var keys [2]string
func extractRegisterIndexes(r *IntegrityRegisters) ([]string, error) {
var keys [5]string
for k := range r.m {
switch t := k.(type) {
case string:
key := strings.ToLower(t)
switch key {
case "rim":
keys[0] = key
case "rem":
case "rem0":
keys[1] = key
case "rem1":
keys[2] = key
case "rem2":
keys[3] = key
case "rem3":
keys[4] = key
default:
return nil, fmt.Errorf("unexpected register index: %s", key)
}
Expand Down
23 changes: 19 additions & 4 deletions comid/test_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,12 +482,27 @@ var (
"sha-384;QoS1aUymwNLPR4mguVrIAlyBjeUjBDZL580pgbLS7caFsyInfsJYGZYkE9jJssH1"
]
},
"rem": {
"rem0": {
"key-type": "text",
"value": [
"sha-384;IQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem1": {
"key-type": "text",
"value": [
"sha-384;JQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem2": {
"key-type": "text",
"value": [
"sha-384;MQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
},
"rem3": {
"key-type": "text",
"value": [
"sha-384;IQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;JQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;MQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4",
"sha-384;NQe752H8pS2VE2oTVNt6TdV7Gya+DT2nHZ6yOYazS6YVq/ZRTPNeWp6lWgMtBop4"
]
}
Expand Down

0 comments on commit c9b9c6d

Please sign in to comment.