blob: 3de482981e75db0f06de8e34d25e92cd18b8fca6 [file] [log] [blame]
Steven Moreland7d6416c2017-04-18 10:06:28 -07001// Copyright (C) 2014 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// libkeymaster_messages contains just the code necessary to communicate with a
16// AndroidKeymaster implementation, e.g. one running in TrustZone.
17cc_library_shared {
18 name: "libkeymaster_messages",
Steven Morelandd998c152017-04-18 10:25:45 -070019 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +090020 vndk: {
21 enabled: true,
22 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070023 srcs: [
Janis Danisevskisf54cc932017-05-10 15:29:10 -070024 "android_keymaster/android_keymaster_messages.cpp",
25 "android_keymaster/android_keymaster_utils.cpp",
26 "android_keymaster/authorization_set.cpp",
27 "android_keymaster/keymaster_tags.cpp",
28 "android_keymaster/logger.cpp",
29 "android_keymaster/serializable.cpp",
30 "android_keymaster/keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070031 ],
Yifan Hongf0b39bb2017-04-18 17:07:58 -070032 header_libs: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -070033 cflags: [
34 "-Wall",
35 "-Werror",
36 "-Wunused",
37 "-DKEYMASTER_NAME_TAGS",
38 ],
Janis Danisevskisf38a0022017-04-26 14:44:46 -070039 stl: "none",
Steven Moreland7d6416c2017-04-18 10:06:28 -070040 clang: true,
41 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
42 // Currently, if enabled, these flags will cause an internal error in Clang.
43 clang_cflags: ["-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"],
44
45 export_include_dirs: ["include"],
Ivan Lozanoeb9d7532018-01-10 13:07:08 -080046 sanitize: {
47 integer_overflow: false,
48 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070049}
50
Janis Danisevskisf38a0022017-04-26 14:44:46 -070051// libkeymaster_portable contains almost everything needed for a keymaster
Steven Moreland7d6416c2017-04-18 10:06:28 -070052// implementation, lacking only a subclass of the (abstract) KeymasterContext
53// class to provide environment-specific services and a wrapper to translate from
54// the function-based keymaster HAL API to the message-based AndroidKeymaster API.
55cc_library_shared {
Janis Danisevskisf38a0022017-04-26 14:44:46 -070056 name: "libkeymaster_portable",
Janis Danisevskiscf3763f2017-05-03 00:22:06 +000057 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +090058 vndk: {
59 enabled: true,
60 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070061 srcs: [
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070062 "android_keymaster/android_keymaster.cpp",
63 "android_keymaster/android_keymaster_messages.cpp",
64 "android_keymaster/android_keymaster_utils.cpp",
65 "android_keymaster/authorization_set.cpp",
66 "android_keymaster/keymaster_enforcement.cpp",
67 "android_keymaster/keymaster_stl.cpp",
68 "android_keymaster/keymaster_tags.cpp",
69 "android_keymaster/logger.cpp",
70 "android_keymaster/operation.cpp",
71 "android_keymaster/operation_table.cpp",
72 "android_keymaster/serializable.cpp",
73 "key_blob_utils/auth_encrypted_key_blob.cpp",
74 "key_blob_utils/integrity_assured_key_blob.cpp",
75 "key_blob_utils/ocb.c",
76 "key_blob_utils/ocb_utils.cpp",
77 "key_blob_utils/software_keyblobs.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070078 "km_openssl/aes_key.cpp",
79 "km_openssl/aes_operation.cpp",
80 "km_openssl/asymmetric_key.cpp",
81 "km_openssl/asymmetric_key_factory.cpp",
82 "km_openssl/attestation_record.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070083 "km_openssl/ec_key.cpp",
84 "km_openssl/ec_key_factory.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070085 "km_openssl/ecdsa_operation.cpp",
86 "km_openssl/ecies_kem.cpp",
87 "km_openssl/hkdf.cpp",
88 "km_openssl/hmac.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070089 "km_openssl/hmac_key.cpp",
90 "km_openssl/hmac_operation.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070091 "km_openssl/iso18033kdf.cpp",
92 "km_openssl/kdf.cpp",
93 "km_openssl/nist_curve_key_exchange.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070094 "km_openssl/openssl_err.cpp",
95 "km_openssl/openssl_utils.cpp",
96 "km_openssl/rsa_key.cpp",
97 "km_openssl/rsa_key_factory.cpp",
98 "km_openssl/rsa_operation.cpp",
Janis Danisevskis41d5a742017-05-12 10:43:12 -070099 "km_openssl/software_random_source.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700100 "km_openssl/symmetric_key.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700101 ],
102
103 shared_libs: [
104 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700105 ],
Yifan Hong19f07e72017-06-07 15:54:19 -0700106 header_libs: ["libhardware_headers"],
107 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700108 cflags: [
109 "-Wall",
110 "-Werror",
111 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700112 "-DBORINGSSL_NO_CXX",
113 ],
114 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
115 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
116 // weakly defines the subset of stl symbols required for this library to work
117 // and which are also available in the trusty context.
118 stl: "none",
119 clang: true,
120 clang_cflags: [
121 "-Wno-error=unused-const-variable",
122 "-Wno-error=unused-private-field",
123 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
124 // Currently, if enabled, these flags will cause an internal error in Clang.
125 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
126 ],
127
128 export_include_dirs: ["include"],
Ivan Lozanoeb9d7532018-01-10 13:07:08 -0800129 sanitize: {
130 integer_overflow: false,
131 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700132}
133
134// libsoftkeymaster provides a software-based keymaster HAL implementation.
135// This is used by keystore as a fallback for when the hardware keymaster does
136// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700137cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700138 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700139 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900140 vndk: {
141 enabled: true,
142 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700143 srcs: [
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700144 "android_keymaster/keymaster_configuration.cpp",
145 "km_openssl/attestation_utils.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700146 "legacy_support/ec_keymaster0_key.cpp",
147 "legacy_support/ec_keymaster1_key.cpp",
148 "legacy_support/ecdsa_keymaster1_operation.cpp",
149 "legacy_support/keymaster0_engine.cpp",
150 "legacy_support/keymaster1_engine.cpp",
151 "legacy_support/rsa_keymaster0_key.cpp",
152 "legacy_support/rsa_keymaster1_key.cpp",
153 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700154 "legacy_support/keymaster1_legacy_support.cpp",
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700155 "contexts/soft_attestation_cert.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700156 "contexts/soft_keymaster_context.cpp",
157 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700158 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700159 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700160 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700161 cflags: [
162 "-Wall",
163 "-Werror",
164 "-Wunused",
165 ],
166 clang: true,
167 clang_cflags: [
168 "-Wno-error=unused-const-variable",
169 "-Wno-error=unused-private-field",
170 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
171 // Currently, if enabled, these flags will cause an internal error in Clang.
172 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
173 ],
174
175 shared_libs: [
176 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700177 "libkeymaster_portable",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700178 "liblog",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700179 "libbase",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700180 "libcrypto",
181 "libcutils",
182 ],
183
184 export_include_dirs: ["include"],
185}
186
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700187cc_library_shared {
188 name: "libpuresoftkeymasterdevice",
189 vendor_available: true,
190 vndk: {
191 enabled: true,
192 },
193 srcs: [
194 "km_openssl/attestation_utils.cpp",
195 "android_keymaster/keymaster_configuration.cpp",
196 "contexts/soft_attestation_cert.cpp",
197 "contexts/pure_soft_keymaster_context.cpp",
198 "contexts/soft_keymaster_logger.cpp",
199 "km_openssl/soft_keymaster_enforcement.cpp",
200 ],
201 cflags: [
202 "-Wall",
203 "-Werror",
204 "-Wunused",
205 ],
206 clang: true,
207 clang_cflags: [
208 "-Wno-error=unused-const-variable",
209 "-Wno-error=unused-private-field",
210 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
211 // Currently, if enabled, these flags will cause an internal error in Clang.
212 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
213 ],
214
215 shared_libs: [
216 "libkeymaster_messages",
217 "libkeymaster_portable",
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700218 "liblog",
219 "libcrypto",
220 "libcutils",
221 ],
222
223 export_include_dirs: ["include"],
224}
225
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000226cc_library_shared {
227 name: "libkeymaster3device",
Logan Chien65d5a832017-11-21 19:06:34 +0800228 vendor: true,
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000229 srcs: [
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700230 "legacy_support/keymaster_passthrough_key.cpp",
231 "legacy_support/keymaster_passthrough_engine.cpp",
232 "legacy_support/keymaster_passthrough_operation.cpp",
233 "contexts/keymaster1_passthrough_context.cpp",
234 "contexts/keymaster2_passthrough_context.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000235 "ng/AndroidKeymaster3Device.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700236 "android_keymaster/keymaster_configuration.cpp",
237 "km_openssl/attestation_utils.cpp",
238 "legacy_support/ec_keymaster0_key.cpp",
239 "legacy_support/ec_keymaster1_key.cpp",
240 "legacy_support/ecdsa_keymaster1_operation.cpp",
241 "legacy_support/keymaster0_engine.cpp",
242 "legacy_support/keymaster1_engine.cpp",
243 "legacy_support/keymaster1_legacy_support.cpp",
244 "legacy_support/rsa_keymaster0_key.cpp",
245 "legacy_support/rsa_keymaster1_key.cpp",
246 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000247 ],
248 cflags: [
249 "-Wall",
250 "-Werror",
251 "-Wunused",
252 ],
253 clang: true,
254 clang_cflags: [
255 "-Wno-error=unused-const-variable",
256 "-Wno-error=unused-private-field",
257 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
258 // Currently, if enabled, these flags will cause an internal error in Clang.
259 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
260 ],
261
262 shared_libs: [
263 "libkeymaster_messages",
264 "android.hardware.keymaster@3.0",
265 "libcrypto",
266 "libcutils",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700267 "libbase",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000268 "libhidlbase",
269 "libhidltransport",
270 "libkeymaster_portable",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000271 "libpuresoftkeymasterdevice",
272 "liblog",
273 "libutils",
274 ],
275
276 export_include_dirs: ["include", "ng/include"],
277}
278
Shawn Willden9e149572017-10-30 16:08:21 -0600279cc_library_shared {
280 name: "libkeymaster4",
281 vendor_available: true,
282 srcs: [
283 "legacy_support/keymaster_passthrough_key.cpp",
284 "legacy_support/keymaster_passthrough_engine.cpp",
285 "legacy_support/keymaster_passthrough_operation.cpp",
Shawn Willdenefd06732017-11-30 19:34:16 -0700286 "ng/AndroidKeymaster4Device.cpp",
Shawn Willden9e149572017-10-30 16:08:21 -0600287 "android_keymaster/keymaster_configuration.cpp",
288 "km_openssl/attestation_utils.cpp",
289 ],
290 cflags: [
291 "-Wall",
292 "-Werror",
293 "-Wunused",
294 ],
295 clang: true,
296 clang_cflags: [
297 "-Wno-error=unused-const-variable",
298 "-Wno-error=unused-private-field",
299 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
300 // Currently, if enabled, these flags will cause an internal error in Clang.
301 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
302 ],
303
304 shared_libs: [
305 "libkeymaster_messages",
306 "android.hardware.keymaster@4.0",
307 "libcrypto",
308 "libcutils",
309 "libbase",
310 "libhidlbase",
311 "libhidltransport",
312 "libkeymaster_portable",
Shawn Willden9e149572017-10-30 16:08:21 -0600313 "libpuresoftkeymasterdevice",
314 "liblog",
315 "libutils",
316 "libkeymaster4support",
317 ],
318
319 export_include_dirs: ["ng/include"],
320}
321
Steven Moreland7d6416c2017-04-18 10:06:28 -0700322// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
323cc_library_static {
324 name: "libkeymasterfiles",
325 export_include_dirs: [
326 ".",
327 "include",
328 ],
329}