summaryrefslogtreecommitdiff
path: root/Android.bp
blob: fc45c432756a8c1eddb389067bba2497dba6b82a (plain)
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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Note that some host libraries have the same module name as the target
// libraries. This is currently needed to build, for example, adb. But it's
// probably something that should be changed.

// Pull in the autogenerated sources modules
build = ["sources.bp"]

// Used by libcrypto, libssl, bssl tool, and native tests
cc_defaults {
    name: "boringssl_flags",
    vendor_available: true,

    cflags: [
        "-fvisibility=hidden",
        "-DBORINGSSL_SHARED_LIBRARY",
        "-DBORINGSSL_IMPLEMENTATION",
        "-DOPENSSL_SMALL",
        "-D_XOPEN_SOURCE=700",
        "-Werror",
        "-Wno-unused-parameter",
    ],

    cppflags: [
        "-Wall",
        "-Werror",
    ],

    conlyflags: ["-std=c99"],
}

// Used by libcrypto + libssl
cc_defaults {
    name: "boringssl_defaults",

    local_include_dirs: ["src/include"],
    export_include_dirs: ["src/include"],
    sdk_version: "9",
    target: {
        android: {
            stl: "libc++_static",
        },
    },

    cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
}

//// libcrypto

// This should be removed when clang can compile everything.
libcrypto_sources_no_clang = [
    "linux-arm/crypto/fipsmodule/aes-armv4.S",
    "linux-arm/crypto/fipsmodule/bsaes-armv7.S",
]

cc_defaults {
    name: "libcrypto_defaults",
    host_supported: true,

    // Windows and Macs both have problems with assembly files
    target: {
        windows: {
            enabled: true,
            cflags: ["-DOPENSSL_NO_ASM"],
            host_ldlibs: ["-lws2_32"],
        },
        darwin: {
            cflags: ["-DOPENSSL_NO_ASM"],
        },
        host: {
            host_ldlibs: ["-lpthread"],
        },
    },

    local_include_dirs: ["src/crypto"],

    arch: {
        arm64: {
            clang_asflags: ["-march=armv8-a+crypto"],
        },
    },

    // This should be removed when clang can compile everything.
    exclude_srcs: libcrypto_sources_no_clang,
    whole_static_libs: ["libcrypto_no_clang"],
}

// Target and host library
cc_library {
    name: "libcrypto",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"],
    unique_host_soname: true,
}

// Target and host library: files that don't compile with clang. This should
// go away when clang can compile everything with integrated assembler.
cc_library_static {
    name: "libcrypto_no_clang",
    defaults: ["boringssl_defaults", "boringssl_flags"],
    host_supported: true,

    target: {
        windows: {
            enabled: true,
        },
    },

    local_include_dirs: ["src/crypto"],

    arch: {
        arm: {
            clang_asflags: ["-no-integrated-as"],
            srcs: libcrypto_sources_no_clang,
        },
    },
}

// Static library
// This should only be used for host modules that will be in a JVM, all other
// modules should use the static variant of libcrypto.
cc_library_static {
    name: "libcrypto_static",
    defaults: ["libcrypto_sources", "libcrypto_defaults", "boringssl_defaults", "boringssl_flags"],

    target: {
        host: {
            // TODO: b/26160319. ASAN breaks use of this library in JVM.
            // Re-enable sanitization when the issue with making clients of this library
            // preload ASAN runtime is resolved. Without that, clients are getting runtime
            // errors due to unresolved ASAN symbols, such as
            // __asan_option_detect_stack_use_after_return.
            sanitize: {
                never: true,
            },
        },
    },
}

//// libssl

// Target static library
// Deprecated: all users should move to libssl
cc_library_static {
    name: "libssl_static",
    defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"],
}

// Static and Shared library
cc_library {
    name: "libssl",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    host_supported: true,
    defaults: ["libssl_sources", "boringssl_defaults", "boringssl_flags"],
    unique_host_soname: true,

    shared_libs: ["libcrypto"],
}

// Tool
cc_binary {
    name: "bssl",
    host_supported: true,
    defaults: ["bssl_sources", "boringssl_flags"],

    shared_libs: [
        "libcrypto",
        "libssl",
    ],
    target: {
        darwin: {
            enabled: false,
        },
    },
}

cc_binary {
    name: "cavp",
    host_supported: true,
    srcs: [
        "src/fipstools/cavp_aes_gcm_test.cc",
        "src/fipstools/cavp_aes_test.cc",
        "src/fipstools/cavp_ctr_drbg_test.cc",
        "src/fipstools/cavp_ecdsa2_keypair_test.cc",
        "src/fipstools/cavp_ecdsa2_pkv_test.cc",
        "src/fipstools/cavp_ecdsa2_siggen_test.cc",
        "src/fipstools/cavp_ecdsa2_sigver_test.cc",
        "src/fipstools/cavp_hmac_test.cc",
        "src/fipstools/cavp_kas_test.cc",
        "src/fipstools/cavp_keywrap_test.cc",
        "src/fipstools/cavp_main.cc",
        "src/fipstools/cavp_rsa2_keygen_test.cc",
        "src/fipstools/cavp_rsa2_siggen_test.cc",
        "src/fipstools/cavp_rsa2_sigver_test.cc",
        "src/fipstools/cavp_sha_monte_test.cc",
        "src/fipstools/cavp_sha_test.cc",
        "src/fipstools/cavp_tdes_test.cc",
        "src/fipstools/cavp_test_util.cc",
        "src/fipstools/cavp_tlskdf_test.cc",
    ],

    shared_libs: [
        "libcrypto",
    ],

    defaults: ["boringssl_test_support_sources", "boringssl_flags"],
}

// Test support library
cc_library_static {
    name: "boringssl_test_support",
    host_supported: true,
    defaults: ["boringssl_test_support_sources", "boringssl_flags"],

    shared_libs: [
        "libcrypto",
        "libssl",
    ],
}

// Tests
cc_test {
  name: "boringssl_crypto_test",
  test_suites: ["device-tests"],
  host_supported: true,
  defaults: ["boringssl_crypto_test_sources", "boringssl_flags"],
  whole_static_libs: ["boringssl_test_support"],

  cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
  shared_libs: ["libcrypto"],
}

cc_test {
  name: "boringssl_ssl_test",
  test_suites: ["device-tests"],
  host_supported: true,
  defaults: ["boringssl_ssl_test_sources", "boringssl_flags"],
  whole_static_libs: ["boringssl_test_support"],

  cflags: ["-DBORINGSSL_ANDROID_SYSTEM"],
  shared_libs: ["libcrypto", "libssl"],
}