• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1package {
2    default_applicable_licenses: ["external_open_dice_license"],
3}
4
5license {
6    name: "external_open_dice_license",
7    visibility: [":__subpackages__"],
8    license_kinds: ["SPDX-license-identifier-Apache-2.0"],
9    license_text: ["LICENSE"],
10}
11
12cc_defaults {
13    name: "libopen_dice.cc_defaults",
14    defaults_visibility: ["//visibility:private"],
15    host_supported: true,
16    vendor_available: true,
17    apex_available: [
18        "//apex_available:platform",
19        "com.android.compos",
20        "com.android.virt",
21    ],
22}
23
24cc_library_headers {
25    name: "libopen_dice_headers",
26    defaults: ["libopen_dice.cc_defaults"],
27    export_include_dirs: ["include"],
28}
29
30cc_library_headers {
31    name: "libopen_dice_boringssl_ed25519_headers",
32    defaults: ["libopen_dice.cc_defaults"],
33    export_include_dirs: ["include/dice/config/boringssl_ed25519"],
34}
35
36cc_library_headers {
37    name: "libopen_dice_boringssl_ecdsa_p384_headers",
38    defaults: ["libopen_dice.cc_defaults"],
39    export_include_dirs: ["include/dice/config/boringssl_ecdsa_p384"],
40}
41
42filegroup {
43    name: "libopen_dice_common_srcs",
44    srcs: [
45        "src/clear_memory.c",
46        "src/dice.c",
47        "src/utils.c",
48    ],
49}
50
51filegroup {
52    name: "libopen_dice_cbor_common_srcs",
53    srcs: [
54        "src/boringssl_hash_kdf_ops.c",
55        "src/cbor_cert_op.c",
56        "src/cbor_writer.c",
57    ],
58}
59
60filegroup {
61    name: "libopen_dice_cbor_ed25519_srcs",
62    srcs: [
63        "src/boringssl_ed25519_ops.c",
64        "src/cbor_ed25519_cert_op.c",
65    ],
66}
67
68filegroup {
69    name: "libopen_dice_cbor_p384_srcs",
70    srcs: [
71        "src/boringssl_ecdsa_utils.c",
72        "src/boringssl_p384_ops.c",
73        "src/cbor_p384_cert_op.c",
74    ],
75}
76
77cc_library {
78    name: "libopen_dice_cbor",
79    defaults: ["libopen_dice.cc_defaults"],
80    srcs: [
81        ":libopen_dice_cbor_common_srcs",
82        ":libopen_dice_cbor_ed25519_srcs",
83        ":libopen_dice_common_srcs",
84    ],
85    header_libs: [
86        "libopen_dice_boringssl_ed25519_headers",
87        "libopen_dice_headers",
88    ],
89    export_header_lib_headers: [
90        "libopen_dice_boringssl_ed25519_headers",
91        "libopen_dice_headers",
92    ],
93    shared_libs: ["libcrypto"],
94}
95
96cc_library_static {
97    name: "libopen_dice_cbor_p384",
98    defaults: ["libopen_dice.cc_defaults"],
99    srcs: [
100        ":libopen_dice_cbor_common_srcs",
101        ":libopen_dice_cbor_p384_srcs",
102        ":libopen_dice_common_srcs",
103    ],
104    header_libs: [
105        "libopen_dice_boringssl_ecdsa_p384_headers",
106        "libopen_dice_headers",
107    ],
108    export_header_lib_headers: [
109        "libopen_dice_boringssl_ecdsa_p384_headers",
110        "libopen_dice_headers",
111    ],
112    shared_libs: ["libcrypto"],
113}
114
115// Version of the library missing DiceClearMemory, for baremetal client code.
116cc_library_static {
117    name: "libopen_dice_cbor_baremetal",
118    srcs: [
119        ":libopen_dice_cbor_common_srcs",
120        ":libopen_dice_cbor_ed25519_srcs",
121        ":libopen_dice_common_srcs",
122    ],
123    exclude_srcs: ["src/clear_memory.c"],
124    allow_undefined_symbols: true,
125    header_libs: [
126        "libopen_dice_boringssl_ed25519_headers",
127        "libopen_dice_headers",
128    ],
129    export_header_lib_headers: [
130        "libopen_dice_boringssl_ed25519_headers",
131        "libopen_dice_headers",
132    ],
133    static_libs: ["libcrypto_baremetal"],
134}
135
136filegroup {
137    name: "libopen_dice_android_srcs",
138    srcs: [
139        "src/cbor_reader.c",
140        "src/android.c",
141    ],
142}
143
144cc_library {
145    name: "libopen_dice_android",
146    defaults: ["libopen_dice.cc_defaults"],
147    srcs: [":libopen_dice_android_srcs"],
148    export_shared_lib_headers: ["libopen_dice_cbor"],
149    shared_libs: [
150        "libcrypto",
151        "libopen_dice_cbor",
152    ],
153}
154
155cc_library_static {
156    name: "libopen_dice_android_baremetal",
157    srcs: [":libopen_dice_android_srcs"],
158    export_static_lib_headers: ["libopen_dice_cbor_baremetal"],
159    static_libs: [
160        "libcrypto_baremetal",
161        "libopen_dice_cbor_baremetal",
162    ],
163}
164
165cc_library_static {
166    name: "libopen_dice_android_p384",
167    defaults: ["libopen_dice.cc_defaults"],
168    srcs: [
169        "src/cbor_reader.c",
170        "src/android.c",
171    ],
172    static_libs: ["libopen_dice_cbor_p384"],
173    export_static_lib_headers: ["libopen_dice_cbor_p384"],
174    shared_libs: ["libcrypto"],
175}
176
177cc_test {
178    name: "libopen_dice_test",
179    host_supported: true,
180    cflags: ["-DDICE_USE_GTEST"],
181    srcs: [
182        ":libopen_dice_common_srcs",
183        "src/dice_test.cc",
184    ],
185    header_libs: [
186        "libopen_dice_boringssl_ed25519_headers",
187        "libopen_dice_headers",
188    ],
189    shared_libs: ["libcrypto"],
190}
191
192cc_test {
193    name: "libopen_dice_p384_test",
194    host_supported: true,
195    cflags: ["-DDICE_USE_GTEST"],
196    srcs: [
197        ":libopen_dice_common_srcs",
198        "src/dice_test.cc",
199    ],
200    header_libs: [
201        "libopen_dice_boringssl_ecdsa_p384_headers",
202        "libopen_dice_headers",
203    ],
204    shared_libs: ["libcrypto"],
205}
206
207cc_test {
208    name: "libopen_dice_cbor_writer_test",
209    host_supported: true,
210    cflags: ["-DDICE_USE_GTEST"],
211    srcs: ["src/cbor_writer_test.cc"],
212    static_libs: ["libopen_dice_cbor"],
213}
214
215cc_test {
216    name: "libopen_dice_cbor_writer_p384_test",
217    host_supported: true,
218    cflags: ["-DDICE_USE_GTEST"],
219    srcs: ["src/cbor_writer_test.cc"],
220    static_libs: ["libopen_dice_cbor_p384"],
221}
222
223cc_test {
224    name: "libopen_dice_cbor_reader_test",
225    host_supported: true,
226    cflags: ["-DDICE_USE_GTEST"],
227    srcs: ["src/cbor_reader_test.cc"],
228    static_libs: ["libopen_dice_android"],
229}
230
231cc_test {
232    name: "libopen_dice_cbor_reader_p384_test",
233    host_supported: true,
234    cflags: ["-DDICE_USE_GTEST"],
235    srcs: ["src/cbor_reader_test.cc"],
236    static_libs: ["libopen_dice_android_p384"],
237}
238
239cc_test {
240    name: "libopen_dice_android_test",
241    host_supported: true,
242    cflags: ["-DDICE_USE_GTEST"],
243    srcs: ["src/android_test.cc"],
244    static_libs: [
245        "libopen_dice_android",
246        "libopen_dice_cbor",
247    ],
248    shared_libs: ["libcrypto"],
249}
250
251// TODO: cbor_cert_op_test after resolving COSE dependency
252
253cc_fuzz {
254    name: "libopen_dice_cbor_writer_fuzzer",
255    host_supported: true,
256    srcs: ["src/cbor_writer_fuzzer.cc"],
257    static_libs: ["libopen_dice_cbor"],
258}
259
260cc_fuzz {
261    name: "libopen_dice_cbor_writer_p384_fuzzer",
262    host_supported: true,
263    srcs: ["src/cbor_writer_fuzzer.cc"],
264    static_libs: ["libopen_dice_cbor_p384"],
265}
266
267cc_fuzz {
268    name: "libopen_dice_cbor_reader_fuzzer",
269    host_supported: true,
270    srcs: ["src/cbor_reader_fuzzer.cc"],
271    static_libs: ["libopen_dice_android"],
272}
273
274cc_fuzz {
275    name: "libopen_dice_cbor_reader_p384_fuzzer",
276    host_supported: true,
277    srcs: ["src/cbor_reader_fuzzer.cc"],
278    static_libs: ["libopen_dice_android_p384"],
279}
280
281cc_fuzz {
282    name: "libopen_dice_cbor_fuzzer",
283    host_supported: true,
284    srcs: ["src/fuzzer.cc"],
285    static_libs: ["libopen_dice_cbor"],
286    shared_libs: ["libcrypto"],
287}
288
289cc_fuzz {
290    name: "libopen_dice_cbor_p384_fuzzer",
291    host_supported: true,
292    srcs: ["src/fuzzer.cc"],
293    static_libs: ["libopen_dice_cbor_p384"],
294    shared_libs: ["libcrypto"],
295}
296
297cc_fuzz {
298    name: "libopen_dice_android_fuzzer",
299    host_supported: true,
300    srcs: ["src/android_fuzzer.cc"],
301    static_libs: [
302        "libopen_dice_android",
303        "libopen_dice_cbor",
304    ],
305    shared_libs: ["libcrypto"],
306}
307
308cc_fuzz {
309    name: "libopen_dice_android_p384_fuzzer",
310    host_supported: true,
311    srcs: ["src/android_fuzzer.cc"],
312    static_libs: [
313        "libopen_dice_android_p384",
314        "libopen_dice_cbor_p384",
315    ],
316    shared_libs: ["libcrypto"],
317}
318