forked from pool/sha1collisiondetection
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
This commit is contained in:
parent
9668b3c141
commit
f89016b63f
74
sha1collisiondetection-1.0.3-io-fixes.patch
Normal file
74
sha1collisiondetection-1.0.3-io-fixes.patch
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
From: Andreas Stieger <astieger@suse.com>
|
||||||
|
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 <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
+#include <errno.h>
|
||||||
|
#include <libgen.h>
|
||||||
|
|
||||||
|
#include "sha1.h"
|
||||||
|
@@ -23,7 +24,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
|
if (argc < 2)
|
||||||
|
{
|
||||||
|
- printf("Usage: %s <file>\n", basename(argv[0]));
|
||||||
|
+ fprintf(stderr, "Usage: %s <file>\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
|
@ -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
|
Mon Apr 10 13:29:43 UTC 2017 - astieger@suse.com
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ License: MIT
|
|||||||
Group: Productivity/Security
|
Group: Productivity/Security
|
||||||
Url: https://github.com/cr-marcstevens/sha1collisiondetection
|
Url: https://github.com/cr-marcstevens/sha1collisiondetection
|
||||||
Source: https://github.com/cr-marcstevens/sha1collisiondetection/archive/stable-v%{version}.tar.gz#/%{name}-%{version}.tar.gz
|
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
|
BuildRequires: libtool
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
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
|
%prep
|
||||||
%setup -q -n %{name}-stable-v%{version}
|
%setup -q -n %{name}-stable-v%{version}
|
||||||
|
%patch0 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
export TARGETCFLAGS="%{optflags}"
|
export TARGETCFLAGS="%{optflags}"
|
||||||
|
Loading…
Reference in New Issue
Block a user