xref: /aosp_15_r20/system/security/ondevice-signing/Android.bp (revision e1997b9af69e3155ead6e072d106a0077849ffba)
1// Copyright (C) 2020 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
15package {
16    // See: http://go/android-license-faq
17    // A large-scale-change added 'default_applicable_licenses' to import
18    // all of the 'license_kinds' from "system_security_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["system_security_license"],
22}
23
24// List of clang-tidy checks that are reported as errors.
25// Please keep this list ordered lexicographically.
26tidy_errors = [
27  "cert-err34-c",
28  "google-default-arguments",
29  "google-runtime-int",
30  "google-runtime-member-string-references",
31  "misc-move-const-arg",
32  "misc-move-forwarding-reference",
33  "misc-unused-parameters",
34  "misc-unused-using-decls",
35  "misc-use-after-move",
36  "modernize-pass-by-value",
37  "performance-faster-string-find",
38  "performance-for-range-copy",
39  "performance-implicit-conversion-in-loop",
40  "performance-inefficient-vector-operation",
41  "performance-move-const-arg",
42  "performance-move-constructor-init",
43  "performance-noexcept-move-constructor",
44  "performance-unnecessary-value-param",
45]
46
47cc_defaults {
48  cpp_std: "experimental",
49  name: "odsign_flags_defaults",
50  cflags: [
51    "-Wall",
52    "-Wextra",
53    "-Werror",
54    "-Wno-unused-parameter",
55
56    // Some extra flags.
57    "-fstrict-aliasing",
58    "-Wredundant-decls",
59    "-Wshadow",
60    "-Wstrict-aliasing",
61    "-Wthread-safety",
62    "-Wthread-safety-negative",
63    "-Wunreachable-code",
64    "-Wunreachable-code-break",
65    "-Wunreachable-code-return",
66    "-Wunused",
67    "-Wused-but-marked-unused",
68  ],
69  tidy: true,
70  tidy_checks: tidy_errors,
71  tidy_checks_as_errors: tidy_errors,
72  tidy_flags: [
73    "-format-style=file",
74  ],
75}
76
77cc_library {
78  name: "libsigningutils",
79  defaults: [
80    "odsign_flags_defaults",
81  ],
82  cpp_std: "experimental",
83  srcs: [
84    "CertUtils.cpp",
85    "VerityUtils.cpp",
86  ],
87
88  shared_libs: [
89    "libbase",
90    "libcrypto",
91    "libcrypto_utils",
92    "libfsverity",
93    "libprotobuf-cpp-lite",
94    "libutils",
95  ],
96  export_include_dirs: ["include"],
97  recovery_available: true,
98}
99
100genrule {
101  name: "statslog_odsign.h",
102  tools: ["stats-log-api-gen"],
103  cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_odsign.h --module art --namespace art,metrics,statsd",
104  out: [
105    "statslog_odsign.h",
106  ],
107}
108
109cc_binary {
110  name: "odsign",
111  defaults: [
112    "odsign_flags_defaults",
113  ],
114  cpp_std: "experimental",
115  init_rc: ["odsign.rc"],
116  srcs: [
117    "KeystoreKey.cpp",
118    "KeystoreHmacKey.cpp",
119    "odsign_main.cpp",
120    "StatsReporter.cpp",
121  ],
122  generated_headers: ["statslog_odsign.h"],
123
124  header_libs: ["odrefresh_headers"],
125
126  static_libs: [
127    "libsigningutils",
128    "lib_odsign_proto",
129  ],
130  shared_libs: [
131    "android.system.keystore2-V1-cpp",
132    "android.hardware.security.keymint-V1-cpp",
133    "libbase",
134    "libbinder",
135    "libcrypto",
136    "libcrypto_utils",
137    "libfsverity",
138    "liblogwrap",
139    "libprotobuf-cpp-lite",
140    "libstatspull",
141    "libstatssocket",
142    "libutils",
143  ],
144}
145