Skip to content

Sync from google/boringssl@427ec40 - #37

Open
aslam9691 wants to merge 2 commits into
firebase:mainfrom
aslam9691:upgrade_boringssl
Open

aslam9691 wants to merge 2 commits into
firebase:mainfrom
aslam9691:upgrade_boringssl

Conversation

@aslam9691

@aslam9691 aslam9691 commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Sync BoringSSL from upstream google/boringssl@427ec40cc8edc545253289232e885708c409e5ea (0.20260929.0) which Aligned BoringSSL-GRPC / gRPC version: BoringSSL-GRPC 0.0.44 / gRPC v1.86.0.
  • Updated Package.swift sources to match upstream build.json and referenced gen/crypto/err_data.cc directly (removing the old root err_data.c without keeping a duplicate err_data.cc copy at the repo root) so Clang compiles it as C++17, updated scripts/generate-err-data.sh to generate gen/crypto/err_data.cc in place (updated logging from err_data.c → err_data.cc and removed the cp to the repo root).
  • Runs swift build --build-tests to validate SwiftPMTests/build-test during sync and removed int main() from SwiftPMTests/build-test/test.cc to resolve a duplicate _main linker error against Swift 6.4 swiftbuild's synthesized @main test entry point (test_entry_point.swift), which still checks for accidental _main symbols in openssl_grpc.
  • Updated sync-upstream.sh to discard unused and test files

@aslam9691
aslam9691 marked this pull request as draft December 3, 2026 08:07

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive benchmark suite using google_benchmark under bench/ and refactors several core BIO and ASN1 modules from C to C++, utilizing modern C++ helpers like bssl::UniquePtr and bssl::Span. It also updates build configurations, removes deprecated algorithms like Kyber, and revises documentation to align with C++ style guidelines. Feedback on these changes includes a critical compilation error in crypto/bio/bio.cc where CRYPTO_free_ex_data is missing the this argument, and a recommended cast to SOCKET in crypto/bio/socket_helper.cc to prevent compiler warnings on Windows.

Comment thread crypto/bio/bio.cc
if (method->destroy != nullptr) {
method->destroy(this);
}
CRYPTO_free_ex_data(&g_ex_data_class, &ex_data);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The call to CRYPTO_free_ex_data is missing the second argument (void *obj), which should be this. In BoringSSL, CRYPTO_free_ex_data expects three arguments: const CRYPTO_EX_DATA_CLASS *g_class, void *obj, and CRYPTO_EX_DATA *ad. Passing only two arguments will result in a compilation error in C++.

  CRYPTO_free_ex_data(&g_ex_data_class, this, &ex_data);

&except_set, &timeout) == SOCKET_ERROR) {
return 0;
}
if (!FD_ISSET(sock, &write_set) && !FD_ISSET(sock, &except_set)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For consistency and to prevent compiler warnings on Windows (where SOCKET is a UINT_PTR and sock is an int), sock should be cast to SOCKET inside FD_ISSET, just as it is in FD_SET above.

  if (!FD_ISSET(static_cast<SOCKET>(sock), &write_set) && !FD_ISSET(static_cast<SOCKET>(sock), &except_set)) {

@aslam9691
aslam9691 force-pushed the upgrade_boringssl branch 2 times, most recently from 9527a8c to e2413b8 Compare December 3, 2026 08:33
@aslam9691
aslam9691 marked this pull request as ready for review December 3, 2026 09:20

@cherylEnkidu cherylEnkidu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for putting this sync together! Package.swift sources match build.json cleanly and renaming err_data.c → err_data.cc makes sense (and the two gemini-code-assist comments can be ignored — bio.cc is a false positive against the updated 2-arg CRYPTO_free_ex_data, and both are unmodified upstream files).

Before merging, a few things to address:

  1. Re-enable the spm CI workflow: .github/workflows/spm.yml is currently disabled_inactivity, so none of the Xcode/SwiftPM build checks ran on this PR. Per README.md (#5 & #6), please re-enable it in the Actions tab and trigger a run (and confirm a clean local Xcode build).
  2. Remove re-introduced */test/ directories & test vectors (~21 MB bloat + 15 Wiz Secret findings): Running sync-upstream.sh re-introduced 215 files (18 MB) across crypto/cipher/test/, ssl/test/ (including ssl/test/CMakeLists.txt), crypto/x509/test/, crypto/test/, crypto/rsa/test/, crypto/pkcs7/test/, and crypto/pkcs8/test/, plus ~2.7 MB of new test vectors (crypto/slhdsa/*.txt, crypto/hpke/*test*vectors*, crypto/fipsmodule/rand/ctrdrbg_df_vectors.txt) and pki/test_helpers.{cc,h}. This nearly doubles the repo size (25 MB → 47.6 MB) and triggers the 15 Wiz Secret Scanner findings on dummy .pem keys. Could we prune test/testdata directories and these test vector/helper files in scripts/sync-upstream.sh and re-run it?
  3. Persist PR #34 cleanups in scripts/sync-upstream.sh: CMakeLists.txt, cmake/, go.mod, and go.sum still exist in upstream 427ec40 and appear to have been removed manually here — please add cmake/, CMakeLists.txt, go.mod, and go.sum to cleanup() so future syncs don't re-introduce them.
  4. Redundant line in scripts/sync-upstream.sh (line 73): Since line 48 now does rm -rf "$clean_file" before restoring PRESERVE (which includes .github), .github/workflows/branch-time.yml is already deleted before cleanup() runs and can be removed from line 73.
  5. Optional — avoid duplicating err_data.cc: ./err_data.cc and gen/crypto/err_data.cc are now byte-for-byte identical. Since it no longer needs to be renamed to .c, Package.swift could reference "gen/crypto/err_data.cc" directly and avoid keeping a duplicate copy at the root.
  6. Minor: Could we update the PR description to mention scripts/generate-err-data.sh and which BoringSSL-GRPC / gRPC version 0.20260929.0 aligns with? Also consider swift build --build-tests in sync-upstream.sh so SwiftPMTests/build-test is validated during sync.

- Prune */test/ and */testdata/ directories, test vectors, and pki/test_helpers.{cc,h} in scripts/sync-upstream.sh and remove the 230 re-introduced/unused files (~27.1 MB, incl. 15 dummy .pem keys)
- Persist cmake/, CMakeLists.txt, go.mod, and go.sum removal in cleanup(), preserve .gitignore, and drop redundant .github/workflows/branch-time.yml removal
- Reference gen/crypto/err_data.cc directly in Package.swift, stop copying to ./err_data.cc in scripts/generate-err-data.sh, and remove duplicate root err_data.cc
- Validate test targets via swift build --build-tests in scripts/sync-upstream.sh and remove int main() from SwiftPMTests/build-test/test.cc to avoid duplicate _main under Swift 6.4 swiftbuild
@aslam9691

Copy link
Copy Markdown
Contributor Author

@cherylEnkidu All PR comments addressed except re-enable spm CI workflow, as i don't have permission to enable it.

@cherylEnkidu cherylEnkidu reopened this Dec 4, 2026

@cherylEnkidu cherylEnkidu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! All feedback addressed, repo size & secret-scanner findings cleaned up, and the re-enabled spm CI checks passed across iOS Simulator, macOS, tvOS Simulator, and iOS Device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants