Skip to content

Commit bc97b7a

Browse files
Bob BeckBoringssl LUCI CQ
Bob Beck
authored and
Boringssl LUCI CQ
committed
Bring in the core of chromium certificate verifier as libpki
Initially this leaves the canonical source in chrome, Additions and fillins are committed directly, the chrome files are coverted using the IMPORT script run from the pki directory for the moment. The intention here is to continue frequent automatic conversion (and avoid wholesale cosmetic changes in here for now) until chrome converts to use these files in place of it's versions. At that point these will become the definiative files, and the IMPORT script can be tossed out. A middle step along the way will be to change google3's verify.cc in third_party/chromium_certificate_verifier to use this instead of it's own extracted copy. Status (and what is not done yet) being roughly tracked in README.md Bug: chromium:1322914 Change-Id: Ibdb5479bc68985fa61ce6b10f98f31f6b3a7cbdf Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/60285 Commit-Queue: Bob Beck <bbe@google.com> Reviewed-by: Adam Langley <agl@google.com>
1 parent ee194c7 commit bc97b7a

File tree

2,097 files changed

+242273
-1
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,097 files changed

+242273
-1
lines changed

CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ set(CMAKE_C_STANDARD_REQUIRED ON)
139139
if(CMAKE_COMPILER_IS_GNUCXX OR CLANG)
140140
# Note clang-cl is odd and sets both CLANG and MSVC. We base our configuration
141141
# primarily on our normal Clang one.
142-
set(C_CXX_FLAGS "-Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings -Wvla -Wshadow -Wtype-limits")
142+
# TODO(bbe) took out -Wmissing-field-initializers for pki - fix and put back or disable only for pki
143+
set(C_CXX_FLAGS "-Werror -Wformat=2 -Wsign-compare -Wwrite-strings -Wvla -Wshadow -Wtype-limits")
143144
if(MSVC)
144145
# clang-cl sets different default warnings than clang. It also treats -Wall
145146
# as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall.
@@ -518,6 +519,7 @@ add_subdirectory(tool)
518519
add_subdirectory(util/fipstools)
519520
add_subdirectory(util/fipstools/acvp/modulewrapper)
520521
add_subdirectory(decrepit)
522+
add_subdirectory(pki)
521523

522524
if(FUZZ)
523525
if(LIBFUZZER_FROM_DEPS)

pki/CMakeLists.txt

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
project(pki)
2+
cmake_minimum_required(VERSION 3.25)
3+
set(CMAKE_CXX_STANDARD 17)
4+
5+
add_library(
6+
pki
7+
8+
fillins/ip_address.cc
9+
fillins/utf_string_conversions.cc
10+
fillins/string_util.cc
11+
fillins/base64.cc
12+
fillins/openssl_util.cc
13+
string_util.cc
14+
trust_store.cc
15+
trust_store_collection.cc
16+
parse_certificate.cc
17+
parsed_certificate.cc
18+
parser.cc
19+
parse_values.cc
20+
parse_name.cc
21+
parsed_certificate.cc
22+
name_constraints.cc
23+
input.cc
24+
tag.cc
25+
cert_errors.cc
26+
general_names.cc
27+
pem.cc
28+
crl.cc
29+
revocation_util.cc
30+
encode_values.cc
31+
verify_name_match.cc
32+
cert_errors.cc
33+
common_cert_errors.cc
34+
parse_certificate.cc
35+
parsed_certificate.cc
36+
extended_key_usage.cc
37+
certificate_policies.cc
38+
verify_certificate_chain.cc
39+
verify_signed_data.cc
40+
signature_algorithm.cc
41+
cert_error_id.cc
42+
cert_error_params.cc
43+
trust_store.cc
44+
trust_store_collection.cc
45+
trust_store_in_memory.cc
46+
simple_path_builder_delegate.cc
47+
cert_issuer_source_static.cc
48+
path_builder.cc
49+
)
50+
# Although libpki also provides headers that require an include directory, the
51+
# flag is already specified by libcrypto, so we omit target_include_directories
52+
# here.
53+
install_if_enabled(TARGETS pki EXPORT OpenSSLTargets ${INSTALL_DESTINATION_DEFAULT})
54+
set_property(TARGET pki PROPERTY EXPORT_NAME PKI)
55+
set_property(TARGET pki PROPERTY CXX_STANDARD 17)
56+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BORINGSSL_LIBPKI_")
57+
if (APPLE)
58+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-new")
59+
endif()
60+
target_link_libraries(pki ssl crypto)
61+
62+
add_executable(
63+
pki_test
64+
65+
fillins/path_service.cc
66+
fillins/file_util.cc
67+
test_helpers.cc
68+
string_util_unittest.cc
69+
parser_unittest.cc
70+
parse_values_unittest.cc
71+
input_unittest.cc
72+
signature_algorithm_unittest.cc
73+
extended_key_usage_unittest.cc
74+
parse_name_unittest.cc
75+
verify_name_match_unittest.cc
76+
verify_signed_data_unittest.cc
77+
parse_certificate_unittest.cc
78+
parsed_certificate_unittest.cc
79+
simple_path_builder_delegate_unittest.cc
80+
trust_store_collection_unittest.cc
81+
certificate_policies_unittest.cc
82+
verify_certificate_chain_unittest.cc
83+
nist_pkits_unittest.cc
84+
path_builder_pkits_unittest.cc
85+
name_constraints_unittest.cc
86+
cert_issuer_source_static_unittest.cc
87+
path_builder_unittest.cc
88+
mock_signature_verify_cache.cc
89+
path_builder_verify_certificate_chain_unittest.cc
90+
verify_certificate_chain_pkits_unittest.cc
91+
# encode_values_unittest.cc # Currently does a bunch of time goo..
92+
# ocsp_unittest.cc # Not sure we will keep this here..
93+
)
94+
target_link_libraries(pki_test test_support_lib boringssl_gtest_main pki ssl crypto)
95+
set_property(TARGET pki_test PROPERTY CXX_STANDARD 17)
96+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BORINGSSL_LIBPKI_")
97+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_BORINGSSL_PKI_SRCDIR_=${CMAKE_CURRENT_SOURCE_DIR}")
98+
if (APPLE)
99+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-aligned-new")
100+
endif()
101+
add_dependencies(all_tests pki_test)
102+
103+

pki/IMPORT

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
# Set this to be the location of a chromium checkout, and
4+
# apply the patches in ./patches with "git am" first
5+
# before running this script.
6+
CHROMIUM_SRC=~/chromium/src
7+
8+
mkdir -p ./testdata
9+
cp $CHROMIUM_SRC/net/test/test_certificate_data.h ./testdata
10+
11+
tar -C $CHROMIUM_SRC/net/third_party -cf - nist-pkits | tar -C ./testdata -xf -
12+
tar -C $CHROMIUM_SRC/net/data -cf - cert_issuer_source_static_unittest \
13+
ssl/certificates \
14+
certificate_policies_unittest \
15+
name_constraints_unittest \
16+
ocsp_unittest \
17+
parse_certificate_unittest \
18+
path_builder_unittest \
19+
verify_certificate_chain_unittest \
20+
verify_name_match_unittest \
21+
verify_signed_data_unittest | tar -C ./testdata -xf -
22+
23+
go run ./import_tool.go -spec import_spec.json --source-base $CHROMIUM_SRC -dest-base .

pki/README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# BoringSSL pki - Web PKI Certificate path building and verification library
2+
3+
This directory and library should be considered experimental and should not be
4+
depended upon not to change without notice. You should not use this.
5+
6+
It contains an extracted and modified copy of chrome's certificate
7+
verifier core logic.
8+
9+
It is for the moment, intended to be synchronized from a checkout of chrome's
10+
head with the IMPORT script run in this directory. The eventual goal is to
11+
make both chrome and google3 consume this.
12+
13+
## Current status:
14+
* Some of the Path Builder tests depending on chrome testing classes and
15+
SavedUserData are disabled. These probably need either a mimicing
16+
SaveUserData class here, or be pulled out into chrome only.
17+
* This contains a copy of der as bssl:der - a consideration for
18+
re-integrating with chromium. the encode_values part of der does not include
19+
the base::time or absl::time based stuff as they are not used within the
20+
library, this should probably be split out for chrome, or chrome's der could
21+
be modified (along with this one and eventually merged together) to not use
22+
base::time for encoding GeneralizedTimes, but rather use boringssl posix
23+
times as does the rest of this library.
24+
* The Name Constraint limitation code is modified to remove clamped_math
25+
and mimic BoringSSL's overall limits - Some of the tests that test
26+
for specific edge cases for chrome's limits have been disabled. The
27+
tests need to be changed to reflect the overall limit, or ignored
28+
and we make name constraints subquadratic and stop caring about this.
29+
* Fuzzer targets are not yet hooked up.
30+
31+
32+

0 commit comments

Comments
 (0)