deps: disable default features on x25519-dalek (consistency; drops ~40 KB of basepoint tables from downstreams)#369
Open
punarinta wants to merge 1 commit into
Conversation
ed25519-dalek and curve25519-dalek are already declared with default-features = false, but x25519-dalek pulls its defaults, which include `precomputed-tables`. Cargo unifies features across the whole dependency graph, so this single declaration silently re-enables curve25519-dalek/precomputed-tables for the entire build and forces the large precomputed basepoint lookup tables (~40 KB) into every downstream binary, with no way for a downstream to opt out. Set default-features = false on x25519-dalek for consistency with the other two dalek crates. `alloc` is re-added explicitly so the only net change to the resolved feature set is the removal of precomputed-tables. x25519 ECDH (variable-base) is unaffected; only fixed-base operations (key generation, Ed25519 signing) lose the precomputed-table speedup.
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.
Summary
vodozemacalready declaresdefault-features = falseoned25519-dalekandcurve25519-dalek, signaling it does not intend to require curve25519-dalek'sprecomputed-tablesfeature. Butx25519-dalekis declared with its defaults, and x25519-dalek's default set includesprecomputed-tables(default = ["alloc", "precomputed-tables", "zeroize"]).Because Cargo unifies features across the whole dependency graph, this single declaration silently re-enables
curve25519-dalek/precomputed-tablesfor the entire build — negating thedefault-features = falseon the other two dalek crates, and forcing the large precomputed basepoint lookup tables into every downstream binary, with no way for a downstream to opt out (Cargo has no mechanism to disable a transitively-requested feature).Change
allocis re-added explicitly so the only net change to the resolved feature set is the removal ofprecomputed-tables.Affected symbols
curve25519_dalek::…::ED25519_BASEPOINT_TABLE_INNER_DOC_HIDDENcurve25519_dalek::backend::vector::avx2::…::BASEPOINT_ODD_LOOKUP_TABLEMeasured impact
Measured on a downstream
cdylibthat links vodozemac (release:lto = true,opt-level = 3,codegen-units = 1, stripped):The downstream test suite (Olm session round-trips, pickling, KATs) passes unchanged —
precomputed-tablesis a pure size/speed trade with no behavioral effect.Tradeoff
Disabling
precomputed-tablesremoves the fixed-base scalar-multiplication speedup, which affects key generation (PublicKey::from(&StaticSecret)) and Ed25519 signing. It does not affect x25519 ECDH (variable-base — the hot Double Ratchet operation is unchanged). These fixed-base operations are not hot paths for typical messaging workloads, and this aligns vodozemac's actual behavior with what itsed25519-dalek/curve25519-dalekdeclarations already intend.If you'd prefer to keep the speedup as the default, an alternative is to expose it as an opt-in feature (e.g.
precomputed-tables = ["curve25519-dalek/precomputed-tables"]) so size-sensitive downstreams can leave it off. Happy to adjust the PR in whichever direction you prefer.