Skip to content

sha2: refactor backends#802

Open
newpavlov wants to merge 1 commit intomasterfrom
sha2/refactor_backends
Open

sha2: refactor backends#802
newpavlov wants to merge 1 commit intomasterfrom
sha2/refactor_backends

Conversation

@newpavlov
Copy link
Member

@newpavlov newpavlov commented Mar 20, 2026

This PR reorganizes backends structure and related configuration flags. Now backends like x86_shani expose compress function marked with #[target_feature(enable = "...")] which has to be called using unsafe after an appropriate run-time or compile-time check. Autodetection is now handled by the (default) fallback cfg_if! branch instead of doing it in the backend modules. sha2_backend now forces selection of the specified backend and if necceccary checks at compile time whether target features required by the backend were properly enabled.

sha2_backend="soft-compact" and sha2_backend="riscv-zknh-compact" configuration flags are replaced by sha2_backend_soft="compact" and sha2_backend_riscv_zknh="compact" flags respectively.

TODO: update changelog and readme

@newpavlov newpavlov marked this pull request as ready for review March 20, 2026 13:13
@newpavlov newpavlov requested a review from tarcieri March 20, 2026 13:13
mod aarch64_sha2;
use aarch64_sha2::compress;
target_arch = "aarch64",
sha2_backend = "aarch64-sha3",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should introduce separate flags for SHA-256 and SHA-512 backends, i.e. sha2_sha256_backend and sha2_sha512_backend?

@newpavlov newpavlov force-pushed the sha2/refactor_backends branch from 1324c0f to 8bce044 Compare March 20, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants