xref: /aosp_15_r20/system/security/ondevice-signing/Android.bp (revision e1997b9af69e3155ead6e072d106a0077849ffba)
1*e1997b9aSAndroid Build Coastguard Worker// Copyright (C) 2020 The Android Open Source Project
2*e1997b9aSAndroid Build Coastguard Worker//
3*e1997b9aSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*e1997b9aSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*e1997b9aSAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*e1997b9aSAndroid Build Coastguard Worker//
7*e1997b9aSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*e1997b9aSAndroid Build Coastguard Worker//
9*e1997b9aSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*e1997b9aSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*e1997b9aSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*e1997b9aSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*e1997b9aSAndroid Build Coastguard Worker// limitations under the License.
14*e1997b9aSAndroid Build Coastguard Worker
15*e1997b9aSAndroid Build Coastguard Workerpackage {
16*e1997b9aSAndroid Build Coastguard Worker    // See: http://go/android-license-faq
17*e1997b9aSAndroid Build Coastguard Worker    // A large-scale-change added 'default_applicable_licenses' to import
18*e1997b9aSAndroid Build Coastguard Worker    // all of the 'license_kinds' from "system_security_license"
19*e1997b9aSAndroid Build Coastguard Worker    // to get the below license kinds:
20*e1997b9aSAndroid Build Coastguard Worker    //   SPDX-license-identifier-Apache-2.0
21*e1997b9aSAndroid Build Coastguard Worker    default_applicable_licenses: ["system_security_license"],
22*e1997b9aSAndroid Build Coastguard Worker}
23*e1997b9aSAndroid Build Coastguard Worker
24*e1997b9aSAndroid Build Coastguard Worker// List of clang-tidy checks that are reported as errors.
25*e1997b9aSAndroid Build Coastguard Worker// Please keep this list ordered lexicographically.
26*e1997b9aSAndroid Build Coastguard Workertidy_errors = [
27*e1997b9aSAndroid Build Coastguard Worker  "cert-err34-c",
28*e1997b9aSAndroid Build Coastguard Worker  "google-default-arguments",
29*e1997b9aSAndroid Build Coastguard Worker  "google-runtime-int",
30*e1997b9aSAndroid Build Coastguard Worker  "google-runtime-member-string-references",
31*e1997b9aSAndroid Build Coastguard Worker  "misc-move-const-arg",
32*e1997b9aSAndroid Build Coastguard Worker  "misc-move-forwarding-reference",
33*e1997b9aSAndroid Build Coastguard Worker  "misc-unused-parameters",
34*e1997b9aSAndroid Build Coastguard Worker  "misc-unused-using-decls",
35*e1997b9aSAndroid Build Coastguard Worker  "misc-use-after-move",
36*e1997b9aSAndroid Build Coastguard Worker  "modernize-pass-by-value",
37*e1997b9aSAndroid Build Coastguard Worker  "performance-faster-string-find",
38*e1997b9aSAndroid Build Coastguard Worker  "performance-for-range-copy",
39*e1997b9aSAndroid Build Coastguard Worker  "performance-implicit-conversion-in-loop",
40*e1997b9aSAndroid Build Coastguard Worker  "performance-inefficient-vector-operation",
41*e1997b9aSAndroid Build Coastguard Worker  "performance-move-const-arg",
42*e1997b9aSAndroid Build Coastguard Worker  "performance-move-constructor-init",
43*e1997b9aSAndroid Build Coastguard Worker  "performance-noexcept-move-constructor",
44*e1997b9aSAndroid Build Coastguard Worker  "performance-unnecessary-value-param",
45*e1997b9aSAndroid Build Coastguard Worker]
46*e1997b9aSAndroid Build Coastguard Worker
47*e1997b9aSAndroid Build Coastguard Workercc_defaults {
48*e1997b9aSAndroid Build Coastguard Worker  cpp_std: "experimental",
49*e1997b9aSAndroid Build Coastguard Worker  name: "odsign_flags_defaults",
50*e1997b9aSAndroid Build Coastguard Worker  cflags: [
51*e1997b9aSAndroid Build Coastguard Worker    "-Wall",
52*e1997b9aSAndroid Build Coastguard Worker    "-Wextra",
53*e1997b9aSAndroid Build Coastguard Worker    "-Werror",
54*e1997b9aSAndroid Build Coastguard Worker    "-Wno-unused-parameter",
55*e1997b9aSAndroid Build Coastguard Worker
56*e1997b9aSAndroid Build Coastguard Worker    // Some extra flags.
57*e1997b9aSAndroid Build Coastguard Worker    "-fstrict-aliasing",
58*e1997b9aSAndroid Build Coastguard Worker    "-Wredundant-decls",
59*e1997b9aSAndroid Build Coastguard Worker    "-Wshadow",
60*e1997b9aSAndroid Build Coastguard Worker    "-Wstrict-aliasing",
61*e1997b9aSAndroid Build Coastguard Worker    "-Wthread-safety",
62*e1997b9aSAndroid Build Coastguard Worker    "-Wthread-safety-negative",
63*e1997b9aSAndroid Build Coastguard Worker    "-Wunreachable-code",
64*e1997b9aSAndroid Build Coastguard Worker    "-Wunreachable-code-break",
65*e1997b9aSAndroid Build Coastguard Worker    "-Wunreachable-code-return",
66*e1997b9aSAndroid Build Coastguard Worker    "-Wunused",
67*e1997b9aSAndroid Build Coastguard Worker    "-Wused-but-marked-unused",
68*e1997b9aSAndroid Build Coastguard Worker  ],
69*e1997b9aSAndroid Build Coastguard Worker  tidy: true,
70*e1997b9aSAndroid Build Coastguard Worker  tidy_checks: tidy_errors,
71*e1997b9aSAndroid Build Coastguard Worker  tidy_checks_as_errors: tidy_errors,
72*e1997b9aSAndroid Build Coastguard Worker  tidy_flags: [
73*e1997b9aSAndroid Build Coastguard Worker    "-format-style=file",
74*e1997b9aSAndroid Build Coastguard Worker  ],
75*e1997b9aSAndroid Build Coastguard Worker}
76*e1997b9aSAndroid Build Coastguard Worker
77*e1997b9aSAndroid Build Coastguard Workercc_library {
78*e1997b9aSAndroid Build Coastguard Worker  name: "libsigningutils",
79*e1997b9aSAndroid Build Coastguard Worker  defaults: [
80*e1997b9aSAndroid Build Coastguard Worker    "odsign_flags_defaults",
81*e1997b9aSAndroid Build Coastguard Worker  ],
82*e1997b9aSAndroid Build Coastguard Worker  cpp_std: "experimental",
83*e1997b9aSAndroid Build Coastguard Worker  srcs: [
84*e1997b9aSAndroid Build Coastguard Worker    "CertUtils.cpp",
85*e1997b9aSAndroid Build Coastguard Worker    "VerityUtils.cpp",
86*e1997b9aSAndroid Build Coastguard Worker  ],
87*e1997b9aSAndroid Build Coastguard Worker
88*e1997b9aSAndroid Build Coastguard Worker  shared_libs: [
89*e1997b9aSAndroid Build Coastguard Worker    "libbase",
90*e1997b9aSAndroid Build Coastguard Worker    "libcrypto",
91*e1997b9aSAndroid Build Coastguard Worker    "libcrypto_utils",
92*e1997b9aSAndroid Build Coastguard Worker    "libfsverity",
93*e1997b9aSAndroid Build Coastguard Worker    "libprotobuf-cpp-lite",
94*e1997b9aSAndroid Build Coastguard Worker    "libutils",
95*e1997b9aSAndroid Build Coastguard Worker  ],
96*e1997b9aSAndroid Build Coastguard Worker  export_include_dirs: ["include"],
97*e1997b9aSAndroid Build Coastguard Worker  recovery_available: true,
98*e1997b9aSAndroid Build Coastguard Worker}
99*e1997b9aSAndroid Build Coastguard Worker
100*e1997b9aSAndroid Build Coastguard Workergenrule {
101*e1997b9aSAndroid Build Coastguard Worker  name: "statslog_odsign.h",
102*e1997b9aSAndroid Build Coastguard Worker  tools: ["stats-log-api-gen"],
103*e1997b9aSAndroid Build Coastguard Worker  cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_odsign.h --module art --namespace art,metrics,statsd",
104*e1997b9aSAndroid Build Coastguard Worker  out: [
105*e1997b9aSAndroid Build Coastguard Worker    "statslog_odsign.h",
106*e1997b9aSAndroid Build Coastguard Worker  ],
107*e1997b9aSAndroid Build Coastguard Worker}
108*e1997b9aSAndroid Build Coastguard Worker
109*e1997b9aSAndroid Build Coastguard Workercc_binary {
110*e1997b9aSAndroid Build Coastguard Worker  name: "odsign",
111*e1997b9aSAndroid Build Coastguard Worker  defaults: [
112*e1997b9aSAndroid Build Coastguard Worker    "odsign_flags_defaults",
113*e1997b9aSAndroid Build Coastguard Worker  ],
114*e1997b9aSAndroid Build Coastguard Worker  cpp_std: "experimental",
115*e1997b9aSAndroid Build Coastguard Worker  init_rc: ["odsign.rc"],
116*e1997b9aSAndroid Build Coastguard Worker  srcs: [
117*e1997b9aSAndroid Build Coastguard Worker    "KeystoreKey.cpp",
118*e1997b9aSAndroid Build Coastguard Worker    "KeystoreHmacKey.cpp",
119*e1997b9aSAndroid Build Coastguard Worker    "odsign_main.cpp",
120*e1997b9aSAndroid Build Coastguard Worker    "StatsReporter.cpp",
121*e1997b9aSAndroid Build Coastguard Worker  ],
122*e1997b9aSAndroid Build Coastguard Worker  generated_headers: ["statslog_odsign.h"],
123*e1997b9aSAndroid Build Coastguard Worker
124*e1997b9aSAndroid Build Coastguard Worker  header_libs: ["odrefresh_headers"],
125*e1997b9aSAndroid Build Coastguard Worker
126*e1997b9aSAndroid Build Coastguard Worker  static_libs: [
127*e1997b9aSAndroid Build Coastguard Worker    "libsigningutils",
128*e1997b9aSAndroid Build Coastguard Worker    "lib_odsign_proto",
129*e1997b9aSAndroid Build Coastguard Worker  ],
130*e1997b9aSAndroid Build Coastguard Worker  shared_libs: [
131*e1997b9aSAndroid Build Coastguard Worker    "android.system.keystore2-V1-cpp",
132*e1997b9aSAndroid Build Coastguard Worker    "android.hardware.security.keymint-V1-cpp",
133*e1997b9aSAndroid Build Coastguard Worker    "libbase",
134*e1997b9aSAndroid Build Coastguard Worker    "libbinder",
135*e1997b9aSAndroid Build Coastguard Worker    "libcrypto",
136*e1997b9aSAndroid Build Coastguard Worker    "libcrypto_utils",
137*e1997b9aSAndroid Build Coastguard Worker    "libfsverity",
138*e1997b9aSAndroid Build Coastguard Worker    "liblogwrap",
139*e1997b9aSAndroid Build Coastguard Worker    "libprotobuf-cpp-lite",
140*e1997b9aSAndroid Build Coastguard Worker    "libstatspull",
141*e1997b9aSAndroid Build Coastguard Worker    "libstatssocket",
142*e1997b9aSAndroid Build Coastguard Worker    "libutils",
143*e1997b9aSAndroid Build Coastguard Worker  ],
144*e1997b9aSAndroid Build Coastguard Worker}
145