blob: 3b063115052ad6ecdea37191e9c752777c6e2356 [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: [
Janis Danisevskisf54cc932017-05-10 15:29:10 -070060 "km_openssl/aes_key.cpp",
61 "km_openssl/aes_operation.cpp",
62 "km_openssl/asymmetric_key.cpp",
63 "km_openssl/asymmetric_key_factory.cpp",
64 "km_openssl/attestation_record.cpp",
65 "km_openssl/ecdsa_operation.cpp",
66 "km_openssl/ec_key.cpp",
67 "km_openssl/ec_key_factory.cpp",
68 "km_openssl/hmac_key.cpp",
69 "km_openssl/hmac_operation.cpp",
70 "km_openssl/openssl_err.cpp",
71 "km_openssl/openssl_utils.cpp",
72 "km_openssl/rsa_key.cpp",
73 "km_openssl/rsa_key_factory.cpp",
74 "km_openssl/rsa_operation.cpp",
Janis Danisevskis41d5a742017-05-12 10:43:12 -070075 "km_openssl/software_random_source.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -070076 "km_openssl/symmetric_key.cpp",
77 "android_keymaster/android_keymaster.cpp",
78 "android_keymaster/android_keymaster_messages.cpp",
79 "android_keymaster/android_keymaster_utils.cpp",
80 "android_keymaster/authorization_set.cpp",
81 "android_keymaster/keymaster_enforcement.cpp",
82 "android_keymaster/keymaster_tags.cpp",
83 "android_keymaster/logger.cpp",
84 "android_keymaster/operation.cpp",
85 "android_keymaster/operation_table.cpp",
86 "android_keymaster/serializable.cpp",
87 "android_keymaster/keymaster_stl.cpp",
88 "key_blob_utils/auth_encrypted_key_blob.cpp",
89 "key_blob_utils/ocb.c",
90 "key_blob_utils/ocb_utils.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070091 ],
92
93 shared_libs: [
94 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -070095 ],
Yifan Hong19f07e72017-06-07 15:54:19 -070096 header_libs: ["libhardware_headers"],
97 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -070098 cflags: [
99 "-Wall",
100 "-Werror",
101 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700102 "-DBORINGSSL_NO_CXX",
103 ],
104 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
105 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
106 // weakly defines the subset of stl symbols required for this library to work
107 // and which are also available in the trusty context.
108 stl: "none",
109 clang: true,
110 clang_cflags: [
111 "-Wno-error=unused-const-variable",
112 "-Wno-error=unused-private-field",
113 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
114 // Currently, if enabled, these flags will cause an internal error in Clang.
115 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
116 ],
117
118 export_include_dirs: ["include"],
119
120}
121
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700122// libkeymaster_staging adds to libkeymaster_portable code that is needed by the softkeymaster device
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700123// to implement keymaster. This is sort of a staging area for functionality that may move
124// to libkeymaster_portalbe eventually. Unlike libkeymaster_portable, this library can use c++ stl
125// headers, but modules should avoid it if they are to be moved to libkeymaster_portable.
126cc_library_shared {
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700127 name: "libkeymaster_staging",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700128 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900129 vndk: {
130 enabled: true,
131 },
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700132 srcs: [
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700133 "km_openssl/ecies_kem.cpp",
134 "km_openssl/hkdf.cpp",
135 "km_openssl/hmac.cpp",
136 "km_openssl/iso18033kdf.cpp",
137 "km_openssl/kdf.cpp",
138 "km_openssl/nist_curve_key_exchange.cpp",
139 "key_blob_utils/integrity_assured_key_blob.cpp",
Janis Danisevskisfe671b62017-05-31 13:25:54 -0700140 "key_blob_utils/software_keyblobs.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700141 ],
142
143 shared_libs: [
144 "libcrypto",
145 "libkeymaster_portable",
146 "libkeymaster_messages",
147 ],
148 cflags: [
149 "-Wall",
150 "-Werror",
151 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700152 ],
153 clang: true,
154 clang_cflags: [
155 "-Wno-error=unused-const-variable",
156 "-Wno-error=unused-private-field",
157 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
158 // Currently, if enabled, these flags will cause an internal error in Clang.
159 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
160 ],
161
162 export_include_dirs: ["include"],
163
164}
165
166// libsoftkeymaster provides a software-based keymaster HAL implementation.
167// This is used by keystore as a fallback for when the hardware keymaster does
168// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700169cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700170 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700171 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900172 vndk: {
173 enabled: true,
174 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700175 srcs: [
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700176 "android_keymaster/keymaster_configuration.cpp",
177 "km_openssl/attestation_utils.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700178 "legacy_support/ec_keymaster0_key.cpp",
179 "legacy_support/ec_keymaster1_key.cpp",
180 "legacy_support/ecdsa_keymaster1_operation.cpp",
181 "legacy_support/keymaster0_engine.cpp",
182 "legacy_support/keymaster1_engine.cpp",
183 "legacy_support/rsa_keymaster0_key.cpp",
184 "legacy_support/rsa_keymaster1_key.cpp",
185 "legacy_support/rsa_keymaster1_operation.cpp",
Janis Danisevskis3bfda162017-05-12 13:10:41 -0700186 "contexts/soft_attestation_cert.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700187 "contexts/soft_keymaster_context.cpp",
188 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700189 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700190 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700191 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700192 cflags: [
193 "-Wall",
194 "-Werror",
195 "-Wunused",
196 ],
197 clang: true,
198 clang_cflags: [
199 "-Wno-error=unused-const-variable",
200 "-Wno-error=unused-private-field",
201 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
202 // Currently, if enabled, these flags will cause an internal error in Clang.
203 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
204 ],
205
206 shared_libs: [
207 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700208 "libkeymaster_portable",
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700209 "libkeymaster_staging",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700210 "liblog",
211 "libcrypto",
212 "libcutils",
213 ],
214
215 export_include_dirs: ["include"],
216}
217
Janis Danisevskis1f8b1c92017-05-08 11:24:41 -0700218cc_library_shared {
219 name: "libpuresoftkeymasterdevice",
220 vendor_available: true,
221 vndk: {
222 enabled: true,
223 },
224 srcs: [
225 "km_openssl/attestation_utils.cpp",
226 "android_keymaster/keymaster_configuration.cpp",
227 "contexts/soft_attestation_cert.cpp",
228 "contexts/pure_soft_keymaster_context.cpp",
229 "contexts/soft_keymaster_logger.cpp",
230 "km_openssl/soft_keymaster_enforcement.cpp",
231 ],
232 cflags: [
233 "-Wall",
234 "-Werror",
235 "-Wunused",
236 ],
237 clang: true,
238 clang_cflags: [
239 "-Wno-error=unused-const-variable",
240 "-Wno-error=unused-private-field",
241 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
242 // Currently, if enabled, these flags will cause an internal error in Clang.
243 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
244 ],
245
246 shared_libs: [
247 "libkeymaster_messages",
248 "libkeymaster_portable",
249 "libkeymaster_staging",
250 "liblog",
251 "libcrypto",
252 "libcutils",
253 ],
254
255 export_include_dirs: ["include"],
256}
257
Janis Danisevskisa68669b2017-02-06 11:46:54 +0000258cc_library_shared {
259 name: "libkeymaster3device",
260 srcs: [
261 "ng/AndroidKeymaster3Device.cpp",
262 ],
263 cflags: [
264 "-Wall",
265 "-Werror",
266 "-Wunused",
267 ],
268 clang: true,
269 clang_cflags: [
270 "-Wno-error=unused-const-variable",
271 "-Wno-error=unused-private-field",
272 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
273 // Currently, if enabled, these flags will cause an internal error in Clang.
274 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
275 ],
276
277 shared_libs: [
278 "libkeymaster_messages",
279 "android.hardware.keymaster@3.0",
280 "libcrypto",
281 "libcutils",
282 "libhidlbase",
283 "libhidltransport",
284 "libkeymaster_portable",
285 "libkeymaster_staging",
286 "libpuresoftkeymasterdevice",
287 "liblog",
288 "libutils",
289 ],
290
291 export_include_dirs: ["include", "ng/include"],
292}
293
Steven Moreland7d6416c2017-04-18 10:06:28 -0700294// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
295cc_library_static {
296 name: "libkeymasterfiles",
297 export_include_dirs: [
298 ".",
299 "include",
300 ],
301}