xref: /rk3399_ARM-atf/tools/cert_create/src/tbbr/tbb_cert.c (revision 73c99d4eb377e0e25f7951be53087bf92e7b4b18)
1 /*
2  * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice, this
8  * list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  *
14  * Neither the name of ARM nor the names of its contributors may be used
15  * to endorse or promote products derived from this software without specific
16  * prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #include "tbbr/tbb_cert.h"
32 #include "tbbr/tbb_ext.h"
33 #include "tbbr/tbb_key.h"
34 
35 /*
36  * Certificates used in the chain of trust
37  *
38  * The order of the certificates must follow the enumeration specified in
39  * tbb_cert.h. All certificates are self-signed, so the issuer certificate
40  * field points to itself.
41  */
42 static cert_t tbb_certs[] = {
43 	[BL2_CERT] = {
44 		.id = BL2_CERT,
45 		.fn = NULL,
46 		.cn = "BL2 Certificate",
47 		.key = ROT_KEY,
48 		.issuer = BL2_CERT,
49 		.ext = {
50 			BL2_HASH_EXT
51 		},
52 		.num_ext = 1
53 	},
54 	[TRUSTED_KEY_CERT] = {
55 		.id = TRUSTED_KEY_CERT,
56 		.fn = NULL,
57 		.cn = "Trusted Key Certificate",
58 		.key = ROT_KEY,
59 		.issuer = TRUSTED_KEY_CERT,
60 		.ext = {
61 			TZ_WORLD_PK_EXT,
62 			NTZ_WORLD_PK_EXT
63 		},
64 		.num_ext = 2
65 	},
66 	[BL30_KEY_CERT] = {
67 		.id = BL30_KEY_CERT,
68 		.fn = NULL,
69 		.cn = "BL3-0 Key Certificate",
70 		.key = TRUSTED_WORLD_KEY,
71 		.issuer = BL30_KEY_CERT,
72 		.ext = {
73 			BL30_CONTENT_CERT_PK_EXT
74 		},
75 		.num_ext = 1
76 	},
77 	[BL30_CERT] = {
78 		.id = BL30_CERT,
79 		.fn = NULL,
80 		.cn = "BL3-0 Content Certificate",
81 		.key = BL30_KEY,
82 		.issuer = BL30_CERT,
83 		.ext = {
84 			BL30_HASH_EXT
85 		},
86 		.num_ext = 1
87 	},
88 	[BL31_KEY_CERT] = {
89 		.id = BL31_KEY_CERT,
90 		.fn = NULL,
91 		.cn = "BL3-1 Key Certificate",
92 		.key = TRUSTED_WORLD_KEY,
93 		.issuer = BL31_KEY_CERT,
94 		.ext = {
95 			BL31_CONTENT_CERT_PK_EXT
96 		},
97 		.num_ext = 1
98 	},
99 	[BL31_CERT] = {
100 		.id = BL31_CERT,
101 		.fn = NULL,
102 		.cn = "BL3-1 Content Certificate",
103 		.key = BL31_KEY,
104 		.issuer = BL31_CERT,
105 		.ext = {
106 			BL31_HASH_EXT
107 		},
108 		.num_ext = 1
109 	},
110 	[BL32_KEY_CERT] = {
111 		.id = BL32_KEY_CERT,
112 		.fn = NULL,
113 		.cn = "BL3-2 Key Certificate",
114 		.key = TRUSTED_WORLD_KEY,
115 		.issuer = BL32_KEY_CERT,
116 		.ext = {
117 			BL32_CONTENT_CERT_PK_EXT
118 		},
119 		.num_ext = 1
120 	},
121 	[BL32_CERT] = {
122 		.id = BL32_CERT,
123 		.fn = NULL,
124 		.cn = "BL3-2 Content Certificate",
125 		.key = BL32_KEY,
126 		.issuer = BL32_CERT,
127 		.ext = {
128 			BL32_HASH_EXT
129 		},
130 		.num_ext = 1
131 	},
132 	[BL33_KEY_CERT] = {
133 		.id = BL33_KEY_CERT,
134 		.fn = NULL,
135 		.cn = "BL3-3 Key Certificate",
136 		.key = NON_TRUSTED_WORLD_KEY,
137 		.issuer = BL33_KEY_CERT,
138 		.ext = {
139 			BL33_CONTENT_CERT_PK_EXT
140 		},
141 		.num_ext = 1
142 	},
143 	[BL33_CERT] = {
144 		.id = BL33_CERT,
145 		.fn = NULL,
146 		.cn = "BL3-3 Content Certificate",
147 		.key = BL33_KEY,
148 		.issuer = BL33_CERT,
149 		.ext = {
150 			BL33_HASH_EXT
151 		},
152 		.num_ext = 1
153 	}
154 };
155 
156 REGISTER_COT(tbb_certs);
157