parent
8bae07cc8e
commit
de464d1541
@ -0,0 +1 @@
|
|||||||
|
/crypto-hash-0.3.0.crate
|
@ -0,0 +1,64 @@
|
|||||||
|
From d47183116ab10b53703c999eb0eccc85f6e1f89d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Mark Lee <crypto-hash@lazymalevolence.com>
|
||||||
|
Date: Sun, 26 Nov 2017 18:14:13 -0800
|
||||||
|
Subject: [PATCH] Upgrade to hex 0.3
|
||||||
|
|
||||||
|
(cherry picked from commit 7036d94acc843e2a03d14d7c47de352a7be411cb)
|
||||||
|
---
|
||||||
|
src/lib.rs | 3 +--
|
||||||
|
src/test.rs | 6 +++---
|
||||||
|
2 files changed, 4 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/lib.rs b/src/lib.rs
|
||||||
|
index 3e6f6cd..7bc8e30 100644
|
||||||
|
--- a/src/lib.rs
|
||||||
|
+++ b/src/lib.rs
|
||||||
|
@@ -53,7 +53,6 @@ extern crate openssl;
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
extern crate winapi;
|
||||||
|
|
||||||
|
-use hex::ToHex;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
@@ -118,5 +117,5 @@ pub fn digest(algorithm: Algorithm, data: &[u8]) -> Vec<u8> {
|
||||||
|
/// assert_eq!(expected, result)
|
||||||
|
/// ```
|
||||||
|
pub fn hex_digest(algorithm: Algorithm, data: &[u8]) -> String {
|
||||||
|
- digest(algorithm, data).to_hex()
|
||||||
|
+ hex::encode(digest(algorithm, data))
|
||||||
|
}
|
||||||
|
diff --git a/src/test.rs b/src/test.rs
|
||||||
|
index 31920c4..2e1ef90 100644
|
||||||
|
--- a/src/test.rs
|
||||||
|
+++ b/src/test.rs
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
|
||||||
|
#![cfg(test)]
|
||||||
|
|
||||||
|
-use hex::ToHex;
|
||||||
|
+use hex;
|
||||||
|
use std::io::Write;
|
||||||
|
use super::{Algorithm, Hasher, hex_digest};
|
||||||
|
|
||||||
|
@@ -59,7 +59,7 @@ fn sha512_empty_string() {
|
||||||
|
#[test]
|
||||||
|
fn hasher_sans_write() {
|
||||||
|
let mut hasher = Hasher::new(Algorithm::MD5);
|
||||||
|
- let actual = hasher.finish().to_hex();
|
||||||
|
+ let actual = hex::encode(hasher.finish());
|
||||||
|
assert_eq!(MD5_EMPTY_STRING, actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -69,7 +69,7 @@ fn hasher_with_write() {
|
||||||
|
hasher
|
||||||
|
.write_all(TO_HASH.as_bytes())
|
||||||
|
.expect("Could not write to hasher");
|
||||||
|
- let actual = hasher.finish().to_hex();
|
||||||
|
+ let actual = hex::encode(hasher.finish());
|
||||||
|
assert_eq!(TO_HASH_MD5, actual)
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.15.1
|
||||||
|
|
@ -0,0 +1,26 @@
|
|||||||
|
From 962774effab9b47b52ae69bcafaa31006769452c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Alexandra Nikandrova <rage.iz.me@gmail.com>
|
||||||
|
Date: Sat, 13 Jan 2018 18:28:48 +0100
|
||||||
|
Subject: [PATCH] deps: update openssl to 0.10
|
||||||
|
|
||||||
|
Signed-off-by: Alexandra Nikandrova <rage.iz.me@gmail.com>
|
||||||
|
---
|
||||||
|
src/imp/openssl.rs | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/imp/openssl.rs b/src/imp/openssl.rs
|
||||||
|
index ba573c4..f786f62 100644
|
||||||
|
--- a/src/imp/openssl.rs
|
||||||
|
+++ b/src/imp/openssl.rs
|
||||||
|
@@ -65,7 +65,7 @@ impl Hasher {
|
||||||
|
/// Generate a digest from the data written to the `Hasher`.
|
||||||
|
pub fn finish(&mut self) -> Vec<u8> {
|
||||||
|
let Hasher(ref mut hasher) = *self;
|
||||||
|
- match hasher.finish2() {
|
||||||
|
+ match hasher.finish() {
|
||||||
|
Ok(digest) => digest.to_vec(),
|
||||||
|
Err(error_stack) => panic!("OpenSSL error(s): {}", error_stack),
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.15.1
|
||||||
|
|
@ -0,0 +1,19 @@
|
|||||||
|
--- crypto-hash-0.3.0/Cargo.toml 2017-06-18T22:54:02+02:00
|
||||||
|
+++ crypto-hash-0.3.0/Cargo.toml 2018-01-14T23:37:00.761487+01:00
|
||||||
|
@@ -18,14 +18,7 @@
|
||||||
|
appveyor = { repository = "malept/crypto-hash" }
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
-hex = "0.2"
|
||||||
|
-
|
||||||
|
-[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
|
-commoncrypto = "0.2"
|
||||||
|
-
|
||||||
|
-[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
|
-advapi32-sys = "0.2"
|
||||||
|
-winapi = "0.2"
|
||||||
|
+hex = "0.3"
|
||||||
|
|
||||||
|
[target.'cfg(not(any(target_os = "windows", target_os = "macos")))'.dependencies]
|
||||||
|
-openssl = "0.9"
|
||||||
|
+openssl = "0.10"
|
@ -0,0 +1,68 @@
|
|||||||
|
# Generated by rust2rpm
|
||||||
|
%bcond_without check
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
%global crate crypto-hash
|
||||||
|
|
||||||
|
Name: rust-%{crate}
|
||||||
|
Version: 0.3.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: Wrapper for OS-level cryptographic hash functions
|
||||||
|
|
||||||
|
License: MIT
|
||||||
|
URL: https://crates.io/crates/crypto-hash
|
||||||
|
Source0: https://crates.io/api/v1/crates/%{crate}/%{version}/download#/%{crate}-%{version}.crate
|
||||||
|
# Initial patched metadata
|
||||||
|
# * No windows/osx
|
||||||
|
# * Bump hex to 0.3, https://github.com/malept/crypto-hash/commit/7036d94acc843e2a03d14d7c47de352a7be411cb
|
||||||
|
# * Bump openssl to 0.10, https://github.com/malept/crypto-hash/pull/1
|
||||||
|
Patch0: crypto-hash-0.3.0-fix-metadata.diff
|
||||||
|
# Make it work with hex v0.3
|
||||||
|
Patch1: 0001-Upgrade-to-hex-0.3.patch
|
||||||
|
# Make it work with openssl v0.10
|
||||||
|
Patch2: 0001-deps-update-openssl-to-0.10.patch
|
||||||
|
|
||||||
|
ExclusiveArch: %{rust_arches}
|
||||||
|
|
||||||
|
BuildRequires: rust-packaging
|
||||||
|
# [dependencies]
|
||||||
|
BuildRequires: (crate(hex) >= 0.3.0 with crate(hex) < 0.4.0)
|
||||||
|
BuildRequires: (crate(openssl) >= 0.10.0 with crate(openssl) < 0.11.0)
|
||||||
|
|
||||||
|
%description
|
||||||
|
%{summary}.
|
||||||
|
|
||||||
|
%package devel
|
||||||
|
Summary: %{summary}
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description devel
|
||||||
|
A wrapper for OS-level cryptographic hash functions.
|
||||||
|
|
||||||
|
This package contains library source intended for building other packages
|
||||||
|
which use %{crate} from crates.io.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n %{crate}-%{version} -p1
|
||||||
|
%cargo_prep
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cargo_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%cargo_install
|
||||||
|
|
||||||
|
%if %{with check}
|
||||||
|
%check
|
||||||
|
%cargo_test
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%files devel
|
||||||
|
%license LICENSE
|
||||||
|
%doc CONTRIBUTING.md NEWS.md README.md
|
||||||
|
%{cargo_registry}/%{crate}-%{version}/
|
||||||
|
%exclude %{cargo_registry}/%{crate}-%{version}/Makefile
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Fri Jan 12 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.3.0-1
|
||||||
|
- Initial package
|
Loading…
Reference in new issue