blob: 27d054911413a0cab354093a9ded348bbcc4cb32 [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"],
46
47}
48
Janis Danisevskisf38a0022017-04-26 14:44:46 -070049// libkeymaster_portable contains almost everything needed for a keymaster
Steven Moreland7d6416c2017-04-18 10:06:28 -070050// implementation, lacking only a subclass of the (abstract) KeymasterContext
51// class to provide environment-specific services and a wrapper to translate from
52// the function-based keymaster HAL API to the message-based AndroidKeymaster API.
53cc_library_shared {
Janis Danisevskisf38a0022017-04-26 14:44:46 -070054 name: "libkeymaster_portable",
Janis Danisevskiscf3763f2017-05-03 00:22:06 +000055 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +090056 vndk: {
57 enabled: true,
58 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070059 srcs: [
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070060 "android_keymaster/android_keymaster.cpp",
61 "android_keymaster/android_keymaster_messages.cpp",
62 "android_keymaster/android_keymaster_utils.cpp",
63 "android_keymaster/authorization_set.cpp",
64 "android_keymaster/keymaster_enforcement.cpp",
65 "android_keymaster/keymaster_stl.cpp",
66 "android_keymaster/keymaster_tags.cpp",
67 "android_keymaster/logger.cpp",
68 "android_keymaster/operation.cpp",
69 "android_keymaster/operation_table.cpp",
70 "android_keymaster/serializable.cpp",
71 "key_blob_utils/auth_encrypted_key_blob.cpp",
72 "key_blob_utils/integrity_assured_key_blob.cpp",
73 "key_blob_utils/ocb.c",
74 "key_blob_utils/ocb_utils.cpp",
75 "key_blob_utils/software_keyblobs.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070076 "km_openssl/aes_key.cpp",
77 "km_openssl/aes_operation.cpp",
78 "km_openssl/asymmetric_key.cpp",
79 "km_openssl/asymmetric_key_factory.cpp",
80 "km_openssl/attestation_record.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070081 "km_openssl/ec_key.cpp",
82 "km_openssl/ec_key_factory.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070083 "km_openssl/ecdsa_operation.cpp",
84 "km_openssl/ecies_kem.cpp",
85 "km_openssl/hkdf.cpp",
86 "km_openssl/hmac.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070087 "km_openssl/hmac_key.cpp",
88 "km_openssl/hmac_operation.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070089 "km_openssl/iso18033kdf.cpp",
90 "km_openssl/kdf.cpp",
91 "km_openssl/nist_curve_key_exchange.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070092 "km_openssl/openssl_err.cpp",
93 "km_openssl/openssl_utils.cpp",
94 "km_openssl/rsa_key.cpp",
95 "km_openssl/rsa_key_factory.cpp",
96 "km_openssl/rsa_operation.cpp",
Janis Danisevskis41d5a742017-05-12 10:43:12 -070097 "km_openssl/software_random_source.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070098 "km_openssl/symmetric_key.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070099 ],
100
101 shared_libs: [
102 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700103 ],
Yifan Hong19f07e72017-06-07 15:54:19 -0700104 header_libs: ["libhardware_headers"],
105 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700106 cflags: [
107 "-Wall",
108 "-Werror",
109 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700110 "-DBORINGSSL_NO_CXX",
111 ],
112 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
113 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
114 // weakly defines the subset of stl symbols required for this library to work
115 // and which are also available in the trusty context.
116 stl: "none",
117 clang: true,
118 clang_cflags: [
119 "-Wno-error=unused-const-variable",
120 "-Wno-error=unused-private-field",
121 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
122 // Currently, if enabled, these flags will cause an internal error in Clang.
123 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
124 ],
125
126 export_include_dirs: ["include"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700127}
128
129// libsoftkeymaster provides a software-based keymaster HAL implementation.
130// This is used by keystore as a fallback for when the hardware keymaster does
131// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700132cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700133 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700134 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900135 vndk: {
136 enabled: true,
137 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700138 srcs: [
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700139 "android_keymaster/keymaster_configuration.cpp",
140 "km_openssl/attestation_utils.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700141 "legacy_support/ec_keymaster0_key.cpp",
142 "legacy_support/ec_keymaster1_key.cpp",
143 "legacy_support/ecdsa_keymaster1_operation.cpp",
144 "legacy_support/keymaster0_engine.cpp",
145 "legacy_support/keymaster1_engine.cpp",
146 "legacy_support/rsa_keymaster0_key.cpp",
147 "legacy_support/rsa_keymaster1_key.cpp",
148 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700149 "legacy_support/keymaster1_legacy_support.cpp",
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700150 "contexts/soft_attestation_cert.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700151 "contexts/soft_keymaster_context.cpp",
152 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700153 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700154 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700155 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700156 cflags: [
157 "-Wall",
158 "-Werror",
159 "-Wunused",
160 ],
161 clang: true,
162 clang_cflags: [
163 "-Wno-error=unused-const-variable",
164 "-Wno-error=unused-private-field",
165 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
166 // Currently, if enabled, these flags will cause an internal error in Clang.
167 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
168 ],
169
170 shared_libs: [
171 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700172 "libkeymaster_portable",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700173 "liblog",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700174 "libbase",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700175 "libcrypto",
176 "libcutils",
177 ],
178
179 export_include_dirs: ["include"],
180}
181
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700182cc_library_shared {
183 name: "libpuresoftkeymasterdevice",
184 vendor_available: true,
185 vndk: {
186 enabled: true,
187 },
188 srcs: [
189 "km_openssl/attestation_utils.cpp",
190 "android_keymaster/keymaster_configuration.cpp",
191 "contexts/soft_attestation_cert.cpp",
192 "contexts/pure_soft_keymaster_context.cpp",
193 "contexts/soft_keymaster_logger.cpp",
194 "km_openssl/soft_keymaster_enforcement.cpp",
195 ],
196 cflags: [
197 "-Wall",
198 "-Werror",
199 "-Wunused",
200 ],
201 clang: true,
202 clang_cflags: [
203 "-Wno-error=unused-const-variable",
204 "-Wno-error=unused-private-field",
205 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
206 // Currently, if enabled, these flags will cause an internal error in Clang.
207 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
208 ],
209
210 shared_libs: [
211 "libkeymaster_messages",
212 "libkeymaster_portable",
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700213 "liblog",
214 "libcrypto",
215 "libcutils",
216 ],
217
218 export_include_dirs: ["include"],
219}
220
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000221cc_library_shared {
222 name: "libkeymaster3device",
Logan Chien65d5a832017-11-21 19:06:34 +0800223 vendor: true,
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000224 srcs: [
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700225 "legacy_support/keymaster_passthrough_key.cpp",
226 "legacy_support/keymaster_passthrough_engine.cpp",
227 "legacy_support/keymaster_passthrough_operation.cpp",
228 "contexts/keymaster1_passthrough_context.cpp",
229 "contexts/keymaster2_passthrough_context.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000230 "ng/AndroidKeymaster3Device.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700231 "android_keymaster/keymaster_configuration.cpp",
232 "km_openssl/attestation_utils.cpp",
233 "legacy_support/ec_keymaster0_key.cpp",
234 "legacy_support/ec_keymaster1_key.cpp",
235 "legacy_support/ecdsa_keymaster1_operation.cpp",
236 "legacy_support/keymaster0_engine.cpp",
237 "legacy_support/keymaster1_engine.cpp",
238 "legacy_support/keymaster1_legacy_support.cpp",
239 "legacy_support/rsa_keymaster0_key.cpp",
240 "legacy_support/rsa_keymaster1_key.cpp",
241 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000242 ],
243 cflags: [
244 "-Wall",
245 "-Werror",
246 "-Wunused",
247 ],
248 clang: true,
249 clang_cflags: [
250 "-Wno-error=unused-const-variable",
251 "-Wno-error=unused-private-field",
252 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
253 // Currently, if enabled, these flags will cause an internal error in Clang.
254 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
255 ],
256
257 shared_libs: [
258 "libkeymaster_messages",
259 "android.hardware.keymaster@3.0",
260 "libcrypto",
261 "libcutils",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700262 "libbase",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000263 "libhidlbase",
264 "libhidltransport",
265 "libkeymaster_portable",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000266 "libpuresoftkeymasterdevice",
267 "liblog",
268 "libutils",
269 ],
270
271 export_include_dirs: ["include", "ng/include"],
272}
273
Shawn Willden9e149572017-10-30 16:08:21 -0600274cc_library_shared {
275 name: "libkeymaster4",
276 vendor_available: true,
277 srcs: [
278 "legacy_support/keymaster_passthrough_key.cpp",
279 "legacy_support/keymaster_passthrough_engine.cpp",
280 "legacy_support/keymaster_passthrough_operation.cpp",
Shawn Willdenefd06732017-11-30 19:34:16 -0700281 "ng/AndroidKeymaster4Device.cpp",
Shawn Willden9e149572017-10-30 16:08:21 -0600282 "android_keymaster/keymaster_configuration.cpp",
283 "km_openssl/attestation_utils.cpp",
284 ],
285 cflags: [
286 "-Wall",
287 "-Werror",
288 "-Wunused",
289 ],
290 clang: true,
291 clang_cflags: [
292 "-Wno-error=unused-const-variable",
293 "-Wno-error=unused-private-field",
294 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
295 // Currently, if enabled, these flags will cause an internal error in Clang.
296 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
297 ],
298
299 shared_libs: [
300 "libkeymaster_messages",
301 "android.hardware.keymaster@4.0",
302 "libcrypto",
303 "libcutils",
304 "libbase",
305 "libhidlbase",
306 "libhidltransport",
307 "libkeymaster_portable",
Shawn Willden9e149572017-10-30 16:08:21 -0600308 "libpuresoftkeymasterdevice",
309 "liblog",
310 "libutils",
311 "libkeymaster4support",
312 ],
313
314 export_include_dirs: ["ng/include"],
315}
316
Steven Moreland7d6416c2017-04-18 10:06:28 -0700317// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
318cc_library_static {
319 name: "libkeymasterfiles",
320 export_include_dirs: [
321 ".",
322 "include",
323 ],
324}