Repository navigation
Conversation
…r from package:boring
Replaces the internal `_Scope` arena with `BoringArena` from package:boring: - `_Scope.sync` / `_Scope.async` -> `BoringArena.run`, which releases after a returned Future completes (the old `assert(T is! Future)` guard was a no-op), and `_Scope.stream` -> `BoringArena.stream`. - `dataAsPointer` -> `copyBytes`, `createCBS` / `createCBB` -> `cbs` / `cbb`, `CBB.copy()` -> `CBB.toBytes()`, and `defer(() => X_free(p))` -> `using(p, X_free)`. `move` is unchanged. - Keeps a small `create()` extension that maps `nullptr` to OperationError. - `checkErrorStack` uses `extractBoringSslError()`, which removes the last use of package:ffi, so the dependency is dropped.
- Remove the update-boringssl workflow. It ran tool/bump-boringssl-revision.sh and read tool/REVISION, which this PR deletes along with the vendored BoringSSL. BoringSSL bumps now happen in package:boring, and Dependabot's pub config picks up boring releases. - Declare boring as a hosted `^0.4.0` dependency and pin the unreleased commit with dependency_overrides, fixing the invalid_dependency warning that failed the lints job. The example app needs the same override because overrides don't propagate through its path dependency. - Bump the pin to 60072877, whose CI runs the Wycheproof and x509-limbo conformance suites. lib/, hook/ and src/ are unchanged since 410fae8e.
The TODO in checkErrorStack proposed clearing BoringSSL errors in every finally via BoringArena and asserting that none are left. That doesn't work in Dart: the error queue is thread-local and an isolate may resume on a different OS thread after an await, so a clear or assert at arena release can miss errors or see another isolate's. Errors are already consumed right after each failing call (_checkOp, _checkData, and the explicit clear in _verifyStream), and checkErrorStack already fails tests that leave errors behind. Replace both TODOs with comments saying so, and state the rule once above _checkOp.
0.4.2 renamed the BoringArena API: - static `BoringArena.run` -> `BoringArena.using` - instance `using(resource, release)` -> `register(resource, release)` Also update the README's system dependencies: package:boring downloads prebuilt BoringSSL by default, so CMake is no longer needed, and update the example app's pubspec.lock. boring 0.4.2 requires Dart ^3.13.3. The SDK constraint stays at ^3.10.0, because raising it changes the formatter's language version and would reformat 25 unrelated files. Pub enforces the effective minimum via boring.
Removing ffigen dropped the transitive constraint that kept coverage at 1.15.1. coverage 1.16.0's format_coverage rejects the Firefox coverage JSON written by package:test, which fails the Linux desktop job.
…tion With package:boring, every package using BoringSSL on a thread shares its error queue, while webcrypto's own copy of BoringSSL had a separate one. An error that another package left behind was reported as the message of webcrypto's next failure, because extractBoringSslError() reports the least recent (most specific) error. For example, a leftover EC UNKNOWN_GROUP error replaced the DECODE_ERROR of a malformed RSA PKCS#8 key. Run all BoringSSL calls in _arena / _arenaStream, which clear the queue before the operation, like package:boring's README recommends. No other isolate runs on the thread until the operation awaits, and errors are already consumed right after each failing call, so this covers every synchronous call. Results don't change: only error messages could be wrong.
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR was generated by an AI coding agent (Jetski) on behalf of @mosuem.
Important
Stacked on #417 (switch to
package:boring). Until #417 lands, this diff also shows its commits; only the last commit,fix(ffi): clear BoringSSL errors left by other code before each operation, belongs to this PR.With
package:boring, every package using BoringSSL on a thread shares one error queue, whereas webcrypto's own copy of BoringSSL had a separate one. An error that another package leaves behind is then reported as the message of webcrypto's next failure, becauseextractBoringSslError()reports the least recent (most specific) error on the queue.For example, after another package left an EC
UNKNOWN_GROUPerror on the queue:instead of
...:public key routines:OPENSSL_internal:DECODE_ERROR.Change
_arena/_arenaStream, which clear the queue and then runBoringArena.using/BoringArena.stream, and use them for all 31 BoringSSL call sites inlib/src/impl_ffi/. This follows the advice inpackage:boring's README ("CallERR_clear_error()before a call whose errors you report").test/ffi/stale_boringssl_errors_test.dartleaves a stale error, then checks that RSA and EC import failures report their own errors and leave the queue empty. It fails without the fix.All 1585 VM tests pass locally.