From f89016b63fdf6c85b6acfb42391686ec99cdfcb3ab9181190c799385652222f7 Mon Sep 17 00:00:00 2001 From: Andreas Stieger Date: Mon, 22 May 2017 16:22:08 +0000 Subject: [PATCH] Accepting request 497348 from home:AndreasStieger:branches:security - better printing of errors, and allow hashing stdin add sha1collisiondetection-1.0.3-io-fixes.patch OBS-URL: https://build.opensuse.org/request/show/497348 OBS-URL: https://build.opensuse.org/package/show/security/sha1collisiondetection?expand=0&rev=7 --- sha1collisiondetection-1.0.3-io-fixes.patch | 74 +++++++++++++++++++++ sha1collisiondetection.changes | 6 ++ sha1collisiondetection.spec | 2 + 3 files changed, 82 insertions(+) create mode 100644 sha1collisiondetection-1.0.3-io-fixes.patch diff --git a/sha1collisiondetection-1.0.3-io-fixes.patch b/sha1collisiondetection-1.0.3-io-fixes.patch new file mode 100644 index 0000000..4553ee0 --- /dev/null +++ b/sha1collisiondetection-1.0.3-io-fixes.patch @@ -0,0 +1,74 @@ +From: Andreas Stieger +Date: Mon, 8 May 2017 21:51:28 +0200 +Subject: some IO improvements +References: https://github.com/cr-marcstevens/sha1collisiondetection/pull/28 + +--- + src/main.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +Index: sha1collisiondetection-stable-v1.0.3/src/main.c +=================================================================== +--- sha1collisiondetection-stable-v1.0.3.orig/src/main.c 2017-05-22 18:17:51.339889238 +0200 ++++ sha1collisiondetection-stable-v1.0.3/src/main.c 2017-05-22 18:18:14.471988044 +0200 +@@ -8,6 +8,7 @@ + #include + #include + #include ++#include + #include + + #include "sha1.h" +@@ -23,7 +24,7 @@ int main(int argc, char** argv) + + if (argc < 2) + { +- printf("Usage: %s \n", basename(argv[0])); ++ fprintf(stderr, "Usage: %s \n", basename(argv[0])); + return 1; + } + +@@ -37,10 +38,14 @@ int main(int argc, char** argv) + SHA1DCSetDetectReducedRoundCollision(&ctx2, 1); + } + +- fd = fopen(argv[i], "rb"); ++ if(!strcmp(argv[i],"-")) { ++ fd = stdin; ++ } else { ++ fd = fopen(argv[i], "rb"); ++ } + if (fd == NULL) + { +- printf("cannot open file: %s\n", argv[i]); ++ fprintf(stderr, "cannot open file: %s: %s\n", argv[i], strerror(errno)); + return 1; + } + +@@ -53,12 +58,12 @@ int main(int argc, char** argv) + } + if (ferror(fd)) + { +- printf("error while reading file: %s\n", argv[i]); ++ fprintf(stderr, "error while reading file: %s: %s\n", argv[i], strerror(errno)); + return 1; + } + if (!feof(fd)) + { +- printf("not end of file?: %s\n",argv[i]); ++ fprintf(stderr, "not end of file?: %s: %s\n", argv[i], strerror(errno)); + return 1; + } + +Index: sha1collisiondetection-stable-v1.0.3/README.md +=================================================================== +--- sha1collisiondetection-stable-v1.0.3.orig/README.md 2017-05-22 18:17:51.339889238 +0200 ++++ sha1collisiondetection-stable-v1.0.3/README.md 2017-05-22 18:17:54.539902741 +0200 +@@ -51,6 +51,7 @@ Examples: + ``` + bin/sha1dcsum test/sha1_reducedsha_coll.bin test/shattered-1.pdf + bin/sha1dcsum_partialcoll test/sha1reducedsha_coll.bin test/shattered-1.pdf ++pipe_data | bin/sha1dcsum - + ``` + + ## Library usage diff --git a/sha1collisiondetection.changes b/sha1collisiondetection.changes index fdca582..a63a206 100644 --- a/sha1collisiondetection.changes +++ b/sha1collisiondetection.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon May 22 16:20:43 UTC 2017 - astieger@suse.com + +- better printing of errors, and allow hashing stdin + add sha1collisiondetection-1.0.3-io-fixes.patch + ------------------------------------------------------------------- Mon Apr 10 13:29:43 UTC 2017 - astieger@suse.com diff --git a/sha1collisiondetection.spec b/sha1collisiondetection.spec index e3c098b..b4ea56e 100644 --- a/sha1collisiondetection.spec +++ b/sha1collisiondetection.spec @@ -25,6 +25,7 @@ License: MIT Group: Productivity/Security Url: https://github.com/cr-marcstevens/sha1collisiondetection Source: https://github.com/cr-marcstevens/sha1collisiondetection/archive/stable-v%{version}.tar.gz#/%{name}-%{version}.tar.gz +Patch0: sha1collisiondetection-1.0.3-io-fixes.patch BuildRequires: libtool BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -59,6 +60,7 @@ It is very fast and takes less than twice the amount of time as regular SHA-1. %prep %setup -q -n %{name}-stable-v%{version} +%patch0 -p1 %build export TARGETCFLAGS="%{optflags}"