Skip to content

Commit efa7804

Browse files
committed
[dice, ot_certs] add CWT DICE certificate templates
Signed-off-by: Steven Tsai <[email protected]>
1 parent 63f33ac commit efa7804

File tree

5 files changed

+280
-0
lines changed

5 files changed

+280
-0
lines changed

sw/device/silicon_creator/lib/cert/BUILD

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,30 @@ certificate_template(
3434
template = "cdi_1.hjson",
3535
)
3636

37+
certificate_template(
38+
name = "cwt_cose_key_template",
39+
cert_format = "cwt",
40+
template = "cwt_cose_key.hjson",
41+
)
42+
43+
certificate_template(
44+
name = "cwt_dice_chain_entry_payload_template",
45+
cert_format = "cwt",
46+
template = "cwt_dice_chain_entry_payload.hjson",
47+
)
48+
49+
certificate_template(
50+
name = "cwt_dice_chain_entry_input_template",
51+
cert_format = "cwt",
52+
template = "cwt_dice_chain_entry_input.hjson",
53+
)
54+
55+
certificate_template(
56+
name = "cwt_dice_chain_entry_template",
57+
cert_format = "cwt",
58+
template = "cwt_dice_chain_entry.hjson",
59+
)
60+
3761
certificate_template(
3862
name = "tpm_ek_template",
3963
template = "tpm_ek.hjson",
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright lowRISC contributors (OpenTitan project).
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
{
5+
name: "cwt_cose_key",
6+
7+
variables: {
8+
// Creator public key: this is an EC point on
9+
// the prime256v1 curve so it has two components
10+
// (x and y) which are 32-bytes integers.
11+
creator_pub_key_ec_x: {
12+
type: "byte-array",
13+
exact-size: 32,
14+
},
15+
creator_pub_key_ec_y: {
16+
type: "byte-array",
17+
exact-size: 32,
18+
},
19+
},
20+
21+
constants: {
22+
key_type_label: {
23+
type: "integer",
24+
value: 1
25+
},
26+
key_type_value: {
27+
type: "integer",
28+
value: 2
29+
},
30+
alg_type_label: {
31+
type: "integer",
32+
value: 3
33+
},
34+
alg_type_value: {
35+
type: "integer",
36+
value: -7
37+
},
38+
curve_type_label: {
39+
type: "integer",
40+
value: -1
41+
},
42+
curve_type_value: {
43+
type: "integer",
44+
value: 1
45+
},
46+
key_x_label: {
47+
type: "integer",
48+
value: -2
49+
},
50+
key_y_label: {
51+
type: "integer",
52+
value: -3
53+
},
54+
},
55+
56+
structure: {
57+
key_type_label: key_type_value
58+
alg_type_label: alg_type_value
59+
curve_type_label: curve_type_value
60+
key_x_label: creator_pub_key_ec_x
61+
key_y_label: creator_pub_key_ec_y
62+
}
63+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright lowRISC contributors (OpenTitan project).
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
{
5+
name: "cwt_dice_chain_entry",
6+
7+
variables: {
8+
payload: {
9+
type: "byte-array",
10+
max-size: 437
11+
// kCwtDiceChainEntryPayloadMaxVariableSizeBytes from bazel-bin/sw/device/silicon_creator/lib/cert/cwt_dice_chain_entry_payload.h
12+
},
13+
signature: {
14+
type: "byte-array",
15+
exact-size: 64
16+
},
17+
},
18+
19+
constants: {
20+
one_label: {
21+
type: "integer",
22+
value: 1
23+
},
24+
neg_seven_value: {
25+
type: "integer",
26+
value: -7
27+
},
28+
},
29+
30+
structure: [
31+
{
32+
"cbor-byte-array": {
33+
one_label: neg_seven_value
34+
}
35+
},
36+
{},
37+
payload
38+
signature
39+
]
40+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright lowRISC contributors (OpenTitan project).
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
{
5+
name: "cwt_dice_chain_entry_input",
6+
7+
variables: {
8+
payload: {
9+
type: "byte-array",
10+
max-size: 437
11+
// kCwtDiceChainEntryPayloadMaxVariableSizeBytes from bazel-bin/sw/device/silicon_creator/lib/cert/cwt_dice_chain_entry_payload.h
12+
},
13+
},
14+
15+
constants: {
16+
context_value: {
17+
type: "string",
18+
value: "Signature1"
19+
},
20+
zero_value: {
21+
type: "integer",
22+
value: 0
23+
},
24+
one_label: {
25+
type: "integer",
26+
value: 1
27+
},
28+
neg_seven_value: {
29+
type: "integer",
30+
value: -7
31+
},
32+
single_zero_byte_array: {
33+
type: "byte-array",
34+
value: ""
35+
},
36+
},
37+
38+
structure: [
39+
context_value
40+
{
41+
"cbor-byte-array": {
42+
one_label: neg_seven_value
43+
}
44+
},
45+
single_zero_byte_array
46+
payload
47+
]
48+
}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// Copyright lowRISC contributors (OpenTitan project).
2+
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
3+
// SPDX-License-Identifier: Apache-2.0
4+
{
5+
name: "cwt_dice_chain_entry_payload",
6+
7+
variables: {
8+
issuer: {
9+
type: "string",
10+
max-size: 64,
11+
},
12+
subject: {
13+
type: "string",
14+
max-size: 64,
15+
},
16+
code_hash: {
17+
type: "byte-array",
18+
exact-size: 32,
19+
},
20+
config_hash: {
21+
type: "byte-array",
22+
exact-size: 32,
23+
},
24+
config_desc: {
25+
type: "byte-array",
26+
max-size: 64,
27+
},
28+
auth_hash: {
29+
type: "byte-array",
30+
exact-size: 32,
31+
},
32+
mode: {
33+
type: "byte-array",
34+
exact-size: 1,
35+
},
36+
subject_pk: {
37+
type: "byte-array",
38+
exact-size: 77,
39+
},
40+
profile_name: {
41+
type: "string",
42+
exact-size: 10,
43+
},
44+
},
45+
46+
constants: {
47+
issuer_label: {
48+
type: "integer",
49+
value: 1
50+
},
51+
subject_label: {
52+
type: "integer",
53+
value: 2
54+
},
55+
profile_name_label: {
56+
type: "integer",
57+
value: -4670554
58+
},
59+
subject_pk_label: {
60+
type: "integer",
61+
value: -4670552
62+
},
63+
key_usage_label: {
64+
type: "integer",
65+
value: -4670553
66+
},
67+
key_usage_value: {
68+
type: "byte-array",
69+
value: "20"
70+
},
71+
code_hash_label: {
72+
type: "integer",
73+
value: -4670545
74+
},
75+
config_hash_label: {
76+
type: "integer",
77+
value: -4670547
78+
},
79+
config_desc_label: {
80+
type: "integer",
81+
value: -4670548
82+
},
83+
auth_hash_label: {
84+
type: "integer",
85+
value: -4670549
86+
},
87+
mode_label: {
88+
type: "integer",
89+
value: -4670551
90+
},
91+
},
92+
93+
structure: {
94+
issuer_label: issuer
95+
subject_label: subject
96+
code_hash_label: code_hash
97+
config_hash_label: config_hash
98+
config_desc_label: config_desc
99+
auth_hash_label: auth_hash
100+
mode_label: mode
101+
subject_pk_label: subject_pk
102+
key_usage_label: key_usage_value
103+
profile_name_label: profile_name
104+
}
105+
}

0 commit comments

Comments
 (0)