blob: eb3e52c2b20e64ecc88d866353bea05493cece1d [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: [
24 "android_keymaster_messages.cpp",
25 "android_keymaster_utils.cpp",
26 "authorization_set.cpp",
27 "keymaster_tags.cpp",
28 "logger.cpp",
29 "serializable.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070030 "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: [
60 "aes_key.cpp",
61 "aes_operation.cpp",
62 "android_keymaster.cpp",
63 "android_keymaster_messages.cpp",
64 "android_keymaster_utils.cpp",
65 "asymmetric_key.cpp",
66 "asymmetric_key_factory.cpp",
67 "attestation_record.cpp",
68 "auth_encrypted_key_blob.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070069 "authorization_set.cpp",
70 "ecdsa_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070071 "ec_key.cpp",
72 "ec_key_factory.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070073 "hmac_key.cpp",
74 "hmac_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070075 "keymaster_enforcement.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070076 "keymaster_tags.cpp",
77 "logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070078 "ocb.c",
79 "ocb_utils.cpp",
80 "openssl_err.cpp",
81 "openssl_utils.cpp",
82 "operation.cpp",
83 "operation_table.cpp",
84 "rsa_key.cpp",
85 "rsa_key_factory.cpp",
86 "rsa_operation.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070087 "serializable.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070088 "symmetric_key.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070089 "keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070090 ],
91
92 shared_libs: [
93 "libcrypto",
94 "libkeymaster_messages",
95 ],
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: [
133 "ecies_kem.cpp",
134 "hkdf.cpp",
135 "hmac.cpp",
136 "integrity_assured_key_blob.cpp",
137 "iso18033kdf.cpp",
138 "kdf.cpp",
139 "nist_curve_key_exchange.cpp",
140 ],
141
142 shared_libs: [
143 "libcrypto",
144 "libkeymaster_portable",
145 "libkeymaster_messages",
146 ],
147 cflags: [
148 "-Wall",
149 "-Werror",
150 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700151 ],
152 clang: true,
153 clang_cflags: [
154 "-Wno-error=unused-const-variable",
155 "-Wno-error=unused-private-field",
156 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
157 // Currently, if enabled, these flags will cause an internal error in Clang.
158 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
159 ],
160
161 export_include_dirs: ["include"],
162
163}
164
165// libsoftkeymaster provides a software-based keymaster HAL implementation.
166// This is used by keystore as a fallback for when the hardware keymaster does
167// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700168cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700169 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700170 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900171 vndk: {
172 enabled: true,
173 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700174 srcs: [
175 "ec_keymaster0_key.cpp",
176 "ec_keymaster1_key.cpp",
177 "ecdsa_keymaster1_operation.cpp",
178 "keymaster0_engine.cpp",
179 "keymaster1_engine.cpp",
180 "keymaster_configuration.cpp",
181 "rsa_keymaster0_key.cpp",
182 "rsa_keymaster1_key.cpp",
183 "rsa_keymaster1_operation.cpp",
184 "soft_keymaster_context.cpp",
185 "soft_keymaster_device.cpp",
186 "soft_keymaster_logger.cpp",
187 ],
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}