Repository navigation
[boring] Compile BoringSSL with OPENSSL_SMALL - #2910
Conversation
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.
There was a problem hiding this comment.
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.
PR HealthPublish ✔️
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. This check can be disabled by tagging the PR with Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs. This check can be disabled by tagging the PR with Breaking changes ✔️
This check can be disabled by tagging the PR with 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.
This check can be disabled by tagging the PR with Unused Dependencies ✔️
For details on how to fix these, see dependency_validator. This check can be disabled by tagging the PR with License Headers ✔️
All source files should start with a license header. Unrelated files missing license headers
This check can be disabled by tagging the PR with 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 |
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:webcryptocompiled BoringSSL withOPENSSL_SMALLbefore it moved topackage: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:OPENSSL_SMALLlibbssl_dart.solibbssl_dart.soThat's about 50 µs per P-256 signature. This applies to every target, so
fetchandcheckoutkeep building the same library. Without it, apps that use webcrypto get about 200 KB bigger per architecture than before the move topackage: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.boringoption could still letcheckoutbuilds 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.