diff --git a/.gitignore b/.gitignore index 2f0ef25..b60250c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /cookie-0.12.0.crate /cookie-0.14.2.crate /cookie-0.14.3.crate +/cookie-0.14.4.crate diff --git a/0001-port-to-crypto-mac-0.11.patch b/0001-port-to-crypto-mac-0.11.patch new file mode 100644 index 0000000..da2d358 --- /dev/null +++ b/0001-port-to-crypto-mac-0.11.patch @@ -0,0 +1,22 @@ +diff --git a/src/secure/signed.rs b/src/secure/signed.rs +index 2390f17..954866e 100644 +--- a/src/secure/signed.rs ++++ b/src/secure/signed.rs +@@ -33,7 +33,7 @@ impl<'a> SignedJar<'a> { + /// Signs the cookie's value providing integrity and authenticity. + fn sign_cookie(&self, cookie: &mut Cookie) { + // Compute HMAC-SHA256 of the cookie's value. +- let mut mac = Hmac::::new_varkey(&self.key).expect("good key"); ++ let mut mac = Hmac::::new_from_slice(&self.key).expect("good key"); + mac.update(cookie.value().as_bytes()); + + // Cookie's new value is [MAC | original-value]. +@@ -55,7 +55,7 @@ impl<'a> SignedJar<'a> { + let digest = base64::decode(digest_str).map_err(|_| "bad base64 digest")?; + + // Perform the verification. +- let mut mac = Hmac::::new_varkey(&self.key).expect("good key"); ++ let mut mac = Hmac::::new_from_slice(&self.key).expect("good key"); + mac.update(value.as_bytes()); + mac.verify(&digest) + .map(|_| value.to_string()) diff --git a/cookie-fix-metadata.diff b/cookie-fix-metadata.diff new file mode 100644 index 0000000..148ff5f --- /dev/null +++ b/cookie-fix-metadata.diff @@ -0,0 +1,25 @@ +--- cookie-0.14.4/Cargo.toml 1970-01-01T00:00:00+00:00 ++++ cookie-0.14.4/Cargo.toml 2021-08-24T20:57:01.612708+00:00 +@@ -24,7 +24,7 @@ + [package.metadata.docs.rs] + all-features = true + [dependencies.aes-gcm] +-version = "0.8.0" ++version = "0.9.0" + optional = true + + [dependencies.base64] +@@ -32,11 +32,11 @@ + optional = true + + [dependencies.hkdf] +-version = "0.10.0" ++version = "0.11.0" + optional = true + + [dependencies.hmac] +-version = "0.10.0" ++version = "0.11.0" + optional = true + + [dependencies.percent-encoding] diff --git a/rust-cookie.spec b/rust-cookie.spec index c9ffbe4..d075592 100644 --- a/rust-cookie.spec +++ b/rust-cookie.spec @@ -1,11 +1,11 @@ -# Generated by rust2rpm 15 +# Generated by rust2rpm 18 %bcond_without check %global debug_package %{nil} %global crate cookie Name: rust-%{crate} -Version: 0.14.3 +Version: 0.14.4 Release: %autorelease Summary: HTTP cookie parsing and cookie jar management @@ -13,6 +13,14 @@ Summary: HTTP cookie parsing and cookie jar management License: MIT or ASL 2.0 URL: https://crates.io/crates/cookie Source: %{crates_source} +# Initial patched metadata +# * bump aes-gcm from 0.8 to 0.9 +# * bump hkdf from 0.10 to 0.11 +# * bump hmac from 0.10 to 0.11 +Patch0: cookie-fix-metadata.diff +# * patch for crypto-mac API changes +# https://github.com/SergioBenitez/cookie-rs/commit/14b053a +Patch1: 0001-port-to-crypto-mac-0.11.patch ExclusiveArch: %{rust_arches} %if %{__cargo_skip_build} @@ -38,7 +46,7 @@ which use "%{crate}" crate. %files devel %license LICENSE-MIT LICENSE-APACHE -%doc README.md +%doc README.md CHANGELOG.md %{cargo_registry}/%{crate}-%{version_no_tilde}/ %package -n %{name}+default-devel @@ -202,17 +210,17 @@ which use "signed" feature of "%{crate}" crate. %cargo_prep %generate_buildrequires -%cargo_generate_buildrequires +%cargo_generate_buildrequires -a %build -%cargo_build +%cargo_build -a %install -%cargo_install +%cargo_install -a %if %{with check} %check -%cargo_test +%cargo_test -a %endif %changelog diff --git a/sources b/sources index e79f601..22ae260 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cookie-0.14.3.crate) = a675f92c3fd600214c0d142d96b320bbf0589c274cb5ae09b0c622b083bd605f65bb5afb399884de5105d2aeae4f94cf5a76b9cb7e9ac15f463b683b156103a7 +SHA512 (cookie-0.14.4.crate) = ce9c57c7a738ed5b772b0e6d6b1fe49ff2486eea366b5883c804939a8fe5fdc3969e325712388e0a0beeae1af4bd09f84c086765566c061da136c34a424f58ff