-
Notifications
You must be signed in to change notification settings - Fork 766
/
BUILD.bazel
206 lines (191 loc) · 5.38 KB
/
BUILD.bazel
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
# Copyright (c) 2024, Google Inc.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
load(
":gen/sources.bzl",
"bcm_internal_headers",
"bcm_sources",
"bcm_sources_asm",
"bssl_internal_headers",
"bssl_sources",
"crypto_headers",
"crypto_internal_headers",
"crypto_sources",
"crypto_sources_asm",
"crypto_test_data",
"crypto_test_sources",
"decrepit_internal_headers",
"decrepit_sources",
"decrepit_test_sources",
"pki_headers",
"pki_internal_headers",
"pki_sources",
"pki_test_data",
"pki_test_sources",
"ssl_headers",
"ssl_internal_headers",
"ssl_sources",
"ssl_test_sources",
"test_support_internal_headers",
"test_support_sources",
"test_support_sources_asm",
"urandom_test_sources",
)
load(":util/util.bzl", "bssl_cc_binary", "bssl_cc_library", "bssl_cc_test")
load("@rules_license//rules:license.bzl", "license")
package(
default_applicable_licenses = [":license"],
# Disable the parse_headers feature. It does not work well in C right now.
# See https://github.com/bazelbuild/bazel/issues/23460 for details. When
# that is fixed, if enabled, we likely also need to rename some headers to
# .inc per
# https://google.github.io/styleguide/cppguide.html#Self_contained_Headers
features = ["-parse_headers"],
)
license(
name = "license",
package_name = "BoringSSL",
# TODO(crbug.com/364634028): Update this once we've aligned with OpenSSL's
# new license.
license_kinds = [
"@rules_license//licenses/spdx:ISC",
"@rules_license//licenses/spdx:OpenSSL",
"@rules_license//licenses/spdx:MIT",
"@rules_license//licenses/spdx:SSLeay-standalone",
],
license_text = "LICENSE",
)
exports_files(["LICENSE"])
bssl_cc_library(
name = "crypto",
srcs = bcm_sources + crypto_sources,
hdrs = crypto_headers,
asm_srcs = bcm_sources_asm + crypto_sources_asm,
copts = ["-DBORINGSSL_IMPLEMENTATION"],
includes = ["include"],
internal_hdrs = bcm_internal_headers + crypto_internal_headers,
linkopts = select({
"@platforms//os:windows": [
"-defaultlib:advapi32.lib",
"-defaultlib:ws2_32.lib",
],
"//conditions:default": ["-pthread"],
}),
visibility = ["//visibility:public"],
)
bssl_cc_library(
name = "ssl",
srcs = ssl_sources,
hdrs = ssl_headers,
copts = ["-DBORINGSSL_IMPLEMENTATION"],
internal_hdrs = ssl_internal_headers,
visibility = ["//visibility:public"],
deps = [":crypto_internal"],
)
bssl_cc_library(
name = "test_support",
testonly = True,
srcs = test_support_sources,
asm_srcs = test_support_sources_asm,
copts = ["-DBORINGSSL_USE_BAZEL_RUNFILES"],
internal_hdrs = test_support_internal_headers,
deps = [
":crypto_internal",
"@bazel_tools//tools/cpp/runfiles",
"@googletest//:gtest",
],
)
bssl_cc_test(
name = "crypto_test",
size = "large",
srcs = crypto_test_sources,
data = crypto_test_data,
# crypto_test references assembly symbols directly and thus must be linked
# statically.
linkstatic = True,
shard_count = 32,
deps = [
":crypto_internal",
":test_support",
"@googletest//:gtest",
],
)
bssl_cc_test(
name = "urandom_test",
srcs = urandom_test_sources,
deps = [
":crypto_internal",
":test_support",
"@googletest//:gtest",
],
)
bssl_cc_test(
name = "ssl_test",
srcs = ssl_test_sources,
deps = [
":crypto_internal",
":ssl_internal",
":test_support",
"@googletest//:gtest",
],
)
bssl_cc_binary(
name = "bssl",
srcs = bssl_sources + bssl_internal_headers,
visibility = ["//visibility:public"],
deps = [
":crypto_internal",
":ssl_internal",
],
)
# Build, but do not export libdecrepit.
bssl_cc_library(
name = "decrepit",
srcs = decrepit_sources,
copts = ["-DBORINGSSL_IMPLEMENTATION"],
internal_hdrs = decrepit_internal_headers,
deps = [
":crypto_internal",
":ssl_internal",
],
)
bssl_cc_test(
name = "decrepit_test",
srcs = decrepit_test_sources,
deps = [
":crypto_internal",
":decrepit",
":test_support",
"@googletest//:gtest",
],
)
# Build, but do not (yet) export libpki.
bssl_cc_library(
name = "pki",
srcs = pki_sources,
hdrs = pki_headers,
copts = ["-DBORINGSSL_IMPLEMENTATION"],
internal_hdrs = pki_internal_headers,
deps = [":crypto"],
)
bssl_cc_test(
name = "pki_test",
srcs = pki_test_sources,
data = pki_test_data,
deps = [
":crypto_internal",
":pki",
":test_support",
"@googletest//:gtest",
],
)