blob: 587dcedec02a535faba7842a37c16ebc334006fb [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,
Nick Bray335949a2018-03-20 11:02:53 -070041 clang_cflags: [
42 "-Wimplicit-fallthrough",
43 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
44 // Currently, if enabled, these flags will cause an internal error in Clang.
45 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
46 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -070047
48 export_include_dirs: ["include"],
Ivan Lozanoeb9d7532018-01-10 13:07:08 -080049 sanitize: {
50 integer_overflow: false,
51 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070052}
53
Janis Danisevskisf38a0022017-04-26 14:44:46 -070054// libkeymaster_portable contains almost everything needed for a keymaster
Steven Moreland7d6416c2017-04-18 10:06:28 -070055// implementation, lacking only a subclass of the (abstract) KeymasterContext
56// class to provide environment-specific services and a wrapper to translate from
57// the function-based keymaster HAL API to the message-based AndroidKeymaster API.
Shawn Willden25814f02018-04-02 10:55:34 -060058cc_library {
Janis Danisevskisf38a0022017-04-26 14:44:46 -070059 name: "libkeymaster_portable",
Janis Danisevskiscf3763f2017-05-03 00:22:06 +000060 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +090061 vndk: {
62 enabled: true,
63 },
Steven Moreland7d6416c2017-04-18 10:06:28 -070064 srcs: [
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070065 "android_keymaster/android_keymaster.cpp",
66 "android_keymaster/android_keymaster_messages.cpp",
67 "android_keymaster/android_keymaster_utils.cpp",
68 "android_keymaster/authorization_set.cpp",
69 "android_keymaster/keymaster_enforcement.cpp",
70 "android_keymaster/keymaster_stl.cpp",
71 "android_keymaster/keymaster_tags.cpp",
72 "android_keymaster/logger.cpp",
73 "android_keymaster/operation.cpp",
74 "android_keymaster/operation_table.cpp",
75 "android_keymaster/serializable.cpp",
76 "key_blob_utils/auth_encrypted_key_blob.cpp",
77 "key_blob_utils/integrity_assured_key_blob.cpp",
78 "key_blob_utils/ocb.c",
79 "key_blob_utils/ocb_utils.cpp",
80 "key_blob_utils/software_keyblobs.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070081 "km_openssl/aes_key.cpp",
82 "km_openssl/aes_operation.cpp",
83 "km_openssl/asymmetric_key.cpp",
84 "km_openssl/asymmetric_key_factory.cpp",
85 "km_openssl/attestation_record.cpp",
Shawn Willdena2f1a9b2018-01-09 09:37:43 -070086 "km_openssl/block_cipher_operation.cpp",
Shawn Willden8b940582018-01-02 10:53:39 -070087 "km_openssl/ckdf.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070088 "km_openssl/ec_key.cpp",
89 "km_openssl/ec_key_factory.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070090 "km_openssl/ecdsa_operation.cpp",
91 "km_openssl/ecies_kem.cpp",
92 "km_openssl/hkdf.cpp",
93 "km_openssl/hmac.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070094 "km_openssl/hmac_key.cpp",
95 "km_openssl/hmac_operation.cpp",
Shawn Willdenfb9b2a42017-12-21 12:35:06 -070096 "km_openssl/iso18033kdf.cpp",
97 "km_openssl/kdf.cpp",
98 "km_openssl/nist_curve_key_exchange.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070099 "km_openssl/openssl_err.cpp",
100 "km_openssl/openssl_utils.cpp",
101 "km_openssl/rsa_key.cpp",
102 "km_openssl/rsa_key_factory.cpp",
103 "km_openssl/rsa_operation.cpp",
Janis Danisevskis41d5a742017-05-12 10:43:12 -0700104 "km_openssl/software_random_source.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700105 "km_openssl/symmetric_key.cpp",
Shawn Willden7efc7722018-01-08 22:00:12 -0700106 "km_openssl/triple_des_key.cpp",
107 "km_openssl/triple_des_operation.cpp",
Shawn Willdendd7e8a02018-01-12 13:03:37 -0700108 "km_openssl/wrapped_key.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700109 ],
110
111 shared_libs: [
112 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700113 ],
Yifan Hong19f07e72017-06-07 15:54:19 -0700114 header_libs: ["libhardware_headers"],
115 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700116 cflags: [
117 "-Wall",
118 "-Werror",
119 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700120 "-DBORINGSSL_NO_CXX",
121 ],
122 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
123 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
124 // weakly defines the subset of stl symbols required for this library to work
125 // and which are also available in the trusty context.
126 stl: "none",
127 clang: true,
128 clang_cflags: [
129 "-Wno-error=unused-const-variable",
130 "-Wno-error=unused-private-field",
Nick Bray335949a2018-03-20 11:02:53 -0700131 "-Wimplicit-fallthrough",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700132 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
133 // Currently, if enabled, these flags will cause an internal error in Clang.
134 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
135 ],
136
137 export_include_dirs: ["include"],
Ivan Lozanoeb9d7532018-01-10 13:07:08 -0800138 sanitize: {
139 integer_overflow: false,
140 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700141}
142
143// libsoftkeymaster provides a software-based keymaster HAL implementation.
144// This is used by keystore as a fallback for when the hardware keymaster does
145// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700146cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700147 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700148 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900149 vndk: {
150 enabled: true,
151 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700152 srcs: [
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700153 "android_keymaster/keymaster_configuration.cpp",
154 "km_openssl/attestation_utils.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700155 "legacy_support/ec_keymaster0_key.cpp",
156 "legacy_support/ec_keymaster1_key.cpp",
157 "legacy_support/ecdsa_keymaster1_operation.cpp",
158 "legacy_support/keymaster0_engine.cpp",
159 "legacy_support/keymaster1_engine.cpp",
160 "legacy_support/rsa_keymaster0_key.cpp",
161 "legacy_support/rsa_keymaster1_key.cpp",
162 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700163 "legacy_support/keymaster1_legacy_support.cpp",
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700164 "contexts/soft_attestation_cert.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700165 "contexts/soft_keymaster_context.cpp",
Shawn Willdendd7e8a02018-01-12 13:03:37 -0700166 "contexts/pure_soft_keymaster_context.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700167 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700168 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700169 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700170 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700171 cflags: [
172 "-Wall",
173 "-Werror",
174 "-Wunused",
175 ],
176 clang: true,
177 clang_cflags: [
178 "-Wno-error=unused-const-variable",
179 "-Wno-error=unused-private-field",
180 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
181 // Currently, if enabled, these flags will cause an internal error in Clang.
182 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
183 ],
184
185 shared_libs: [
186 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700187 "libkeymaster_portable",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700188 "liblog",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700189 "libbase",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700190 "libcrypto",
191 "libcutils",
192 ],
193
194 export_include_dirs: ["include"],
195}
196
Shawn Willden25814f02018-04-02 10:55:34 -0600197cc_library {
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700198 name: "libpuresoftkeymasterdevice",
199 vendor_available: true,
200 vndk: {
201 enabled: true,
202 },
203 srcs: [
204 "km_openssl/attestation_utils.cpp",
205 "android_keymaster/keymaster_configuration.cpp",
206 "contexts/soft_attestation_cert.cpp",
207 "contexts/pure_soft_keymaster_context.cpp",
208 "contexts/soft_keymaster_logger.cpp",
209 "km_openssl/soft_keymaster_enforcement.cpp",
210 ],
211 cflags: [
212 "-Wall",
213 "-Werror",
214 "-Wunused",
215 ],
216 clang: true,
217 clang_cflags: [
218 "-Wno-error=unused-const-variable",
219 "-Wno-error=unused-private-field",
220 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
221 // Currently, if enabled, these flags will cause an internal error in Clang.
222 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
223 ],
224
225 shared_libs: [
226 "libkeymaster_messages",
227 "libkeymaster_portable",
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700228 "liblog",
229 "libcrypto",
230 "libcutils",
Wei Wangc33ecdf2018-06-27 11:53:26 -0700231 "libbase",
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700232 ],
233
234 export_include_dirs: ["include"],
235}
236
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000237cc_library_shared {
238 name: "libkeymaster3device",
Logan Chien65d5a832017-11-21 19:06:34 +0800239 vendor: true,
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000240 srcs: [
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700241 "legacy_support/keymaster_passthrough_key.cpp",
242 "legacy_support/keymaster_passthrough_engine.cpp",
243 "legacy_support/keymaster_passthrough_operation.cpp",
244 "contexts/keymaster1_passthrough_context.cpp",
245 "contexts/keymaster2_passthrough_context.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000246 "ng/AndroidKeymaster3Device.cpp",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700247 "android_keymaster/keymaster_configuration.cpp",
248 "km_openssl/attestation_utils.cpp",
249 "legacy_support/ec_keymaster0_key.cpp",
250 "legacy_support/ec_keymaster1_key.cpp",
251 "legacy_support/ecdsa_keymaster1_operation.cpp",
252 "legacy_support/keymaster0_engine.cpp",
253 "legacy_support/keymaster1_engine.cpp",
254 "legacy_support/keymaster1_legacy_support.cpp",
255 "legacy_support/rsa_keymaster0_key.cpp",
256 "legacy_support/rsa_keymaster1_key.cpp",
257 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000258 ],
259 cflags: [
260 "-Wall",
261 "-Werror",
262 "-Wunused",
263 ],
264 clang: true,
265 clang_cflags: [
266 "-Wno-error=unused-const-variable",
267 "-Wno-error=unused-private-field",
268 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
269 // Currently, if enabled, these flags will cause an internal error in Clang.
270 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
271 ],
272
273 shared_libs: [
274 "libkeymaster_messages",
275 "android.hardware.keymaster@3.0",
276 "libcrypto",
277 "libcutils",
Janis Danisevskis2fea2352017-07-26 16:52:33 -0700278 "libbase",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000279 "libhidlbase",
280 "libhidltransport",
281 "libkeymaster_portable",
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000282 "libpuresoftkeymasterdevice",
283 "liblog",
284 "libutils",
285 ],
286
287 export_include_dirs: ["include", "ng/include"],
288}
289
Shawn Willden9e149572017-10-30 16:08:21 -0600290cc_library_shared {
291 name: "libkeymaster4",
292 vendor_available: true,
293 srcs: [
294 "legacy_support/keymaster_passthrough_key.cpp",
295 "legacy_support/keymaster_passthrough_engine.cpp",
296 "legacy_support/keymaster_passthrough_operation.cpp",
Shawn Willdenefd06732017-11-30 19:34:16 -0700297 "ng/AndroidKeymaster4Device.cpp",
Shawn Willden9e149572017-10-30 16:08:21 -0600298 "android_keymaster/keymaster_configuration.cpp",
299 "km_openssl/attestation_utils.cpp",
300 ],
301 cflags: [
302 "-Wall",
303 "-Werror",
304 "-Wunused",
305 ],
306 clang: true,
307 clang_cflags: [
308 "-Wno-error=unused-const-variable",
309 "-Wno-error=unused-private-field",
310 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
311 // Currently, if enabled, these flags will cause an internal error in Clang.
312 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
313 ],
314
315 shared_libs: [
316 "libkeymaster_messages",
317 "android.hardware.keymaster@4.0",
318 "libcrypto",
319 "libcutils",
320 "libbase",
321 "libhidlbase",
322 "libhidltransport",
323 "libkeymaster_portable",
Shawn Willden9e149572017-10-30 16:08:21 -0600324 "libpuresoftkeymasterdevice",
325 "liblog",
326 "libutils",
327 "libkeymaster4support",
328 ],
329
330 export_include_dirs: ["ng/include"],
331}
332
Steven Moreland7d6416c2017-04-18 10:06:28 -0700333// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
334cc_library_static {
335 name: "libkeymasterfiles",
336 export_include_dirs: [
337 ".",
338 "include",
339 ],
340}