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