blob: 869a118cda44d208592dcfe0859f10a6e502e968 [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",
75 "km_openssl/symmetric_key.cpp",
76 "android_keymaster/android_keymaster.cpp",
77 "android_keymaster/android_keymaster_messages.cpp",
78 "android_keymaster/android_keymaster_utils.cpp",
79 "android_keymaster/authorization_set.cpp",
80 "android_keymaster/keymaster_enforcement.cpp",
81 "android_keymaster/keymaster_tags.cpp",
82 "android_keymaster/logger.cpp",
83 "android_keymaster/operation.cpp",
84 "android_keymaster/operation_table.cpp",
85 "android_keymaster/serializable.cpp",
86 "android_keymaster/keymaster_stl.cpp",
87 "key_blob_utils/auth_encrypted_key_blob.cpp",
88 "key_blob_utils/ocb.c",
89 "key_blob_utils/ocb_utils.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070090 ],
91
92 shared_libs: [
93 "libcrypto",
Steven Moreland7d6416c2017-04-18 10:06:28 -070094 ],
Yifan Hong19f07e72017-06-07 15:54:19 -070095 header_libs: ["libhardware_headers"],
96 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -070097 cflags: [
98 "-Wall",
99 "-Werror",
100 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700101 "-DBORINGSSL_NO_CXX",
102 ],
103 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
104 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
105 // weakly defines the subset of stl symbols required for this library to work
106 // and which are also available in the trusty context.
107 stl: "none",
108 clang: true,
109 clang_cflags: [
110 "-Wno-error=unused-const-variable",
111 "-Wno-error=unused-private-field",
112 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
113 // Currently, if enabled, these flags will cause an internal error in Clang.
114 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
115 ],
116
117 export_include_dirs: ["include"],
118
119}
120
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700121// libkeymaster_staging adds to libkeymaster_portable code that is needed by the softkeymaster device
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700122// to implement keymaster. This is sort of a staging area for functionality that may move
123// to libkeymaster_portalbe eventually. Unlike libkeymaster_portable, this library can use c++ stl
124// headers, but modules should avoid it if they are to be moved to libkeymaster_portable.
125cc_library_shared {
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700126 name: "libkeymaster_staging",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700127 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900128 vndk: {
129 enabled: true,
130 },
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700131 srcs: [
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700132 "km_openssl/ecies_kem.cpp",
133 "km_openssl/hkdf.cpp",
134 "km_openssl/hmac.cpp",
135 "km_openssl/iso18033kdf.cpp",
136 "km_openssl/kdf.cpp",
137 "km_openssl/nist_curve_key_exchange.cpp",
138 "key_blob_utils/integrity_assured_key_blob.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700139 ],
140
141 shared_libs: [
142 "libcrypto",
143 "libkeymaster_portable",
144 "libkeymaster_messages",
145 ],
146 cflags: [
147 "-Wall",
148 "-Werror",
149 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700150 ],
151 clang: true,
152 clang_cflags: [
153 "-Wno-error=unused-const-variable",
154 "-Wno-error=unused-private-field",
155 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
156 // Currently, if enabled, these flags will cause an internal error in Clang.
157 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
158 ],
159
160 export_include_dirs: ["include"],
161
162}
163
164// libsoftkeymaster provides a software-based keymaster HAL implementation.
165// This is used by keystore as a fallback for when the hardware keymaster does
166// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700167cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700168 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700169 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900170 vndk: {
171 enabled: true,
172 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700173 srcs: [
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700174 "legacy_support/ec_keymaster0_key.cpp",
175 "legacy_support/ec_keymaster1_key.cpp",
176 "legacy_support/ecdsa_keymaster1_operation.cpp",
177 "legacy_support/keymaster0_engine.cpp",
178 "legacy_support/keymaster1_engine.cpp",
179 "legacy_support/rsa_keymaster0_key.cpp",
180 "legacy_support/rsa_keymaster1_key.cpp",
181 "legacy_support/rsa_keymaster1_operation.cpp",
182 "android_keymaster/keymaster_configuration.cpp",
183 "contexts/soft_keymaster_context.cpp",
184 "contexts/soft_keymaster_device.cpp",
Janis Danisevskis1455d2e2017-05-11 10:56:27 -0700185 "km_openssl/soft_keymaster_enforcement.cpp",
Janis Danisevskisf54cc932017-05-10 15:29:10 -0700186 "contexts/soft_keymaster_logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700187 ],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700188 cflags: [
189 "-Wall",
190 "-Werror",
191 "-Wunused",
192 ],
193 clang: true,
194 clang_cflags: [
195 "-Wno-error=unused-const-variable",
196 "-Wno-error=unused-private-field",
197 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
198 // Currently, if enabled, these flags will cause an internal error in Clang.
199 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
200 ],
201
202 shared_libs: [
203 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700204 "libkeymaster_portable",
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700205 "libkeymaster_staging",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700206 "liblog",
207 "libcrypto",
208 "libcutils",
209 ],
210
211 export_include_dirs: ["include"],
212}
213
214// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
215cc_library_static {
216 name: "libkeymasterfiles",
217 export_include_dirs: [
218 ".",
219 "include",
220 ],
221}