From 0d9e26833ac278dfd39b3306366f2713c8067bd7 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sun, 21 Jun 2020 17:39:46 +0200 Subject: [PATCH] Update to 0.9.0 Signed-off-by: Igor Raits --- .gitignore | 1 + 0001-Update-block-buffer-to-v0.9-164.patch | 85 ++++++++++++++++++++++ md-5-fix-metadata.diff | 20 ++--- rust-md-5.spec | 23 +++--- sources | 2 +- 5 files changed, 111 insertions(+), 20 deletions(-) create mode 100644 0001-Update-block-buffer-to-v0.9-164.patch diff --git a/.gitignore b/.gitignore index 004e88e..11a607b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /md-5-0.8.0.crate +/md-5-0.9.0.crate diff --git a/0001-Update-block-buffer-to-v0.9-164.patch b/0001-Update-block-buffer-to-v0.9-164.patch new file mode 100644 index 0000000..33680d9 --- /dev/null +++ b/0001-Update-block-buffer-to-v0.9-164.patch @@ -0,0 +1,85 @@ +From d24f26b1650156b1da4fced389559cee17805910 Mon Sep 17 00:00:00 2001 +From: Artyom Pavlov +Date: Wed, 10 Jun 2020 20:11:36 +0300 +Subject: [PATCH] Update block-buffer to v0.9 (#164) + +--- + src/lib.rs | 15 +++++++-------- + src/utils.rs | 7 ++++--- + 2 files changed, 11 insertions(+), 11 deletions(-) + +diff --git a/src/lib.rs b/src/lib.rs +index fce2081..3a02898 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -44,7 +44,6 @@ pub use digest::{self, Digest}; + + use crate::utils::compress; + +-use block_buffer::byteorder::{ByteOrder, LE}; + use block_buffer::BlockBuffer; + use digest::generic_array::typenum::{U16, U64}; + use digest::generic_array::GenericArray; +@@ -82,10 +81,9 @@ fn convert(d: &GenericArray) -> &[u8; 64] { + impl Md5 { + #[inline] + fn finalize_inner(&mut self) { +- let state = &mut self.state; ++ let s = &mut self.state; + let l = (self.length_bytes << 3) as u64; +- self.buffer +- .len64_padding::(l, |d| compress(state, convert(d))); ++ self.buffer.len64_padding_le(l, |d| compress(s, convert(d))); + } + } + +@@ -100,9 +98,8 @@ impl Update for Md5 { + // Unlike Sha1 and Sha2, the length value in MD5 is defined as + // the length of the message mod 2^64 - ie: integer overflow is OK. + self.length_bytes = self.length_bytes.wrapping_add(input.len() as u64); +- let self_state = &mut self.state; +- self.buffer +- .input(input, |d| compress(self_state, convert(d))); ++ let s = &mut self.state; ++ self.buffer.input_block(input, |d| compress(s, convert(d))); + } + } + +@@ -112,7 +109,9 @@ impl FixedOutputDirty for Md5 { + #[inline] + fn finalize_into_dirty(&mut self, out: &mut GenericArray) { + self.finalize_inner(); +- LE::write_u32_into(&self.state, out); ++ for (chunk, v) in out.chunks_exact_mut(4).zip(self.state.iter()) { ++ chunk.copy_from_slice(&v.to_le_bytes()); ++ } + } + } + +diff --git a/src/utils.rs b/src/utils.rs +index 8a946e7..9cd0259 100644 +--- a/src/utils.rs ++++ b/src/utils.rs +@@ -1,7 +1,6 @@ + #![allow(clippy::many_single_char_names)] +- + use crate::consts::RC; +-use block_buffer::byteorder::{ByteOrder, LE}; ++use core::convert::TryInto; + + #[inline(always)] + fn op_f(w: u32, x: u32, y: u32, z: u32, m: u32, c: u32, s: u32) -> u32 { +@@ -50,7 +49,9 @@ pub fn compress(state: &mut [u32; 4], input: &[u8; 64]) { + let mut d = state[3]; + + let mut data = [0u32; 16]; +- LE::read_u32_into(input, &mut data); ++ for (o, chunk) in data.iter_mut().zip(input.chunks_exact(4)) { ++ *o = u32::from_le_bytes(chunk.try_into().unwrap()); ++ } + + // round 1 + a = op_f(a, b, c, d, data[0], RC[0], 7); +-- +2.27.0 + diff --git a/md-5-fix-metadata.diff b/md-5-fix-metadata.diff index 254f5ce..c608708 100644 --- a/md-5-fix-metadata.diff +++ b/md-5-fix-metadata.diff @@ -1,11 +1,11 @@ ---- md-5-0.8.0/Cargo.toml 1970-01-01T00:00:00+00:00 -+++ md-5-0.8.0/Cargo.toml 2019-06-21T19:07:14.001271+00:00 -@@ -40,7 +40,7 @@ - features = ["dev"] +--- md-5-0.9.0/Cargo.toml 2020-06-10T02:13:43+00:00 ++++ md-5-0.9.0/Cargo.toml 2020-06-21T15:38:18.674929+00:00 +@@ -26,7 +26,7 @@ + [lib] + name = "md5" + [dependencies.block-buffer] +-version = "0.8" ++version = "0.9" - [dev-dependencies.hex-literal] --version = "0.1" -+version = "0.2" - - [features] - asm = ["md5-asm"] + [dependencies.digest] + version = "0.9" diff --git a/rust-md-5.spec b/rust-md-5.spec index a3fcc8c..a6fd212 100644 --- a/rust-md-5.spec +++ b/rust-md-5.spec @@ -1,12 +1,12 @@ -# Generated by rust2rpm 10 +# Generated by rust2rpm 15 %bcond_without check %global debug_package %{nil} %global crate md-5 Name: rust-%{crate} -Version: 0.8.0 -Release: 4%{?dist} +Version: 0.9.0 +Release: 1%{?dist} Summary: MD5 hash function # Upstream license specification: MIT OR Apache-2.0 @@ -14,8 +14,9 @@ License: MIT or ASL 2.0 URL: https://crates.io/crates/md-5 Source: %{crates_source} # Initial patched metadata -# * Update hex-literal to 0.2, https://github.com/RustCrypto/hashes/pull/85 +# * Update block-buffer to 0.9, https://github.com/RustCrypto/hashes/commit/d24f26b1650156b1da4fced389559cee17805910 Patch0: md-5-fix-metadata.diff +Patch0001: 0001-Update-block-buffer-to-v0.9-164.patch ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} @@ -40,7 +41,8 @@ which use "%{crate}" crate. %files devel %license LICENSE-MIT LICENSE-APACHE -%{cargo_registry}/%{crate}-%{version}/ +%doc README.md CHANGELOG.md +%{cargo_registry}/%{crate}-%{version_no_tilde}/ %package -n %{name}+default-devel Summary: %{summary} @@ -52,7 +54,7 @@ This package contains library source intended for building other packages which use "default" feature of "%{crate}" crate. %files -n %{name}+default-devel -%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %package -n %{name}+asm-devel Summary: %{summary} @@ -64,7 +66,7 @@ This package contains library source intended for building other packages which use "asm" feature of "%{crate}" crate. %files -n %{name}+asm-devel -%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %package -n %{name}+md5-asm-devel Summary: %{summary} @@ -76,7 +78,7 @@ This package contains library source intended for building other packages which use "md5-asm" feature of "%{crate}" crate. %files -n %{name}+md5-asm-devel -%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %package -n %{name}+std-devel Summary: %{summary} @@ -88,7 +90,7 @@ This package contains library source intended for building other packages which use "std" feature of "%{crate}" crate. %files -n %{name}+std-devel -%ghost %{cargo_registry}/%{crate}-%{version}/Cargo.toml +%ghost %{cargo_registry}/%{crate}-%{version_no_tilde}/Cargo.toml %prep %autosetup -n %{crate}-%{version_no_tilde} -p1 @@ -109,6 +111,9 @@ which use "std" feature of "%{crate}" crate. %endif %changelog +* Sun Jun 21 17:38:18 CEST 2020 Igor Raits - 0.9.0-1 +- Update to 0.9.0 + * Thu Jan 30 2020 Fedora Release Engineering - 0.8.0-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild diff --git a/sources b/sources index 2721b49..50a191c 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (md-5-0.8.0.crate) = f0baae0ede1dddb9be047f8d776fda2819980ece24e86da9d7bc4828308e53c4fa82597d416912ca115e75019518839a8edc076ba1e43686b0023aa559838a28 +SHA512 (md-5-0.9.0.crate) = 0d9adf778f78ee83dab2b30b282682350e93018c268f9eda4ebb846d0c1ea5ca54b6702a6bf0efe9d77634b50bc6cd515f4c0debcb956f2da07fa28fe94c1b53