blob: 8868ce3ef0964c7436da024092a411d5299944f4 [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",
Shawn Willdena2f1a9b2018-01-09 09:37:43 -070083 "km_openssl/block_cipher_operation.cpp",
Shawn Willden8b940582018-01-02 10:53:39 -070084 "km_openssl/ckdf.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070085 "km_openssl/ec_key.cpp",
86 "km_openssl/ec_key_factory.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070087 "km_openssl/ecdsa_operation.cpp",
88 "km_openssl/ecies_kem.cpp",
89 "km_openssl/hkdf.cpp",
90 "km_openssl/hmac.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070091 "km_openssl/hmac_key.cpp",
92 "km_openssl/hmac_operation.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070093 "km_openssl/iso18033kdf.cpp",
94 "km_openssl/kdf.cpp",
95 "km_openssl/nist_curve_key_exchange.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070096 "km_openssl/openssl_err.cpp",
97 "km_openssl/openssl_utils.cpp",
98 "km_openssl/rsa_key.cpp",
99 "km_openssl/rsa_key_factory.cpp",
100 "km_openssl/rsa_operation.cpp",
Janis Danisevskis41d5a742017-05-12 10:43:12 -0700101 "km_openssl/software_random_source.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700102 "km_openssl/symmetric_key.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700103 ],
104
105 shared_libs: [
106 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700107 ],
Yifan Hong19f07e72017-06-07 15:54:19 -0700108 header_libs: ["libhardware_headers"],
109 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700110 cflags: [
111 "-Wall",
112 "-Werror",
113 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700114 "-DBORINGSSL_NO_CXX",
115 ],
116 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
117 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
118 // weakly defines the subset of stl symbols required for this library to work
119 // and which are also available in the trusty context.
120 stl: "none",
121 clang: true,
122 clang_cflags: [
123 "-Wno-error=unused-const-variable",
124 "-Wno-error=unused-private-field",
125 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
126 // Currently, if enabled, these flags will cause an internal error in Clang.
127 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
128 ],
129
130 export_include_dirs: ["include"],
Ivan Lozanoeb9d7532018-01-10 13:07:08 -0800131 sanitize: {
132 integer_overflow: false,
133 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700134}
135
136// libsoftkeymaster provides a software-based keymaster HAL implementation.
137// This is used by keystore as a fallback for when the hardware keymaster does
138// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700139cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700140 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700141 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900142 vndk: {
143 enabled: true,
144 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700145 srcs: [
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700146 "android_keymaster/keymaster_configuration.cpp",
147 "km_openssl/attestation_utils.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700148 "legacy_support/ec_keymaster0_key.cpp",
149 "legacy_support/ec_keymaster1_key.cpp",
150 "legacy_support/ecdsa_keymaster1_operation.cpp",
151 "legacy_support/keymaster0_engine.cpp",
152 "legacy_support/keymaster1_engine.cpp",
153 "legacy_support/rsa_keymaster0_key.cpp",
154 "legacy_support/rsa_keymaster1_key.cpp",
155 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700156 "legacy_support/keymaster1_legacy_support.cpp",
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700157 "contexts/soft_attestation_cert.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700158 "contexts/soft_keymaster_context.cpp",
159 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700160 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700161 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700162 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700163 cflags: [
164 "-Wall",
165 "-Werror",
166 "-Wunused",
167 ],
168 clang: true,
169 clang_cflags: [
170 "-Wno-error=unused-const-variable",
171 "-Wno-error=unused-private-field",
172 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
173 // Currently, if enabled, these flags will cause an internal error in Clang.
174 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
175 ],
176
177 shared_libs: [
178 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700179 "libkeymaster_portable",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700180 "liblog",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700181 "libbase",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700182 "libcrypto",
183 "libcutils",
184 ],
185
186 export_include_dirs: ["include"],
187}
188
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700189cc_library_shared {
190 name: "libpuresoftkeymasterdevice",
191 vendor_available: true,
192 vndk: {
193 enabled: true,
194 },
195 srcs: [
196 "km_openssl/attestation_utils.cpp",
197 "android_keymaster/keymaster_configuration.cpp",
198 "contexts/soft_attestation_cert.cpp",
199 "contexts/pure_soft_keymaster_context.cpp",
200 "contexts/soft_keymaster_logger.cpp",
201 "km_openssl/soft_keymaster_enforcement.cpp",
202 ],
203 cflags: [
204 "-Wall",
205 "-Werror",
206 "-Wunused",
207 ],
208 clang: true,
209 clang_cflags: [
210 "-Wno-error=unused-const-variable",
211 "-Wno-error=unused-private-field",
212 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
213 // Currently, if enabled, these flags will cause an internal error in Clang.
214 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
215 ],
216
217 shared_libs: [
218 "libkeymaster_messages",
219 "libkeymaster_portable",
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700220 "liblog",
221 "libcrypto",
222 "libcutils",
223 ],
224
225 export_include_dirs: ["include"],
226}
227
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000228cc_library_shared {
229 name: "libkeymaster3device",
Logan Chien65d5a832017-11-21 19:06:34 +0800230 vendor: true,
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000231 srcs: [
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700232 "legacy_support/keymaster_passthrough_key.cpp",
233 "legacy_support/keymaster_passthrough_engine.cpp",
234 "legacy_support/keymaster_passthrough_operation.cpp",
235 "contexts/keymaster1_passthrough_context.cpp",
236 "contexts/keymaster2_passthrough_context.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000237 "ng/AndroidKeymaster3Device.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700238 "android_keymaster/keymaster_configuration.cpp",
239 "km_openssl/attestation_utils.cpp",
240 "legacy_support/ec_keymaster0_key.cpp",
241 "legacy_support/ec_keymaster1_key.cpp",
242 "legacy_support/ecdsa_keymaster1_operation.cpp",
243 "legacy_support/keymaster0_engine.cpp",
244 "legacy_support/keymaster1_engine.cpp",
245 "legacy_support/keymaster1_legacy_support.cpp",
246 "legacy_support/rsa_keymaster0_key.cpp",
247 "legacy_support/rsa_keymaster1_key.cpp",
248 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000249 ],
250 cflags: [
251 "-Wall",
252 "-Werror",
253 "-Wunused",
254 ],
255 clang: true,
256 clang_cflags: [
257 "-Wno-error=unused-const-variable",
258 "-Wno-error=unused-private-field",
259 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
260 // Currently, if enabled, these flags will cause an internal error in Clang.
261 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
262 ],
263
264 shared_libs: [
265 "libkeymaster_messages",
266 "android.hardware.keymaster@3.0",
267 "libcrypto",
268 "libcutils",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700269 "libbase",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000270 "libhidlbase",
271 "libhidltransport",
272 "libkeymaster_portable",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000273 "libpuresoftkeymasterdevice",
274 "liblog",
275 "libutils",
276 ],
277
278 export_include_dirs: ["include", "ng/include"],
279}
280
Shawn Willden9e149572017-10-30 16:08:21 -0600281cc_library_shared {
282 name: "libkeymaster4",
283 vendor_available: true,
284 srcs: [
285 "legacy_support/keymaster_passthrough_key.cpp",
286 "legacy_support/keymaster_passthrough_engine.cpp",
287 "legacy_support/keymaster_passthrough_operation.cpp",
Shawn Willdenefd06732017-11-30 19:34:16 -0700288 "ng/AndroidKeymaster4Device.cpp",
Shawn Willden9e149572017-10-30 16:08:21 -0600289 "android_keymaster/keymaster_configuration.cpp",
290 "km_openssl/attestation_utils.cpp",
291 ],
292 cflags: [
293 "-Wall",
294 "-Werror",
295 "-Wunused",
296 ],
297 clang: true,
298 clang_cflags: [
299 "-Wno-error=unused-const-variable",
300 "-Wno-error=unused-private-field",
301 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
302 // Currently, if enabled, these flags will cause an internal error in Clang.
303 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
304 ],
305
306 shared_libs: [
307 "libkeymaster_messages",
308 "android.hardware.keymaster@4.0",
309 "libcrypto",
310 "libcutils",
311 "libbase",
312 "libhidlbase",
313 "libhidltransport",
314 "libkeymaster_portable",
Shawn Willden9e149572017-10-30 16:08:21 -0600315 "libpuresoftkeymasterdevice",
316 "liblog",
317 "libutils",
318 "libkeymaster4support",
319 ],
320
321 export_include_dirs: ["ng/include"],
322}
323
Steven Moreland7d6416c2017-04-18 10:06:28 -0700324// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
325cc_library_static {
326 name: "libkeymasterfiles",
327 export_include_dirs: [
328 ".",
329 "include",
330 ],
331}