Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sha: make compress consume blocks #579

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 28 additions & 92 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ opt-level = 2
[patch.crates-io]
# https://github.com/RustCrypto/traits/pull/1537 - Unreleased
digest = { git = "https://github.com/RustCrypto/traits.git" }

sha1 = { path = "./sha1" }
8 changes: 4 additions & 4 deletions sha1-checked/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sha1-checked"
version = "0.10.0"
version = "0.11.0-pre"
description = "SHA-1 hash function with collision detection"
authors = ["RustCrypto Developers"]
license = "MIT OR Apache-2.0"
Expand All @@ -18,12 +18,12 @@ exclude = [
]

[dependencies]
digest = "0.10.7"
sha1 = { version = "0.10.6", default-features = false, features = ["compress"] }
digest = "=0.11.0-pre.8"
sha1 = { version = "=0.11.0-pre.3", default-features = false }
zeroize = { version = "1.7", default-features = false, optional = true }

[dev-dependencies]
digest = { version = "0.10.7", features = ["dev"] }
digest = { version = "=0.11.0-pre.8", features = ["dev"] }
hex-literal = "0.4"

[features]
Expand Down
4 changes: 2 additions & 2 deletions sha1/src/compress.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::BLOCK_SIZE;
use crate::Block;

cfg_if::cfg_if! {
if #[cfg(feature = "force-soft")] {
Expand All @@ -22,6 +22,6 @@ cfg_if::cfg_if! {
}

/// SHA-1 compression function
pub fn compress(state: &mut [u32; 5], blocks: &[[u8; BLOCK_SIZE]]) {
pub fn compress(state: &mut [u32; 5], blocks: &[Block]) {
compress_inner(state, blocks);
}
4 changes: 3 additions & 1 deletion sha1/src/compress/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
//! SHA-1 `aarch64` backend.

use crate::Block;

// Per rustc target feature docs for `aarch64-unknown-linux-gnu` and
// `aarch64-apple-darwin` platforms, the `sha2` target feature enables
// SHA-1 as well:
//
// > Enable SHA1 and SHA256 support.
cpufeatures::new!(sha1_hwcap, "sha2");

pub fn compress(state: &mut [u32; 5], blocks: &[[u8; 64]]) {
pub fn compress(state: &mut [u32; 5], blocks: &[Block]) {
// TODO: Replace with https://github.com/rust-lang/rfcs/pull/2725
// after stabilization
if sha1_hwcap::get() {
Expand Down
Loading
Loading