1//
2// Copyright (C) 2022 The Android Open-Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15
16package {
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20rust_binary {
21    name: "android.hardware.security.keymint-service.rust",
22    relative_install_path: "hw",
23    vendor: true,
24    srcs: ["src/keymint_hal_main.rs"],
25    rustlibs: [
26        "libandroid_logger",
27        "libbinder_rs",
28        "libhex",
29        "libkmr_hal",
30        "libkmr_hal_nonsecure",
31        "libkmr_wire",
32        "liblibc",
33        "liblog_rust",
34    ],
35    prefer_rlib: true,
36}
37
38// init_rc
39prebuilt_etc {
40    name: "android.hardware.security.keymint-service.rust.rc",
41    vendor: true,
42    src: "android.hardware.security.keymint-service.rust.rc",
43}
44
45// vintf_fragments
46prebuilt_etc {
47    name: "android.hardware.security.keymint-service.rust.xml",
48    sub_dir: "vintf",
49    vendor: true,
50    src: "android.hardware.security.keymint-service.rust.xml",
51}
52
53prebuilt_etc {
54    name: "android.hardware.security.sharedsecret-service.rust.xml",
55    sub_dir: "vintf",
56    vendor: true,
57    src: "android.hardware.security.sharedsecret-service.rust.xml",
58}
59
60prebuilt_etc {
61    name: "android.hardware.security.secureclock-service.rust.xml",
62    sub_dir: "vintf",
63    vendor: true,
64    src: "android.hardware.security.secureclock-service.rust.xml",
65}
66
67prebuilt_etc {
68    name: "android.hardware.security.keymint-service.trusty.system.xml",
69    sub_dir: "vintf",
70    vendor: true,
71    src: "android.hardware.security.keymint-service.trusty.system.xml",
72}
73
74prebuilt_etc {
75    name: "android.hardware.security.sharedsecret-service.trusty.system.xml",
76    sub_dir: "vintf",
77    vendor: true,
78    src: "android.hardware.security.sharedsecret-service.trusty.system.xml",
79}
80
81prebuilt_etc {
82    name: "android.hardware.security.secureclock-service.trusty.system.xml",
83    sub_dir: "vintf",
84    vendor: true,
85    src: "android.hardware.security.secureclock-service.trusty.system.xml",
86}
87
88// permissions
89prebuilt_etc {
90    name: "android.hardware.hardware_keystore.rust-keymint.xml",
91    sub_dir: "permissions",
92    vendor: true,
93    src: "android.hardware.hardware_keystore.rust-keymint.xml",
94}
95
96apex_defaults {
97    name: "com.android.hardware.keymint.rust_defaults",
98    manifest: "manifest.json",
99    key: "com.google.cf.apex.key",
100    certificate: ":com.google.cf.apex.certificate",
101    soc_specific: true,
102    updatable: false,
103    prebuilts: [
104        // permissions
105        "android.hardware.hardware_keystore.rust-keymint.xml",
106    ],
107}
108
109apex {
110    name: "com.android.hardware.keymint.rust_cf_remote",
111    defaults: ["com.android.hardware.keymint.rust_defaults"],
112    file_contexts: "file_contexts",
113    binaries: [
114        "android.hardware.security.keymint-service.rust",
115    ],
116    prebuilts: [
117        // init_rc
118        "android.hardware.security.keymint-service.rust.rc",
119        // vintf_fragments
120        "android.hardware.security.keymint-service.rust.xml",
121        "android.hardware.security.secureclock-service.rust.xml",
122        "android.hardware.security.sharedsecret-service.rust.xml",
123    ],
124}
125
126apex {
127    name: "com.android.hardware.keymint.rust_cf_guest_trusty_nonsecure",
128    defaults: ["com.android.hardware.keymint.rust_defaults"],
129    file_contexts: "file_contexts_trusty",
130    prebuilts: [
131        // vintf_fragments
132        "android.hardware.security.keymint-service.trusty.system.xml",
133        "android.hardware.security.secureclock-service.trusty.system.xml",
134        "android.hardware.security.sharedsecret-service.trusty.system.xml",
135    ],
136}
137