Skip to content

[boring] Compile BoringSSL with OPENSSL_SMALL - #2910

Merged
mosuem merged 1 commit into
mainfrom
boring-openssl-small
Nov 19, 2026
Merged

mosuem merged 1 commit into
mainfrom
boring-openssl-small

Conversation

@mosuem

@mosuem mosuem commented Nov 19, 2026

Copy link
Copy Markdown
Member

Note

This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.

Split out of #2893, as @brianquinlan suggested. It's independent of #2893 and based on main.

package:webcrypto compiled BoringSSL with OPENSSL_SMALL before it moved to package:boring (google/webcrypto.dart#417). It mainly shrinks the precomputed P-256 tables, which every application that uses ECDSA or ECDH needs, so tree-shaking can't remove them. I measured webcrypto's full test suite as a tree-shaken AOT build (dart build cli) on Linux x64, with BoringSSL built from source each way:

without with OPENSSL_SMALL
tree-shaken libbssl_dart.so 1.12 MB 0.91 MB (−19%)
untree-shaken libbssl_dart.so 2.98 MB 2.72 MB (−9%)
ECDSA P-256 sign ×2000 52 ms 108 ms
ECDH P-256 derive ×2000 105 ms 148 ms
AES-256-GCM, 200 MiB 162 ms 152 ms

That's about 50 µs per P-256 signature. This applies to every target, so fetch and checkout keep building the same library. Without it, apps that use webcrypto get about 200 KB bigger per architecture than before the move to package:boring.

As @dcharkes noted in #2893, the prebuilt libraries need one default, because every option would double the set of prebuilt libraries. A hooks.user_defines.boring option could still let checkout builds choose.

Locally on Linux x64: dart test (34 passed, 5 skipped) and the Wycheproof conformance tests pass. All 1520 webcrypto tests pass with either build. The pinned prebuilt libraries are stale until the binaries workflow pins new ones after this lands.

OPENSSL_SMALL mainly shrinks the precomputed P-256 tables, which every
application that uses ECDSA or ECDH needs, so tree-shaking can't remove them.
package:webcrypto compiled BoringSSL with it before it moved to
package:boring. For package:webcrypto, this makes the tree-shaken library on
Linux x64 19% smaller (1.12 MB -> 0.91 MB), and P-256 signing about 2x slower
(26 -> 54 us). AES-GCM is unaffected.

@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 configures BoringSSL to compile with the OPENSSL_SMALL definition in CMakeLists.txt. This change trades slower elliptic-curve operations (such as P-256 signatures) for smaller precomputed tables, reducing the size of the tree-shaken library of package:webcrypto by approximately 19%. The documentation in README.md and CHANGELOG.md has been updated to reflect this change and its performance trade-offs. There are no review comments, so I have no feedback to provide.

@github-actions

Copy link
Copy Markdown

PR Health

Publish ✔️
Package Version Status Publish tag (post-merge)
package:boring ⭐ 0.5.1-wip WIP (no publish necessary)
  • 12 already published.
  • 30 WIP (no publish necessary).

Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

This check can be disabled by tagging the PR with skip-publish-check.

Changelog Entry ✔️
Package Changed Files

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check (for example, for non-user-visible changes when the package version is already at -wip).

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
boring None 0.5.0 0.5.1-wip 0.5.1-wip ✔️

This check can be disabled by tagging the PR with skip-breaking-check.

API leaks ✔️

The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.

Package Leaked API symbol Leaking sources

This check can be disabled by tagging the PR with skip-leaking-check.

Unused Dependencies ✔️
Package Status
boring ✔️ All dependencies utilized correctly.

For details on how to fix these, see dependency_validator.

This check can be disabled by tagging the PR with skip-unused-dependencies-check.

License Headers ✔️
// Copyright (c) 2026, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

Files
no missing headers

All source files should start with a license header.

Unrelated files missing license headers
Files
pkgs/html/test/differential_test.dart
pkgs/html/test/dom_parsing_test.dart
pkgs/html/test/mxss_test.dart
pkgs/html/test/noah_ark_clause_limit_test.dart

This check can be disabled by tagging the PR with skip-license-check.

Coverage ✔️
File Coverage

This check for test coverage is informational (issues shown here will not fail the PR).

This check can be disabled by tagging the PR with skip-coverage-check.

@mosuem
mosuem merged commit 61f53ee into main Nov 19, 2026
41 checks passed
@mosuem
mosuem deleted the boring-openssl-small branch November 19, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants