Repository navigation
Conversation
erickguan
requested changes
Nov 18, 2026
erickguan
left a comment
Member
There was a problem hiding this comment.
I like this feature.
Some requests:
- Reuse hasher. boring will allocate much less when signing again.
- Feel free to change data structure and function signatures. It can be lazy init hasher. It can be a struct.
- We validate at least reqsign compiles with at least one feature.
vovacf201
force-pushed
the
feat/core-boring-backend
branch
from
November 18, 2026 14:02
845cc4a to
c62ef85
Compare
Author
|
Thanks for the review! Pushed eb4db64 (and rebased on
|
The functions in `reqsign_core::hash` keep their API and now go through a private backend. RustCrypto stays the default. With the new `boring` feature, SHA-1, SHA-256, HMAC-SHA1 and HMAC-SHA256 use BoringSSL through the `boring` crate instead. The facade `reqsign` crate forwards the feature. Known-answer tests (the standard SHA "abc" and empty-input digests, RFC 4231 and RFC 2202 HMAC, and the AWS SigV4 signing-key example) run on both backends. CI runs the reqsign-core and reqsign-aws-v4 tests with the feature enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each thread keeps one SHA-1 and one SHA-256 `Hasher` and reuses it, so hashing no longer creates a new digest context per call. CI now also builds the `reqsign` facade with the `boring` feature, with and without default features, and the main test step gets its env back. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vovacf201
force-pushed
the
feat/core-boring-backend
branch
from
November 18, 2026 14:04
c62ef85 to
eb4db64
Compare
Member
|
Is thread-local safe? How do you think about APIs in user ends? |
Hashing from another thread-local's destructor during thread exit could reach the hasher after it was destroyed, and the resulting panic aborted the process. Use a one-off hasher in that case. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
yes it's safe if the question about API means how API changes for user - nothing changes |
This branch has not been deployed
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.
What
Adds an opt-in
boringcargo feature toreqsign-corethat computes the SHA and HMAC inreqsign_core::hashwith BoringSSL (through theboringcrate) instead of RustCrypto.reqsign_core::hashkeeps its public API. The functions now call a privatebackendmodule, which is either RustCrypto (default, unchanged) or BoringSSL (boringfeature). Covered:hex_sha1,hex_sha256,hmac_sha256,base64_hmac_sha256,hex_hmac_sha1,hex_hmac_sha256,base64_hmac_sha1.reqsigncrate gets a matchingboringfeature that forwards toreqsign-core/boring.""and"abc", RFC 4231 test cases 1 and 6 (including a key longer than the block size), RFC 2202 test case 1, and the AWS SigV4 signing-key example from the AWS documentation.reqsign-coreandreqsign-aws-v4tests with--features reqsign-core/boring. Clippy already builds the feature through--all-features.Why
Some applications standardize all their cryptography on BoringSSL and don't want a second implementation of SHA/HMAC on the request-signing path. Today they have to fork
reqsign-coreto changehash.rs. Higher-level users such as OpenDAL build the signingContextinternally, so a runtime hook wouldn't reach them without API changes in those crates as well.A cargo feature works through feature unification. An application can add
reqsign-core = { version = "3", features = ["boring"] }as a direct dependency, and the copy used by OpenDAL (or any other dependent) switches backends with no changes in the intermediate crates.Scope and compatibility
boringcan't break a dependent that disables default features. When both are compiled,boringtakes precedence.reqsign_core::hash. That is all of the hashing and HMAC behind AWS SigV4 (reqsign-aws-v4) and the other services that call these helpers. Asymmetric signing (SigV4a ECDSA, Google/Oracle RSA, thejwtfeature, Azure client certificates) is unchanged.boringbuilds BoringSSL from source (CMake and a C/C++ toolchain) and isn't available onwasm32-unknown-unknown. The wasm-supported crates are unaffected because the feature is off by default. The CI wasm builds still pass.Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --no-fail-fast -p reqsign-core -p reqsign-aws-v4(RustCrypto): reqsign-core 45, reqsign-aws-v4 69 (+ integration test binaries), all pass.cargo test --no-fail-fast -p reqsign-core -p reqsign-aws-v4 --features reqsign-core/boring(BoringSSL): the same results.cargo build --target wasm32-unknown-unknown --no-default-features --features=aws,aws-v4a,azure,aliyun,tencent(facade): passes.🤖 Generated with Claude Code