blob: 600a4a80693eb4dfe4bcfd30474873ac316c9815 [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"],
Ivan Lozanodbca6582018-01-12 13:11:12 -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: [
62 "aes_key.cpp",
63 "aes_operation.cpp",
64 "android_keymaster.cpp",
65 "android_keymaster_messages.cpp",
66 "android_keymaster_utils.cpp",
67 "asymmetric_key.cpp",
68 "asymmetric_key_factory.cpp",
69 "attestation_record.cpp",
70 "auth_encrypted_key_blob.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070071 "authorization_set.cpp",
72 "ecdsa_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070073 "ec_key.cpp",
74 "ec_key_factory.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070075 "hmac_key.cpp",
76 "hmac_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070077 "key.cpp",
78 "keymaster_enforcement.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070079 "keymaster_tags.cpp",
80 "logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070081 "ocb.c",
82 "ocb_utils.cpp",
83 "openssl_err.cpp",
84 "openssl_utils.cpp",
85 "operation.cpp",
86 "operation_table.cpp",
87 "rsa_key.cpp",
88 "rsa_key_factory.cpp",
89 "rsa_operation.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070090 "serializable.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070091 "symmetric_key.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070092 "keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070093 ],
94
95 shared_libs: [
96 "libcrypto",
97 "libkeymaster_messages",
98 ],
Yifan Hong19f07e72017-06-07 15:54:19 -070099 header_libs: ["libhardware_headers"],
100 export_header_lib_headers: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -0700101 cflags: [
102 "-Wall",
103 "-Werror",
104 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700105 "-DBORINGSSL_NO_CXX",
106 ],
107 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
108 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
109 // weakly defines the subset of stl symbols required for this library to work
110 // and which are also available in the trusty context.
111 stl: "none",
112 clang: true,
113 clang_cflags: [
114 "-Wno-error=unused-const-variable",
115 "-Wno-error=unused-private-field",
116 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
117 // Currently, if enabled, these flags will cause an internal error in Clang.
118 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
119 ],
120
121 export_include_dirs: ["include"],
122
Ivan Lozanodbca6582018-01-12 13:11:12 -0800123 sanitize: {
124 integer_overflow: false,
125 },
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700126}
127
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700128// libkeymaster_staging adds to libkeymaster_portable code that is needed by the softkeymaster device
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700129// to implement keymaster. This is sort of a staging area for functionality that may move
130// to libkeymaster_portalbe eventually. Unlike libkeymaster_portable, this library can use c++ stl
131// headers, but modules should avoid it if they are to be moved to libkeymaster_portable.
132cc_library_shared {
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700133 name: "libkeymaster_staging",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700134 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900135 vndk: {
136 enabled: true,
137 },
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700138 srcs: [
139 "ecies_kem.cpp",
140 "hkdf.cpp",
141 "hmac.cpp",
142 "integrity_assured_key_blob.cpp",
143 "iso18033kdf.cpp",
144 "kdf.cpp",
145 "nist_curve_key_exchange.cpp",
146 ],
147
148 shared_libs: [
149 "libcrypto",
150 "libkeymaster_portable",
151 "libkeymaster_messages",
152 ],
153 cflags: [
154 "-Wall",
155 "-Werror",
156 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700157 ],
158 clang: true,
159 clang_cflags: [
160 "-Wno-error=unused-const-variable",
161 "-Wno-error=unused-private-field",
162 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
163 // Currently, if enabled, these flags will cause an internal error in Clang.
164 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
165 ],
166
167 export_include_dirs: ["include"],
168
169}
170
171// libsoftkeymaster provides a software-based keymaster HAL implementation.
172// This is used by keystore as a fallback for when the hardware keymaster does
173// not support the request.
Tri Vo0b674d02017-08-04 13:00:33 -0700174cc_library {
Steven Moreland7d6416c2017-04-18 10:06:28 -0700175 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700176 vendor_available: true,
Justin Yun00a498f2017-07-24 15:19:45 +0900177 vndk: {
178 enabled: true,
179 },
Steven Moreland7d6416c2017-04-18 10:06:28 -0700180 srcs: [
181 "ec_keymaster0_key.cpp",
182 "ec_keymaster1_key.cpp",
183 "ecdsa_keymaster1_operation.cpp",
184 "keymaster0_engine.cpp",
185 "keymaster1_engine.cpp",
186 "keymaster_configuration.cpp",
187 "rsa_keymaster0_key.cpp",
188 "rsa_keymaster1_key.cpp",
189 "rsa_keymaster1_operation.cpp",
190 "soft_keymaster_context.cpp",
191 "soft_keymaster_device.cpp",
192 "soft_keymaster_logger.cpp",
193 ],
194 include_dirs: ["system/security/keystore"],
195 cflags: [
196 "-Wall",
197 "-Werror",
198 "-Wunused",
199 ],
200 clang: true,
201 clang_cflags: [
202 "-Wno-error=unused-const-variable",
203 "-Wno-error=unused-private-field",
204 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
205 // Currently, if enabled, these flags will cause an internal error in Clang.
206 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
207 ],
208
209 shared_libs: [
210 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700211 "libkeymaster_portable",
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700212 "libkeymaster_staging",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700213 "liblog",
214 "libcrypto",
215 "libcutils",
216 ],
217
218 export_include_dirs: ["include"],
219}
220
221// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
222cc_library_static {
223 name: "libkeymasterfiles",
224 export_include_dirs: [
225 ".",
226 "include",
227 ],
228}