Skip to content

Commit 69bd782

Browse files
authored
Merge pull request #131 from pi-314159/20241219
Update to upstream be21ef7
2 parents fc7bd73 + b08e9b9 commit 69bd782

File tree

2,179 files changed

+149205
-126395
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,179 files changed

+149205
-126395
lines changed

.bazelrc

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024, Google Inc.
1+
# Copyright 2024 The BoringSSL Authors
22
#
33
# Permission to use, copy, modify, and/or distribute this software for any
44
# purpose with or without fee is hereby granted, provided that the above
@@ -33,6 +33,12 @@ build:linux --cxxopt=-std=c++17
3333
build:macos --cxxopt=-std=c++17
3434
build:windows --cxxopt=/std:c++17
3535

36+
# Our own builds should strictly build without warnings, but we don't add those
37+
# in targets like other flags because we can't assume all users will have clean
38+
# builds too.
39+
build:linux --cxxopt=-Werror
40+
build:macos --cxxopt=-Werror
41+
3642
# Without setting a minimum macOS version, std::optional does not work.
3743
build:macos --cxxopt=-mmacosx-version-min=10.15
3844

.bazelversion

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7.4.1

.bcr/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# BCR Configuration
2+
3+
This directory contains configuration information for BCR. It is patterned after
4+
the [Publish to BCR app](https://github.com/bazel-contrib/publish-to-bcr/tree/main/templates),
5+
which we have [opted not to use](https://github.com/bazel-contrib/publish-to-bcr/issues/157).
6+
However, `presubmit.yml` is used by [our own BCR tooling](../docs/releasing.md).

.bcr/config.yml

Whitespace-only changes.

.bcr/metadata.template.json

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"homepage": "https://boringssl.googlesource.com/boringssl/",
3+
"maintainers": [
4+
{
5+
"email": "[email protected]",
6+
"github": "agl",
7+
"name": "Adam Langley"
8+
},
9+
{
10+
"email": "[email protected]",
11+
"github": "bob-beck",
12+
"name": "Bob Beck"
13+
},
14+
{
15+
"email": "[email protected]",
16+
"github": "davidben",
17+
"name": "David Benjamin"
18+
}
19+
],
20+
"repository": [
21+
"github:google/boringssl"
22+
],
23+
"versions": [],
24+
"yanked_versions": {}
25+
}

.bcr/presubmit.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
build_targets: &build_targets
2+
- "@boringssl//:crypto"
3+
- "@boringssl//:ssl"
4+
5+
matrix: &matrix
6+
non_macos_platform:
7+
- debian11
8+
- ubuntu2204
9+
- windows
10+
bazel: [7.x]
11+
tasks:
12+
verify_targets:
13+
name: Verify build targets
14+
platform: ${{ non_macos_platform }}
15+
bazel: ${{ bazel }}
16+
build_targets: *build_targets
17+
# Work around https://github.com/bazelbuild/bazel/issues/10472
18+
verify_targets_on_macos:
19+
name: Verify build targets on macOS
20+
platform: macos
21+
bazel: ${{ bazel }}
22+
build_targets: *build_targets
23+
build_flags: &macos_workaround
24+
- '--cxxopt=-std=c++17'
25+
- '--sandbox_block_path=/usr/local'
26+
bcr_test_module:
27+
module_path: util/bazel-example
28+
matrix: *matrix
29+
tasks:
30+
run_test_module:
31+
name: Run test module
32+
platform: ${{ non_macos_platform }}
33+
bazel: ${{ bazel }}
34+
build_targets:
35+
- //...
36+
# Work around https://github.com/bazelbuild/bazel/issues/10472
37+
run_test_module_on_macos:
38+
name: Run test module on macOS
39+
platform: macos
40+
bazel: ${{ bazel }}
41+
build_targets:
42+
- //...
43+
build_flags: *macos_workaround

.bcr/source.template.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"integrity": "",
3+
"strip_prefix": "{REPO}-{VERSION}",
4+
"url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.tar.gz"
5+
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
/util/bot/libcxx
2525
/util/bot/libcxxabi
2626
/util/bot/llvm-build
27+
/util/bot/llvm-libc
2728
/util/bot/nasm-win32.exe
2829
/util/bot/ninja
2930
/util/bot/perl-win32

AUTHORS

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This is the list of BoringSSL's significant contributors.
2+
#
3+
# This does not necessarily list everyone who has contributed code,
4+
# especially since many employees of one corporation may be contributing.
5+
# To see the full list of contributors, see the revision history in
6+
# source control.
7+
Google LLC
8+
Brian Smith
9+
10+
# Additionally, much of the code in BoringSSL is derived from code in the
11+
# OpenSSL project. We thank the OpenSSL project’s contributors for their
12+
# work. Some of these contributors are listed below. For the full list of
13+
# these contributors, see AUTHORS.md in OpenSSL and the revision history
14+
# in OpenSSL’s source control.
15+
OpenSSL Software Services, Inc.
16+
OpenSSL Software Foundation, Inc.
17+
Andy Polyakov
18+
Ben Laurie
19+
Ben Kaduk
20+
Bernd Edlinger
21+
Bodo Möller
22+
David Benjamin
23+
David von Oheimb
24+
Dmitry Belyavskiy (Дмитрий Белявский)
25+
Emilia Käsper
26+
Eric Young
27+
Geoff Thorpe
28+
Holger Reif
29+
Kurt Roeckx
30+
Lutz Jänicke
31+
Mark J. Cox
32+
Matt Caswell
33+
Matthias St. Pierre
34+
Nicola Tuveri
35+
Nils Larsch
36+
Patrick Steuer
37+
Paul Dale
38+
Paul C. Sutton
39+
Paul Yang
40+
Ralf S. Engelschall
41+
Rich Salz
42+
Richard Levitte
43+
Shane Lontis
44+
Stephen Henson
45+
Steve Marquess
46+
Tim Hudson
47+
Tomáš Mráz
48+
Ulf Möller
49+
Viktor Dukhovni

BUILD.bazel

+24-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2024, Google Inc.
1+
# Copyright 2024 The BoringSSL Authors
22
#
33
# Permission to use, copy, modify, and/or distribute this software for any
44
# purpose with or without fee is hereby granted, provided that the above
@@ -43,14 +43,31 @@ load(
4343
"urandom_test_sources",
4444
)
4545
load(":util/util.bzl", "bssl_cc_binary", "bssl_cc_library", "bssl_cc_test")
46+
load("@rules_license//rules:license.bzl", "license")
4647

47-
# Disable the parse_headers feature. It does not work well in C right now. See
48-
# https://github.com/bazelbuild/bazel/issues/23460 for details. When that is
49-
# fixed, if enabled, we likely also need to rename some headers to .inc per
50-
# https://google.github.io/styleguide/cppguide.html#Self_contained_Headers
51-
package(features = ["-parse_headers"])
48+
package(
49+
default_applicable_licenses = [":license"],
50+
# Disable the parse_headers feature. It does not work well in C right now.
51+
# See https://github.com/bazelbuild/bazel/issues/23460 for details. When
52+
# that is fixed, if enabled, we likely also need to rename some headers to
53+
# .inc per
54+
# https://google.github.io/styleguide/cppguide.html#Self_contained_Headers
55+
features = ["-parse_headers"],
56+
)
5257

53-
licenses(["notice"])
58+
license(
59+
name = "license",
60+
package_name = "BoringSSL",
61+
# TODO(crbug.com/364634028): Update this once we've aligned with OpenSSL's
62+
# new license.
63+
license_kinds = [
64+
"@rules_license//licenses/spdx:ISC",
65+
"@rules_license//licenses/spdx:OpenSSL",
66+
"@rules_license//licenses/spdx:MIT",
67+
"@rules_license//licenses/spdx:SSLeay-standalone",
68+
],
69+
license_text = "LICENSE",
70+
)
5471

5572
exports_files(["LICENSE"])
5673

BUILDING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ most recent stable version of each tool.
2525
by CMake, it may be configured explicitly by setting
2626
`CMAKE_ASM_NASM_COMPILER`.
2727

28-
* Compilers for C11 and C++14, or later, are required. On Windows, MSVC from
29-
Visual Studio 2019 or later with Windows 10 SDK 2104 or later are
28+
* Compilers for C11 and C++17, or later, are required. On Windows, MSVC from
29+
Visual Studio 2022 or later with Windows 10 SDK 2104 or later are
3030
supported, but using the latest versions is recommended. Recent versions of
3131
GCC (6.1+) and Clang should work on non-Windows platforms, and maybe on
3232
Windows too.

CMakeLists.txt

+33-23
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.16)
22

33
# Defer enabling C and CXX languages.
44
project(BoringSSL NONE)
@@ -97,7 +97,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
9797
set(EMSCRIPTEN 1)
9898
endif()
9999

100-
set(CMAKE_CXX_STANDARD 14)
100+
set(CMAKE_CXX_STANDARD 17)
101101
set(CMAKE_CXX_STANDARD_REQUIRED ON)
102102
set(CMAKE_C_STANDARD 11)
103103
set(CMAKE_C_STANDARD_REQUIRED ON)
@@ -123,7 +123,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CLANG)
123123
endif()
124124

125125
if(CLANG)
126-
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wnewline-eof -fcolor-diagnostics")
126+
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wnewline-eof -Wextra-semi -fcolor-diagnostics")
127127
else()
128128
# GCC (at least 4.8.4) has a bug where it'll find unreachable free() calls
129129
# and declare that the code is trying to free a stack pointer.
@@ -365,7 +365,9 @@ if(FIPS_DELOCATE OR NOT OPENSSL_NO_ASM)
365365
set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -gcv8")
366366
else()
367367
enable_language(ASM)
368-
set(OPENSSL_ASM TRUE)
368+
if (NOT OPENSSL_NO_ASM)
369+
set(OPENSSL_ASM TRUE)
370+
endif()
369371
# Work around https://gitlab.kitware.com/cmake/cmake/-/issues/20771 in older
370372
# CMake versions.
371373
if(APPLE AND CMAKE_VERSION VERSION_LESS 3.19)
@@ -447,7 +449,10 @@ if(USE_CUSTOM_LIBCXX)
447449
libcxx PRIVATE
448450
-D_LIBCPP_BUILDING_LIBRARY
449451
-DLIBCXX_BUILDING_LIBCXXABI
452+
-DLIBC_NAMESPACE=bssl_llvm_libc
450453
)
454+
# LLVM libc++ depends on some shared headers from LLVM libc.
455+
target_include_directories(libcxx PRIVATE util/bot/llvm-libc)
451456
set_target_properties(
452457
libcxx libcxxabi PROPERTIES
453458
COMPILE_FLAGS "-Wno-missing-prototypes -Wno-implicit-fallthrough"
@@ -529,15 +534,25 @@ if(FIPS_DELOCATE AND FIPS_SHARED)
529534
message(FATAL_ERROR "Can't set both delocate and shared mode for FIPS build")
530535
endif()
531536

537+
# OSS-Fuzz relies on BORINGSSL_ALLOW_CXX_RUNTIME because -fno-rtti and
538+
# -fsanitize=vptr are incompatible.
539+
set(NO_CXX_RUNTIME_FLAGS)
540+
if(NOT MSVC AND NOT BORINGSSL_ALLOW_CXX_RUNTIME)
541+
# Without -fno-exceptions, use of std::unique_ptr emits a call to
542+
# std::terminate.
543+
set(NO_CXX_RUNTIME_FLAGS -fno-exceptions -fno-rtti)
544+
endif()
545+
532546
if(FIPS_DELOCATE)
533547
add_library(bcm_c_generated_asm STATIC ${BCM_SOURCES})
548+
# The C++ code in libcrypto shouldn't depend on libstdc++.
549+
target_compile_options(bcm_c_generated_asm PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${NO_CXX_RUNTIME_FLAGS}> "-S")
534550
add_dependencies(bcm_c_generated_asm boringssl_prefix_symbols)
535551
target_include_directories(bcm_c_generated_asm PRIVATE ${PROJECT_SOURCE_DIR}/include)
536-
set_target_properties(bcm_c_generated_asm PROPERTIES COMPILE_OPTIONS "-S")
537552
set_target_properties(bcm_c_generated_asm PROPERTIES POSITION_INDEPENDENT_CODE ON)
538553
if(CLANG)
539554
# Clang warns when passing both -c (from CMake) and -S.
540-
set_property(TARGET bcm_c_generated_asm APPEND PROPERTY COMPILE_OPTIONS "-Wno-unused-command-line-argument")
555+
target_compile_options(bcm_c_generated_asm PRIVATE "-Wno-unused-command-line-argument")
541556
endif()
542557

543558
set(TARGET_FLAG "")
@@ -581,6 +596,8 @@ elseif(FIPS_SHARED)
581596
endif()
582597

583598
add_library(bcm_library STATIC ${BCM_SOURCES} ${BCM_SOURCES_ASM_USED})
599+
# The C++ code in libcrypto shouldn't depend on libstdc++.
600+
target_compile_options(bcm_library PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${NO_CXX_RUNTIME_FLAGS}>)
584601
add_dependencies(bcm_library boringssl_prefix_symbols)
585602
target_include_directories(bcm_library PRIVATE ${PROJECT_SOURCE_DIR}/include)
586603

@@ -593,12 +610,16 @@ elseif(FIPS_SHARED)
593610
set(CRYPTO_FIPS_OBJECTS bcm.o)
594611
else()
595612
add_library(fipsmodule OBJECT ${BCM_SOURCES} ${BCM_SOURCES_ASM_USED})
613+
# The C++ code in libcrypto shouldn't depend on libstdc++.
614+
target_compile_options(fipsmodule PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${NO_CXX_RUNTIME_FLAGS}>)
596615
add_dependencies(fipsmodule boringssl_prefix_symbols)
597616
target_include_directories(fipsmodule PRIVATE ${PROJECT_SOURCE_DIR}/include)
598617
set(CRYPTO_FIPS_OBJECTS $<TARGET_OBJECTS:fipsmodule>)
599618
endif()
600619

601620
add_library(crypto ${CRYPTO_SOURCES} ${CRYPTO_FIPS_OBJECTS} ${CRYPTO_SOURCES_ASM_USED})
621+
# The C++ code in libcrypto shouldn't depend on libstdc++.
622+
target_compile_options(crypto PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${NO_CXX_RUNTIME_FLAGS}>)
602623
target_include_directories(crypto PUBLIC
603624
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
604625
$<INSTALL_INTERFACE:include>
@@ -696,12 +717,9 @@ add_executable(pki_test ${PKI_TEST_SOURCES})
696717
target_link_libraries(pki_test test_support_lib boringssl_gtest pki crypto)
697718
add_dependencies(all_tests pki_test)
698719

699-
# The PKI library requires C++17.
700720
set_target_properties(
701721
pki pki_test
702722
PROPERTIES
703-
CXX_STANDARD 17
704-
CXX_STANDARD_REQUIRED YES
705723
COMPILE_FLAGS "${PKI_CXX_FLAGS}")
706724

707725
add_executable(bssl ${BSSL_SOURCES})
@@ -721,7 +739,10 @@ if(FUZZ)
721739
add_library(Fuzzer STATIC ${LIBFUZZER_SOURCES})
722740
# libFuzzer does not pass our aggressive warnings. It also must be built
723741
# without -fsanitize-coverage options or clang crashes.
724-
set_target_properties(Fuzzer PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -Wno-missing-prototypes -fsanitize-coverage=0")
742+
set_target_properties(
743+
Fuzzer PROPERTIES
744+
COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -Wno-missing-prototypes -fsanitize-coverage=0"
745+
)
725746
endif()
726747

727748
add_subdirectory(fuzz)
@@ -793,19 +814,8 @@ else()
793814
endif()
794815

795816
if(INSTALL_ENABLED)
796-
# CMake versions before 3.14 do not have default destination values. Executable
797-
# and library targets that use a default destination should include this
798-
# variable.
799-
if(CMAKE_VERSION VERSION_LESS "3.14")
800-
set(INSTALL_DESTINATION_DEFAULT
801-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
802-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
803-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
804-
endif()
805-
806-
install(TARGETS crypto ssl
807-
EXPORT OpenSSLTargets ${INSTALL_DESTINATION_DEFAULT})
808-
install(TARGETS bssl DESTINATION ${INSTALL_DESTINATION_DEFAULT})
817+
install(TARGETS crypto ssl EXPORT OpenSSLTargets)
818+
install(TARGETS bssl)
809819
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
810820
install(EXPORT OpenSSLTargets
811821
FILE OpenSSLTargets.cmake

CONTRIBUTING.md

+16
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,22 @@ version of it. (Use the `git rebase` or `git commit --amend` commands.)
4646
For more detailed instructions, see the
4747
[Gerrit User Guide](https://gerrit-review.googlesource.com/Documentation/intro-user.html).
4848

49+
### Copyright headers
50+
New files contributed directly to BoringSSL should use the following copyright
51+
header, where `YEAR` is the year the file was added:
52+
53+
Copyright YEAR The BoringSSL Authors
54+
55+
To list individual contributors, we maintain an [AUTHORS](./AUTHORS) file at the
56+
top level of the project. See [this documentation](https://opensource.google/documentation/reference/releasing/authors)
57+
for more details. If you wish to be added, you are welcome to add yourself as
58+
part of your contribution, or request that we add you.
59+
60+
We started the AUTHORS file after the project began, and after receiving many
61+
valuable contributions. To avoid being presumptuous, we did not proactively list
62+
all past contributors. If you previously made a contribution, you are likewise
63+
welcome to send us a patch to be added, or request that we add you.
64+
4965
### The small print
5066
Contributions made by corporations are covered by a different agreement than
5167
the one above, the

0 commit comments

Comments
 (0)