blob: 3f6838b84dc1307367690673cd884d204d2c9437 [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,
Steven Moreland7d6416c2017-04-18 10:06:28 -070020 srcs: [
21 "android_keymaster_messages.cpp",
22 "android_keymaster_utils.cpp",
23 "authorization_set.cpp",
24 "keymaster_tags.cpp",
25 "logger.cpp",
26 "serializable.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070027 "keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070028 ],
Yifan Hongf0b39bb2017-04-18 17:07:58 -070029 header_libs: ["libhardware_headers"],
Steven Moreland7d6416c2017-04-18 10:06:28 -070030 cflags: [
31 "-Wall",
32 "-Werror",
33 "-Wunused",
34 "-DKEYMASTER_NAME_TAGS",
35 ],
Janis Danisevskisf38a0022017-04-26 14:44:46 -070036 stl: "none",
Steven Moreland7d6416c2017-04-18 10:06:28 -070037 clang: true,
38 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
39 // Currently, if enabled, these flags will cause an internal error in Clang.
40 clang_cflags: ["-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"],
41
42 export_include_dirs: ["include"],
43
44}
45
Janis Danisevskisf38a0022017-04-26 14:44:46 -070046// libkeymaster_portable contains almost everything needed for a keymaster
Steven Moreland7d6416c2017-04-18 10:06:28 -070047// implementation, lacking only a subclass of the (abstract) KeymasterContext
48// class to provide environment-specific services and a wrapper to translate from
49// the function-based keymaster HAL API to the message-based AndroidKeymaster API.
50cc_library_shared {
Janis Danisevskisf38a0022017-04-26 14:44:46 -070051 name: "libkeymaster_portable",
Janis Danisevskiscf3763f2017-05-03 00:22:06 +000052 vendor_available: true,
Steven Moreland7d6416c2017-04-18 10:06:28 -070053 srcs: [
54 "aes_key.cpp",
55 "aes_operation.cpp",
56 "android_keymaster.cpp",
57 "android_keymaster_messages.cpp",
58 "android_keymaster_utils.cpp",
59 "asymmetric_key.cpp",
60 "asymmetric_key_factory.cpp",
61 "attestation_record.cpp",
62 "auth_encrypted_key_blob.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070063 "authorization_set.cpp",
64 "ecdsa_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070065 "ec_key.cpp",
66 "ec_key_factory.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070067 "hmac_key.cpp",
68 "hmac_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070069 "key.cpp",
70 "keymaster_enforcement.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070071 "keymaster_tags.cpp",
72 "logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070073 "ocb.c",
74 "ocb_utils.cpp",
75 "openssl_err.cpp",
76 "openssl_utils.cpp",
77 "operation.cpp",
78 "operation_table.cpp",
79 "rsa_key.cpp",
80 "rsa_key_factory.cpp",
81 "rsa_operation.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070082 "serializable.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070083 "symmetric_key.cpp",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070084 "keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070085 ],
86
87 shared_libs: [
88 "libcrypto",
89 "libkeymaster_messages",
90 ],
91 cflags: [
92 "-Wall",
93 "-Werror",
94 "-Wunused",
Janis Danisevskisf38a0022017-04-26 14:44:46 -070095 "-DBORINGSSL_NO_CXX",
96 ],
97 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
98 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
99 // weakly defines the subset of stl symbols required for this library to work
100 // and which are also available in the trusty context.
101 stl: "none",
102 clang: true,
103 clang_cflags: [
104 "-Wno-error=unused-const-variable",
105 "-Wno-error=unused-private-field",
106 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
107 // Currently, if enabled, these flags will cause an internal error in Clang.
108 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
109 ],
110
111 export_include_dirs: ["include"],
112
113}
114
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700115// libkeymaster_staging adds to libkeymaster_portable code that is needed by the softkeymaster device
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700116// to implement keymaster. This is sort of a staging area for functionality that may move
117// to libkeymaster_portalbe eventually. Unlike libkeymaster_portable, this library can use c++ stl
118// headers, but modules should avoid it if they are to be moved to libkeymaster_portable.
119cc_library_shared {
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700120 name: "libkeymaster_staging",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700121 vendor_available: true,
122 srcs: [
123 "ecies_kem.cpp",
124 "hkdf.cpp",
125 "hmac.cpp",
126 "integrity_assured_key_blob.cpp",
127 "iso18033kdf.cpp",
128 "kdf.cpp",
129 "nist_curve_key_exchange.cpp",
130 ],
131
132 shared_libs: [
133 "libcrypto",
134 "libkeymaster_portable",
135 "libkeymaster_messages",
136 ],
137 cflags: [
138 "-Wall",
139 "-Werror",
140 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700141 ],
142 clang: true,
143 clang_cflags: [
144 "-Wno-error=unused-const-variable",
145 "-Wno-error=unused-private-field",
146 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
147 // Currently, if enabled, these flags will cause an internal error in Clang.
148 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
149 ],
150
151 export_include_dirs: ["include"],
152
153}
154
155// libsoftkeymaster provides a software-based keymaster HAL implementation.
156// This is used by keystore as a fallback for when the hardware keymaster does
157// not support the request.
158cc_library_shared {
159 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700160 vendor_available: true,
Steven Moreland7d6416c2017-04-18 10:06:28 -0700161 srcs: [
162 "ec_keymaster0_key.cpp",
163 "ec_keymaster1_key.cpp",
164 "ecdsa_keymaster1_operation.cpp",
165 "keymaster0_engine.cpp",
166 "keymaster1_engine.cpp",
167 "keymaster_configuration.cpp",
168 "rsa_keymaster0_key.cpp",
169 "rsa_keymaster1_key.cpp",
170 "rsa_keymaster1_operation.cpp",
171 "soft_keymaster_context.cpp",
172 "soft_keymaster_device.cpp",
173 "soft_keymaster_logger.cpp",
174 ],
175 include_dirs: ["system/security/keystore"],
176 cflags: [
177 "-Wall",
178 "-Werror",
179 "-Wunused",
180 ],
181 clang: true,
182 clang_cflags: [
183 "-Wno-error=unused-const-variable",
184 "-Wno-error=unused-private-field",
185 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
186 // Currently, if enabled, these flags will cause an internal error in Clang.
187 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
188 ],
189
190 shared_libs: [
191 "libkeymaster_messages",
Janis Danisevskisf38a0022017-04-26 14:44:46 -0700192 "libkeymaster_portable",
Janis Danisevskis2bf1d592017-05-04 14:02:05 -0700193 "libkeymaster_staging",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700194 "liblog",
195 "libcrypto",
196 "libcutils",
197 ],
198
199 export_include_dirs: ["include"],
200}
201
202// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
203cc_library_static {
204 name: "libkeymasterfiles",
205 export_include_dirs: [
206 ".",
207 "include",
208 ],
209}