Add new feature use_sha for opt-in sha2 dependency - #2111
Conversation
|
Not sure what you mean about the feature situation. |
Your understanding is correct. I'll follow your suggest to make |
2cf810f to
90979c0
Compare
|
Done as you suggested. It would be a great help if you take another look on this. |
Introduce a new opt-in feature 'use_sha' to enable the 'sha2' dependency and use Sha256 for keymap hashing. It's enabled by default to keep the existing behavior. When 'use_sha' is disabled, a custom hash function using DefaultHasher is used instead, removing the dependency on 'sha2' crate. BREAKING CHANGE: If you're not using default feature (i.e. Use `--no-default-features`), then new hasing with built-in DefaultHasher would be used. Explicitly specify 'use_sha' feature to keep the old behavior. Tested: - cargo test --lib --no-default-features --features wayland_frontend (default, using builtin hash) - cargo test --lib --no-default-features --features wayland_frontend,use_sha (using Sha256) - Added 'test_keymap_file_creation' test to verify KeymapFile works.
90979c0 to
381f403
Compare
|
We might not need a Technically maybe a maliciously constructed keymap could be sent with |
Introduce a new opt-in feature 'use_sha' to enable the 'sha2' dependency and use
Sha256for keymap hashing.When 'use_sha' is disabled (default), a custom hash function using built-in
DefaultHasheris used instead, without 'sha2' dependency.BREAKING CHANGE: If you want to keep the old behavior (using Sha256), you must explicitly enable the 'use_sha' feature. This breaking change is necessary because Cargo does not support excluding dependencies when a feature is enabled (features are strictly additive), so the dependency must be opt-in.
Tested:
Description
This adds a new
use_shafeature and change default keymap id generation with chainingDefaultHasher.To keep the old behavior explicit feature
use_shais required.Note
This introduces breaking change. Tell me if you prefer not doing this, or completely remove the sha2 dependency
Motivation
sha2 crates brings huge dependency while smithay only uses it for generating good hash value.
It would be helpful to provide an option to opt-in the sha2 crate usage.
Existing Issue
#2110
I created the issue with bit more details.
Disclaimer about the AI uses
I haven't used AI for writing CL, but only used to proofread my commit message.
Checklist