Diced: Add service diced an implementation of android.security.dice
Bug: 198197213
Test: diced_test
Change-Id: I7075c2e7ac8e48a13f4eb177f2e989ff1e6695a2
diff --git a/diced/Android.bp b/diced/Android.bp
new file mode 100644
index 0000000..8de046f
--- /dev/null
+++ b/diced/Android.bp
@@ -0,0 +1,136 @@
+// Copyright 2021, The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+ // See: http://go/android-license-faq
+ // A large-scale-change added 'default_applicable_licenses' to import
+ // all of the 'license_kinds' from "system_security_license"
+ // to get the below license kinds:
+ // SPDX-license-identifier-Apache-2.0
+ default_applicable_licenses: ["system_security_license"],
+}
+
+rust_library {
+ name: "libdiced_utils",
+ crate_name: "diced_utils",
+ srcs: ["src/utils.rs"],
+
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "libanyhow",
+ "libdiced_open_dice_cbor",
+ "libkeystore2_crypto_rust",
+ ],
+}
+
+rust_test {
+ name: "diced_utils_test",
+ crate_name: "diced_utils_test",
+ srcs: ["src/utils.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "libanyhow",
+ "libdiced_open_dice_cbor",
+ "libkeystore2_crypto_rust",
+ ],
+}
+
+rust_library {
+ name: "libdiced_sample_inputs",
+ crate_name: "diced_sample_inputs",
+ srcs: ["src/sample_inputs.rs"],
+
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "libanyhow",
+ "libdiced_open_dice_cbor",
+ "libdiced_utils",
+ "libkeystore2_crypto_rust",
+ ],
+}
+
+rust_test {
+ name: "diced_sample_inputs_test",
+ crate_name: "diced_sample_inputs_test",
+ srcs: ["src/sample_inputs.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "libanyhow",
+ "libdiced_open_dice_cbor",
+ "libdiced_utils",
+ "libkeystore2_crypto_rust",
+ ],
+}
+
+rust_library {
+ name: "libdiced",
+ crate_name: "diced",
+ srcs: ["src/lib.rs"],
+
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "android.security.dice-rust",
+ "libdiced_open_dice_cbor",
+ "libanyhow",
+ "libbinder_rs",
+ "libdiced_utils",
+ "libkeystore2_crypto_rust",
+ "libkeystore2_selinux",
+ "libkeystore2_vintf_rust",
+ "liblibc",
+ "liblog_event_list",
+ "liblog_rust",
+ "libthiserror",
+ ],
+}
+
+rust_binary {
+ name: "diced",
+ srcs: ["src/diced_main.rs"],
+ rustlibs: [
+ "libandroid_logger",
+ "libbinder_rs",
+ "libdiced",
+ "libdiced_open_dice_cbor",
+ "libdiced_utils",
+ "liblog_rust",
+ ],
+ init_rc: ["diced.rc"],
+}
+
+rust_test {
+ name: "diced_test",
+ crate_name: "diced_test",
+ srcs: ["src/lib.rs"],
+ test_suites: ["general-tests"],
+ auto_gen_config: true,
+ rustlibs: [
+ "android.hardware.security.dice-V1-rust",
+ "android.security.dice-rust",
+ "libanyhow",
+ "libbinder_rs",
+ "libdiced_open_dice_cbor",
+ "libdiced_utils",
+ "libkeystore2_crypto_rust",
+ "libkeystore2_selinux",
+ "libkeystore2_vintf_rust",
+ "liblibc",
+ "liblog_rust",
+ "libthiserror",
+ ],
+}