blob: 40b6c4e79404b774a9693d3d3eb627b7bbfcd088 [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 Danisevskisdcd67c12017-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 Danisevskisdcd67c12017-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 Danisevskisdcd67c12017-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 Danisevskisdcd67c12017-04-26 14:44:46 -070050 name: "libkeymaster_portable",
Steven Moreland7d6416c2017-04-18 10:06:28 -070051 srcs: [
52 "aes_key.cpp",
53 "aes_operation.cpp",
54 "android_keymaster.cpp",
55 "android_keymaster_messages.cpp",
56 "android_keymaster_utils.cpp",
57 "asymmetric_key.cpp",
58 "asymmetric_key_factory.cpp",
59 "attestation_record.cpp",
60 "auth_encrypted_key_blob.cpp",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -070061 "authorization_set.cpp",
62 "ecdsa_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070063 "ec_key.cpp",
64 "ec_key_factory.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070065 "hmac_key.cpp",
66 "hmac_operation.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070067 "key.cpp",
68 "keymaster_enforcement.cpp",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -070069 "keymaster_tags.cpp",
70 "logger.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070071 "ocb.c",
72 "ocb_utils.cpp",
73 "openssl_err.cpp",
74 "openssl_utils.cpp",
75 "operation.cpp",
76 "operation_table.cpp",
77 "rsa_key.cpp",
78 "rsa_key_factory.cpp",
79 "rsa_operation.cpp",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -070080 "serializable.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070081 "symmetric_key.cpp",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -070082 "keymaster_stl.cpp",
Steven Moreland7d6416c2017-04-18 10:06:28 -070083 ],
84
85 shared_libs: [
86 "libcrypto",
87 "libkeymaster_messages",
88 ],
89 cflags: [
90 "-Wall",
91 "-Werror",
92 "-Wunused",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -070093 "-DBORINGSSL_NO_CXX",
94 ],
95 // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
96 // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
97 // weakly defines the subset of stl symbols required for this library to work
98 // and which are also available in the trusty context.
99 stl: "none",
100 clang: true,
101 clang_cflags: [
102 "-Wno-error=unused-const-variable",
103 "-Wno-error=unused-private-field",
104 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
105 // Currently, if enabled, these flags will cause an internal error in Clang.
106 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
107 ],
108
109 export_include_dirs: ["include"],
110
111}
112
113// libkeymaster adds to libkeymaster_portable code that is needed by the softkeymaster device
114// to implement keymaster. This is sort of a staging area for functionality that may move
115// to libkeymaster_portalbe eventually. Unlike libkeymaster_portable, this library can use c++ stl
116// headers, but modules should avoid it if they are to be moved to libkeymaster_portable.
117cc_library_shared {
118 name: "libkeymaster",
119 vendor_available: true,
120 srcs: [
121 "ecies_kem.cpp",
122 "hkdf.cpp",
123 "hmac.cpp",
124 "integrity_assured_key_blob.cpp",
125 "iso18033kdf.cpp",
126 "kdf.cpp",
127 "nist_curve_key_exchange.cpp",
128 ],
129
130 shared_libs: [
131 "libcrypto",
132 "libkeymaster_portable",
133 "libkeymaster_messages",
134 ],
135 cflags: [
136 "-Wall",
137 "-Werror",
138 "-Wunused",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700139 ],
140 clang: true,
141 clang_cflags: [
142 "-Wno-error=unused-const-variable",
143 "-Wno-error=unused-private-field",
144 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
145 // Currently, if enabled, these flags will cause an internal error in Clang.
146 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
147 ],
148
149 export_include_dirs: ["include"],
150
151}
152
153// libsoftkeymaster provides a software-based keymaster HAL implementation.
154// This is used by keystore as a fallback for when the hardware keymaster does
155// not support the request.
156cc_library_shared {
157 name: "libsoftkeymasterdevice",
Steven Morelandd998c152017-04-18 10:25:45 -0700158 vendor_available: true,
Steven Moreland7d6416c2017-04-18 10:06:28 -0700159 srcs: [
160 "ec_keymaster0_key.cpp",
161 "ec_keymaster1_key.cpp",
162 "ecdsa_keymaster1_operation.cpp",
163 "keymaster0_engine.cpp",
164 "keymaster1_engine.cpp",
165 "keymaster_configuration.cpp",
166 "rsa_keymaster0_key.cpp",
167 "rsa_keymaster1_key.cpp",
168 "rsa_keymaster1_operation.cpp",
169 "soft_keymaster_context.cpp",
170 "soft_keymaster_device.cpp",
171 "soft_keymaster_logger.cpp",
172 ],
173 include_dirs: ["system/security/keystore"],
174 cflags: [
175 "-Wall",
176 "-Werror",
177 "-Wunused",
178 ],
179 clang: true,
180 clang_cflags: [
181 "-Wno-error=unused-const-variable",
182 "-Wno-error=unused-private-field",
183 // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
184 // Currently, if enabled, these flags will cause an internal error in Clang.
185 "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
186 ],
187
188 shared_libs: [
189 "libkeymaster_messages",
Janis Danisevskisdcd67c12017-04-26 14:44:46 -0700190 "libkeymaster_portable",
191 "libkeymaster",
Steven Moreland7d6416c2017-04-18 10:06:28 -0700192 "liblog",
193 "libcrypto",
194 "libcutils",
195 ],
196
197 export_include_dirs: ["include"],
198}
199
200// libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
201cc_library_static {
202 name: "libkeymasterfiles",
203 export_include_dirs: [
204 ".",
205 "include",
206 ],
207}