File: boringssl_Android.bp.template

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (200 lines) | stat: -rw-r--r-- 6,730 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Copyright (C) 2023 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Cronet handles all of its licenses declaration in the top level Android.bp and
// LICENSE files (//external/cronet/Android.bp and //external/cronet/LICENSE).
// Boringsll's license can also be found at
// //external/cronet/third_party/boringssl/src/LICENSE.

package {
    default_visibility: [
        "//external/cronet:__subpackages__",
        "//packages/modules/Connectivity/Tethering:__subpackages__",
    ],
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "external_cronet_license"
    // to get the below license kinds:
    //   legacy_unencumbered
    //   SPDX-license-identifier-Apache-2.0
    //   SPDX-license-identifier-BSD
    //   SPDX-license-identifier-BSD-3-Clause
    //   SPDX-license-identifier-ISC
    //   SPDX-license-identifier-MIT
    //   SPDX-license-identifier-OpenSSL
    default_applicable_licenses: ["external_cronet_license"],
}

build = ["sources.bp"]

cc_defaults {
    name: "${GN2BP_MODULE_PREFIX}cronet_defaults",
    stl: "none",
    apex_available: [
        "com.android.tethering",
    ],
    min_sdk_version: "30",
    include_dirs: [
        "external/cronet/${GN2BP_IMPORT_CHANNEL}/buildtools/third_party/libc++/",
        "external/cronet/${GN2BP_IMPORT_CHANNEL}/third_party/libc++/src/include",
        "external/cronet/${GN2BP_IMPORT_CHANNEL}/third_party/libc++abi/src/include",
    ],
    static_libs: [
        "${GN2BP_MODULE_PREFIX}buildtools_third_party_libc___libc__",
        "${GN2BP_MODULE_PREFIX}buildtools_third_party_libc__abi_libc__abi"
    ],
}

cc_defaults {
    name: "${GN2BP_MODULE_PREFIX}boringssl_flags",
    cflags: [
        "-fvisibility=hidden",
        "-DBORINGSSL_SHARED_LIBRARY",
        "-DBORINGSSL_ANDROID_SYSTEM",
        // Chromium uses extensive harderning mode, so setting the same for boringssl.
        "-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_EXTENSIVE",
        "-DOPENSSL_SMALL",
        "-Werror",
        "-Wno-unused-parameter",
    ],
    cppflags: [
        "-Wall",
        "-Werror",
    ],
}

cc_defaults {
    name: "${GN2BP_MODULE_PREFIX}boringssl_defaults",
    local_include_dirs: ["src/include"],
    export_include_dirs: ["src/include"],
    cflags: [
        "-DBORINGSSL_IMPLEMENTATION",
    ],
}

cc_defaults {
    name: "${GN2BP_MODULE_PREFIX}libcrypto_defaults",
    target: {
        android: {
            // On FIPS builds (i.e. Android only) prevent other libraries
            // from pre-empting symbols in libcrypto which could affect FIPS
            // compliance and cause integrity checks to fail. See b/160231064.
            ldflags: ["-Wl,-Bsymbolic"],
        },
    },
    local_include_dirs: ["src/crypto"],
}

cc_object {
    name: "${GN2BP_MODULE_PREFIX}bcm_object",
    defaults: [
        "${GN2BP_MODULE_PREFIX}boringssl_defaults",
        "${GN2BP_MODULE_PREFIX}boringssl_flags",
        "${GN2BP_MODULE_PREFIX}cronet_defaults",
        "${GN2BP_MODULE_PREFIX}libcrypto_bcm_sources",
        "${GN2BP_MODULE_PREFIX}libcrypto_defaults",
    ],
    sanitize: {
        address: false,
        hwaddress: false,
        // This is a placeholder
        // to help prevent
        // merge conflicts.
        memtag_stack: false,
        // This is a placeholder
        // to help prevent
        // merge conflicts.
        fuzzer: false,
        memtag_globals: false,
    },
    target: {
        android: {
            cflags: [
                "-DBORINGSSL_FIPS",
                "-fPIC",
                // -fno[data|text]-sections required to ensure a
                // single text and data section for FIPS integrity check
                "-fno-data-sections",
                "-fno-function-sections",
            ],
            linker_script: "src/crypto/fipsmodule/fips_shared.lds",
        },
        // From //external/boringssl: Temporary hack to let BoringSSL build with a new compiler.
        // This doesn't enable HWASAN unconditionally, it just causes
        // BoringSSL's asm code to unconditionally use a HWASAN-compatible
        // global variable reference so that the non-HWASANified (because of
        // sanitize: { hwaddress: false } above) code in the BCM can
        // successfully link against the HWASANified code in the rest of
        // BoringSSL in HWASAN builds.
        android_arm64: {
            asflags: [
                "-fsanitize=hwaddress",
            ],
        },
    },
}

cc_library_shared {
    name: "${GN2BP_MODULE_PREFIX}libcrypto",
    defaults: [
        "${GN2BP_MODULE_PREFIX}boringssl_defaults",
        "${GN2BP_MODULE_PREFIX}boringssl_flags",
        "${GN2BP_MODULE_PREFIX}cronet_defaults",
        "${GN2BP_MODULE_PREFIX}libcrypto_defaults",
        "${GN2BP_MODULE_PREFIX}libcrypto_sources",
    ],
    unique_host_soname: true,
    srcs: [
        ":${GN2BP_MODULE_PREFIX}bcm_object",
    ],
    target: {
        android: {
            cflags: [
                "-DBORINGSSL_FIPS",
            ],
            sanitize: {
                // Disable address sanitizing otherwise libcrypto will not report
                // itself as being in FIPS mode, which causes boringssl_self_test
                // to fail.
                address: false,
            },
            inject_bssl_hash: true,
        },
    },
}

cc_library_shared {
    name: "${GN2BP_MODULE_PREFIX}libssl",
    defaults: [
        "${GN2BP_MODULE_PREFIX}boringssl_defaults",
        "${GN2BP_MODULE_PREFIX}boringssl_flags",
        "${GN2BP_MODULE_PREFIX}cronet_defaults",
        "${GN2BP_MODULE_PREFIX}libssl_sources",
    ],
    unique_host_soname: true,
    shared_libs: ["${GN2BP_MODULE_PREFIX}libcrypto"],
}

cc_library_shared {
    name: "${GN2BP_MODULE_PREFIX}libpki",
    defaults: [
        "${GN2BP_MODULE_PREFIX}boringssl_defaults",
        "${GN2BP_MODULE_PREFIX}boringssl_flags",
        "${GN2BP_MODULE_PREFIX}cronet_defaults",
        "${GN2BP_MODULE_PREFIX}libpki_sources",
    ],
    unique_host_soname: true,
    cflags: ["-D_BORINGSSL_LIBPKI_"],
    shared_libs: ["${GN2BP_MODULE_PREFIX}libcrypto"],
}