• 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    min_sdk_version: "35",
29}
30
31cc_library_headers {
32    name: "libopen_dice_boringssl_ed25519_headers",
33    defaults: ["libopen_dice.cc_defaults"],
34    export_include_dirs: [
35        "include/dice/config/boringssl_ed25519",
36        "include/dice/config/android",
37    ],
38    min_sdk_version: "35",
39}
40
41cc_library_headers {
42    name: "libopen_dice_boringssl_multialg_headers",
43    defaults: ["libopen_dice.cc_defaults"],
44    export_include_dirs: [
45        "include/dice/config/boringssl_multialg",
46        "include/dice/config/android",
47    ],
48    min_sdk_version: "35",
49}
50
51filegroup {
52    name: "libopen_dice_common_srcs",
53    srcs: [
54        "src/clear_memory.c",
55        "src/dice.c",
56        "src/utils.c",
57    ],
58}
59
60filegroup {
61    name: "libopen_dice_cbor_common_srcs",
62    srcs: [
63        "src/boringssl_hash_kdf_ops.c",
64        "src/cbor_cert_op.c",
65        "src/cbor_writer.c",
66    ],
67}
68
69filegroup {
70    name: "libopen_dice_cbor_ed25519_srcs",
71    srcs: [
72        "src/boringssl_ed25519_ops.c",
73    ],
74}
75
76filegroup {
77    name: "libopen_dice_cbor_multialg_srcs",
78    srcs: [
79        "src/boringssl_ecdsa_utils.c",
80        "src/boringssl_multialg_ops.c",
81    ],
82}
83
84cc_library {
85    name: "libopen_dice_cbor",
86    defaults: ["libopen_dice.cc_defaults"],
87    srcs: [
88        ":libopen_dice_cbor_common_srcs",
89        ":libopen_dice_cbor_ed25519_srcs",
90        ":libopen_dice_common_srcs",
91    ],
92    header_libs: [
93        "libopen_dice_boringssl_ed25519_headers",
94        "libopen_dice_headers",
95    ],
96    export_header_lib_headers: [
97        "libopen_dice_boringssl_ed25519_headers",
98        "libopen_dice_headers",
99    ],
100    shared_libs: ["libcrypto"],
101
102    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
103    // until cross-language lto is supported.
104    lto: {
105        never: true,
106    },
107    min_sdk_version: "35",
108}
109
110cc_library {
111    name: "libopen_dice_cbor_multialg",
112    defaults: ["libopen_dice.cc_defaults"],
113    srcs: [
114        ":libopen_dice_cbor_common_srcs",
115        ":libopen_dice_cbor_multialg_srcs",
116        ":libopen_dice_common_srcs",
117    ],
118    header_libs: [
119        "libopen_dice_boringssl_multialg_headers",
120        "libopen_dice_headers",
121    ],
122    export_header_lib_headers: [
123        "libopen_dice_boringssl_multialg_headers",
124        "libopen_dice_headers",
125    ],
126    shared_libs: ["libcrypto"],
127
128    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
129    // until cross-language lto is supported.
130    lto: {
131        never: true,
132    },
133    min_sdk_version: "35",
134}
135
136// Version of the library missing DiceClearMemory, for baremetal client code.
137cc_library_static {
138    name: "libopen_dice_cbor_baremetal_multialg",
139    defaults: ["cc_baremetal_defaults"],
140    srcs: [
141        ":libopen_dice_cbor_common_srcs",
142        ":libopen_dice_cbor_multialg_srcs",
143        ":libopen_dice_common_srcs",
144    ],
145    exclude_srcs: ["src/clear_memory.c"],
146    allow_undefined_symbols: true,
147    header_libs: [
148        "libopen_dice_boringssl_multialg_headers",
149        "libopen_dice_headers",
150    ],
151    export_header_lib_headers: [
152        "libopen_dice_boringssl_multialg_headers",
153        "libopen_dice_headers",
154    ],
155    static_libs: ["libcrypto_baremetal"],
156
157    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
158    // until cross-language lto is supported.
159    lto: {
160        never: true,
161    },
162}
163
164// Basic, standalone implementation of DiceClearMemory, for tests.
165//
166// Attention has not been given to performance, clearing caches or other
167// potential side channels. This should only be used in contexts that are not
168// security sensitive, such as tests.
169cc_library_static {
170    name: "libopen_dice_clear_memory",
171    defaults: ["cc_baremetal_defaults"],
172    srcs: ["src/clear_memory.c"],
173    header_libs: ["libopen_dice_headers"],
174    visibility: [
175        "//packages/modules/Virtualization:__subpackages__",
176    ],
177}
178
179filegroup {
180    name: "libopen_dice_android_srcs",
181    srcs: [
182        "src/cbor_reader.c",
183        "src/android.c",
184    ],
185}
186
187cc_library {
188    name: "libopen_dice_android",
189    defaults: ["libopen_dice.cc_defaults"],
190    srcs: [":libopen_dice_android_srcs"],
191    export_shared_lib_headers: ["libopen_dice_cbor"],
192    shared_libs: [
193        "libcrypto",
194        "libopen_dice_cbor",
195    ],
196
197    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
198    // until cross-language lto is supported.
199    lto: {
200        never: true,
201    },
202    min_sdk_version: "35",
203}
204
205cc_library {
206    name: "libopen_dice_android_multialg",
207    defaults: ["libopen_dice.cc_defaults"],
208    srcs: [":libopen_dice_android_srcs"],
209    export_shared_lib_headers: ["libopen_dice_cbor_multialg"],
210    shared_libs: [
211        "libcrypto",
212        "libopen_dice_cbor_multialg",
213    ],
214
215    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
216    // until cross-language lto is supported.
217    lto: {
218        never: true,
219    },
220    min_sdk_version: "35",
221}
222
223cc_library_static {
224    name: "libopen_dice_android_baremetal_multialg",
225    defaults: ["cc_baremetal_defaults"],
226    srcs: [":libopen_dice_android_srcs"],
227    export_static_lib_headers: ["libopen_dice_cbor_baremetal_multialg"],
228    static_libs: [
229        "libcrypto_baremetal",
230        "libopen_dice_cbor_baremetal_multialg",
231    ],
232
233    // b/336916369: This library gets linked into a rust rlib.  Disable LTO
234    // until cross-language lto is supported.
235    lto: {
236        never: true,
237    },
238}
239
240cc_test {
241    name: "libopen_dice_test",
242    host_supported: true,
243    cflags: ["-DDICE_USE_GTEST"],
244    srcs: [
245        ":libopen_dice_common_srcs",
246        "src/dice_test.cc",
247    ],
248    header_libs: [
249        "libopen_dice_boringssl_ed25519_headers",
250        "libopen_dice_headers",
251    ],
252    shared_libs: ["libcrypto"],
253}
254
255cc_test {
256    name: "libopen_dice_cbor_writer_test",
257    host_supported: true,
258    cflags: ["-DDICE_USE_GTEST"],
259    srcs: ["src/cbor_writer_test.cc"],
260    static_libs: ["libopen_dice_cbor"],
261}
262
263cc_test {
264    name: "libopen_dice_cbor_reader_test",
265    host_supported: true,
266    cflags: ["-DDICE_USE_GTEST"],
267    srcs: ["src/cbor_reader_test.cc"],
268    static_libs: ["libopen_dice_android"],
269}
270
271cc_test {
272    name: "libopen_dice_android_test",
273    host_supported: true,
274    cflags: ["-DDICE_USE_GTEST"],
275    srcs: ["src/android_test.cc"],
276    static_libs: [
277        "libopen_dice_android",
278        "libopen_dice_cbor",
279    ],
280    shared_libs: ["libcrypto"],
281}
282
283// TODO: cbor_cert_op_test after resolving COSE dependency
284
285cc_fuzz {
286    name: "libopen_dice_cbor_writer_fuzzer",
287    host_supported: true,
288    srcs: ["src/cbor_writer_fuzzer.cc"],
289    static_libs: ["libopen_dice_cbor"],
290}
291
292cc_fuzz {
293    name: "libopen_dice_cbor_reader_fuzzer",
294    host_supported: true,
295    srcs: ["src/cbor_reader_fuzzer.cc"],
296    static_libs: ["libopen_dice_android"],
297}
298
299cc_fuzz {
300    name: "libopen_dice_cbor_fuzzer",
301    host_supported: true,
302    srcs: ["src/fuzzer.cc"],
303    static_libs: ["libopen_dice_cbor"],
304    shared_libs: ["libcrypto"],
305}
306
307cc_fuzz {
308    name: "libopen_dice_android_fuzzer",
309    host_supported: true,
310    srcs: ["src/android_fuzzer.cc"],
311    static_libs: [
312        "libopen_dice_android",
313        "libopen_dice_cbor",
314    ],
315    shared_libs: ["libcrypto"],
316}
317
318dirgroup {
319    name: "trusty_dirgroup_external_open-dice",
320    dirs: ["."],
321    visibility: ["//trusty/vendor/google/aosp/scripts"],
322}
323