Android.bp 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. // 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. // libkeymaster_messages contains just the code necessary to communicate with a
  15. // AndroidKeymaster implementation, e.g. one running in TrustZone.
  16. cc_library_shared {
  17. name: "libkeymaster_messages",
  18. vendor_available: true,
  19. vndk: {
  20. enabled: true,
  21. },
  22. srcs: [
  23. "android_keymaster/android_keymaster_messages.cpp",
  24. "android_keymaster/android_keymaster_utils.cpp",
  25. "android_keymaster/authorization_set.cpp",
  26. "android_keymaster/keymaster_tags.cpp",
  27. "android_keymaster/logger.cpp",
  28. "android_keymaster/serializable.cpp",
  29. "android_keymaster/keymaster_stl.cpp",
  30. ],
  31. header_libs: ["libhardware_headers"],
  32. cflags: [
  33. "-Wall",
  34. "-Werror",
  35. "-Wunused",
  36. "-DKEYMASTER_NAME_TAGS",
  37. ],
  38. stl: "none",
  39. clang: true,
  40. clang_cflags: [
  41. "-Wimplicit-fallthrough",
  42. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  43. // Currently, if enabled, these flags will cause an internal error in Clang.
  44. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  45. ],
  46. export_include_dirs: ["include"],
  47. sanitize: {
  48. integer_overflow: false,
  49. },
  50. }
  51. // libkeymaster_portable contains almost everything needed for a keymaster
  52. // 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.
  55. cc_library {
  56. name: "libkeymaster_portable",
  57. vendor_available: true,
  58. vndk: {
  59. enabled: true,
  60. },
  61. srcs: [
  62. "android_keymaster/android_keymaster.cpp",
  63. "android_keymaster/android_keymaster_messages.cpp",
  64. "android_keymaster/android_keymaster_utils.cpp",
  65. "android_keymaster/authorization_set.cpp",
  66. "android_keymaster/keymaster_enforcement.cpp",
  67. "android_keymaster/keymaster_stl.cpp",
  68. "android_keymaster/keymaster_tags.cpp",
  69. "android_keymaster/logger.cpp",
  70. "android_keymaster/operation.cpp",
  71. "android_keymaster/operation_table.cpp",
  72. "android_keymaster/serializable.cpp",
  73. "key_blob_utils/auth_encrypted_key_blob.cpp",
  74. "key_blob_utils/integrity_assured_key_blob.cpp",
  75. "key_blob_utils/ocb.c",
  76. "key_blob_utils/ocb_utils.cpp",
  77. "key_blob_utils/software_keyblobs.cpp",
  78. "km_openssl/aes_key.cpp",
  79. "km_openssl/aes_operation.cpp",
  80. "km_openssl/asymmetric_key.cpp",
  81. "km_openssl/asymmetric_key_factory.cpp",
  82. "km_openssl/attestation_record.cpp",
  83. "km_openssl/attestation_utils.cpp",
  84. "km_openssl/block_cipher_operation.cpp",
  85. "km_openssl/ckdf.cpp",
  86. "km_openssl/ec_key.cpp",
  87. "km_openssl/ec_key_factory.cpp",
  88. "km_openssl/ecdsa_operation.cpp",
  89. "km_openssl/ecies_kem.cpp",
  90. "km_openssl/hkdf.cpp",
  91. "km_openssl/hmac.cpp",
  92. "km_openssl/hmac_key.cpp",
  93. "km_openssl/hmac_operation.cpp",
  94. "km_openssl/iso18033kdf.cpp",
  95. "km_openssl/kdf.cpp",
  96. "km_openssl/nist_curve_key_exchange.cpp",
  97. "km_openssl/openssl_err.cpp",
  98. "km_openssl/openssl_utils.cpp",
  99. "km_openssl/rsa_key.cpp",
  100. "km_openssl/rsa_key_factory.cpp",
  101. "km_openssl/rsa_operation.cpp",
  102. "km_openssl/software_random_source.cpp",
  103. "km_openssl/symmetric_key.cpp",
  104. "km_openssl/triple_des_key.cpp",
  105. "km_openssl/triple_des_operation.cpp",
  106. "km_openssl/wrapped_key.cpp",
  107. ],
  108. shared_libs: [
  109. "libcrypto",
  110. ],
  111. header_libs: ["libhardware_headers"],
  112. export_header_lib_headers: ["libhardware_headers"],
  113. cflags: [
  114. "-Wall",
  115. "-Werror",
  116. "-Wunused",
  117. "-DBORINGSSL_NO_CXX",
  118. ],
  119. // NOTE: libkeymaster_portable must run unchanged in the trusty runtime environment.
  120. // Therefore, it must not link against any c++ stl library. keymaster_stl.cpp
  121. // weakly defines the subset of stl symbols required for this library to work
  122. // and which are also available in the trusty context.
  123. stl: "none",
  124. clang: true,
  125. clang_cflags: [
  126. "-Wno-error=unused-const-variable",
  127. "-Wno-error=unused-private-field",
  128. "-Wimplicit-fallthrough",
  129. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  130. // Currently, if enabled, these flags will cause an internal error in Clang.
  131. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  132. ],
  133. export_include_dirs: ["include"],
  134. sanitize: {
  135. integer_overflow: false,
  136. },
  137. }
  138. // libsoftkeymaster provides a software-based keymaster HAL implementation.
  139. // This is used by keystore as a fallback for when the hardware keymaster does
  140. // not support the request.
  141. cc_library {
  142. name: "libsoftkeymasterdevice",
  143. vendor_available: true,
  144. vndk: {
  145. enabled: true,
  146. },
  147. srcs: [
  148. "android_keymaster/keymaster_configuration.cpp",
  149. "legacy_support/ec_keymaster0_key.cpp",
  150. "legacy_support/ec_keymaster1_key.cpp",
  151. "legacy_support/ecdsa_keymaster1_operation.cpp",
  152. "legacy_support/keymaster0_engine.cpp",
  153. "legacy_support/keymaster1_engine.cpp",
  154. "legacy_support/rsa_keymaster0_key.cpp",
  155. "legacy_support/rsa_keymaster1_key.cpp",
  156. "legacy_support/rsa_keymaster1_operation.cpp",
  157. "legacy_support/keymaster1_legacy_support.cpp",
  158. "contexts/soft_attestation_cert.cpp",
  159. "contexts/soft_keymaster_context.cpp",
  160. "contexts/pure_soft_keymaster_context.cpp",
  161. "contexts/soft_keymaster_device.cpp",
  162. "km_openssl/soft_keymaster_enforcement.cpp",
  163. "contexts/soft_keymaster_logger.cpp",
  164. ],
  165. cflags: [
  166. "-Wall",
  167. "-Werror",
  168. "-Wunused",
  169. ],
  170. clang: true,
  171. clang_cflags: [
  172. "-Wno-error=unused-const-variable",
  173. "-Wno-error=unused-private-field",
  174. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  175. // Currently, if enabled, these flags will cause an internal error in Clang.
  176. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  177. ],
  178. shared_libs: [
  179. "libkeymaster_messages",
  180. "libkeymaster_portable",
  181. "liblog",
  182. "libbase",
  183. "libcrypto",
  184. "libcutils",
  185. ],
  186. export_include_dirs: ["include"],
  187. }
  188. cc_library {
  189. name: "libpuresoftkeymasterdevice",
  190. vendor_available: true,
  191. vndk: {
  192. enabled: true,
  193. },
  194. srcs: [
  195. "android_keymaster/keymaster_configuration.cpp",
  196. "contexts/soft_attestation_cert.cpp",
  197. "contexts/pure_soft_keymaster_context.cpp",
  198. "contexts/soft_keymaster_logger.cpp",
  199. "km_openssl/soft_keymaster_enforcement.cpp",
  200. ],
  201. cflags: [
  202. "-Wall",
  203. "-Werror",
  204. "-Wunused",
  205. ],
  206. clang: true,
  207. clang_cflags: [
  208. "-Wno-error=unused-const-variable",
  209. "-Wno-error=unused-private-field",
  210. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  211. // Currently, if enabled, these flags will cause an internal error in Clang.
  212. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  213. ],
  214. shared_libs: [
  215. "libkeymaster_messages",
  216. "libkeymaster_portable",
  217. "liblog",
  218. "libcrypto",
  219. "libcutils",
  220. "libbase",
  221. ],
  222. export_include_dirs: ["include"],
  223. }
  224. cc_library_shared {
  225. name: "libkeymaster3device",
  226. vendor: true,
  227. srcs: [
  228. "legacy_support/keymaster_passthrough_key.cpp",
  229. "legacy_support/keymaster_passthrough_engine.cpp",
  230. "legacy_support/keymaster_passthrough_operation.cpp",
  231. "contexts/keymaster1_passthrough_context.cpp",
  232. "contexts/keymaster2_passthrough_context.cpp",
  233. "ng/AndroidKeymaster3Device.cpp",
  234. "android_keymaster/keymaster_configuration.cpp",
  235. "legacy_support/ec_keymaster0_key.cpp",
  236. "legacy_support/ec_keymaster1_key.cpp",
  237. "legacy_support/ecdsa_keymaster1_operation.cpp",
  238. "legacy_support/keymaster0_engine.cpp",
  239. "legacy_support/keymaster1_engine.cpp",
  240. "legacy_support/keymaster1_legacy_support.cpp",
  241. "legacy_support/rsa_keymaster0_key.cpp",
  242. "legacy_support/rsa_keymaster1_key.cpp",
  243. "legacy_support/rsa_keymaster1_operation.cpp",
  244. ],
  245. cflags: [
  246. "-Wall",
  247. "-Werror",
  248. "-Wunused",
  249. ],
  250. clang: true,
  251. clang_cflags: [
  252. "-Wno-error=unused-const-variable",
  253. "-Wno-error=unused-private-field",
  254. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  255. // Currently, if enabled, these flags will cause an internal error in Clang.
  256. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  257. ],
  258. shared_libs: [
  259. "libkeymaster_messages",
  260. "[email protected]",
  261. "libcrypto",
  262. "libcutils",
  263. "libbase",
  264. "libhidlbase",
  265. "libhidltransport",
  266. "libkeymaster_portable",
  267. "libpuresoftkeymasterdevice",
  268. "liblog",
  269. "libutils",
  270. ],
  271. export_include_dirs: ["include", "ng/include"],
  272. }
  273. cc_library_shared {
  274. name: "libkeymaster4",
  275. vendor_available: true,
  276. srcs: [
  277. "legacy_support/keymaster_passthrough_key.cpp",
  278. "legacy_support/keymaster_passthrough_engine.cpp",
  279. "legacy_support/keymaster_passthrough_operation.cpp",
  280. "ng/AndroidKeymaster4Device.cpp",
  281. "android_keymaster/keymaster_configuration.cpp",
  282. ],
  283. cflags: [
  284. "-Wall",
  285. "-Werror",
  286. "-Wunused",
  287. ],
  288. clang: true,
  289. clang_cflags: [
  290. "-Wno-error=unused-const-variable",
  291. "-Wno-error=unused-private-field",
  292. // TODO(krasin): reenable coverage flags, when the new Clang toolchain is released.
  293. // Currently, if enabled, these flags will cause an internal error in Clang.
  294. "-fno-sanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp"
  295. ],
  296. shared_libs: [
  297. "libkeymaster_messages",
  298. "[email protected]",
  299. "libcrypto",
  300. "libcutils",
  301. "libbase",
  302. "libhidlbase",
  303. "libhidltransport",
  304. "libkeymaster_portable",
  305. "libpuresoftkeymasterdevice",
  306. "liblog",
  307. "libutils",
  308. "libkeymaster4support",
  309. ],
  310. export_include_dirs: ["ng/include"],
  311. }
  312. // libkeymasterfiles is an empty library that exports all of the files in keymaster as includes.
  313. cc_library_static {
  314. name: "libkeymasterfiles",
  315. export_include_dirs: [
  316. ".",
  317. "include",
  318. ],
  319. }