[PATCH] gnu: Add hash-extender.

DoneSubmitted by Jakub Kądziołka.
Details
2 participants
  • Jakub Kądziołka
  • Leo Famulari
Owner
unassigned
Severity
normal
J
J
Jakub Kądziołka wrote on 20 Mar 2020 20:32
(address . guix-patches@gnu.org)
20200320193250.31290-1-kuba@kadziolka.net
* gnu/packages/crypto.scm (hash-extender): New variable.
---
gnu/packages/crypto.scm | 39 +++++++++++++++++++
.../patches/hash-extender-test-suite.patch | 12 ++++++
2 files changed, 51 insertions(+)
create mode 100644 gnu/packages/patches/hash-extender-test-suite.patch

Toggle diff (67 lines)
diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index b808211b2d..9aa9a73503 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -1072,3 +1072,42 @@ cryptographic ratchet.  It is written in C and C++11, and exposed as a C
 API.")
     (home-page "https://matrix.org/docs/projects/other/olm/")
     (license license:asl2.0)))
+
+(define-public hash-extender
+  (let ((commit "9ecef26809a1ceea2a455f6f591b004298df551b")
+        (revision "1"))
+    (package
+      (name "hash-extender")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/iagox86/hash_extender")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "0fqy3d559zgf71w39py0931d8na0ylils45r8zs6r79wgr6qn78c"))
+                (file-name (git-file-name name version))
+                (patches
+                  (search-patches "hash-extender-test-suite.patch"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'check
+             (lambda _
+               (invoke "./hash_extender_test")))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((outdir (assoc-ref outputs "out"))
+                      (bindir (string-append outdir "/bin")))
+                 (install-file "hash_extender" bindir)))))))
+      (inputs
+       `(("openssl" ,openssl)))
+      (synopsis "Tool for hash length extension attacks")
+      (description "@command{hash_extender} is a utility for performing hash
+length extension attacks supporting MD4, MD5, RIPEMD-160, SHA-0, SHA-1,
+SHA-256, SHA-512, and WHIRLPOOL hashes.")
+      (home-page "https://github.com/iagox86/hash_extender")
+      (license license:bsd-3))))
diff --git a/gnu/packages/patches/hash-extender-test-suite.patch b/gnu/packages/patches/hash-extender-test-suite.patch
new file mode 100644
index 0000000000..a3e6218944
--- /dev/null
+++ b/gnu/packages/patches/hash-extender-test-suite.patch
@@ -0,0 +1,12 @@
+Make the test suite exit with a non-zero exit code if some tests failed.
+--- a/test.c
++++ b/test.c
+@@ -79,5 +79,9 @@ void test_report(void)
+     printf("TESTS PASSED: %d / %d [%2.4f%%]\n", tests_passed, tests_run, 100 * (float)tests_passed / tests_run);
+     printf("--------------------------------------------------------------------------------\n");
+   }
++
++  if (tests_passed != tests_run) {
++      exit(1);
++  }
+ }
-- 
2.25.1
L
L
Leo Famulari wrote on 20 Mar 2020 21:21
(name . Jakub Kądziołka)(address . kuba@kadziolka.net)(address . 40154@debbugs.gnu.org)
20200320202103.GA8474@jasmine.lan
On Fri, Mar 20, 2020 at 08:32:49PM +0100, Jakub Kądziołka wrote:
Toggle quote (2 lines)
> * gnu/packages/crypto.scm (hash-extender): New variable.

Thanks!

Toggle quote (4 lines)
> ---
> gnu/packages/crypto.scm | 39 +++++++++++++++++++
> .../patches/hash-extender-test-suite.patch | 12 ++++++

Remember to register the patch file in 'gnu/local.mk' and mention it in
the commit message.

Toggle quote (6 lines)
> + (replace 'install
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let* ((outdir (assoc-ref outputs "out"))
> + (bindir (string-append outdir "/bin")))
> + (install-file "hash_extender" bindir)))))))

Can you install the README.md too? It would go under something like:
(string-append "share/doc/hash-extender" ,version "/")

... so that it fits correctly in the user's profile.

Toggle quote (2 lines)
> diff --git a/gnu/packages/patches/hash-extender-test-suite.patch b/gnu/packages/patches/hash-extender-test-suite.patch

And I would consider submitting this patch upstream.
J
J
Jakub Kądziołka wrote on 21 Mar 2020 13:07
(name . Leo Famulari)(address . leo@famulari.name)(address . 40154-done@debbugs.gnu.org)
20200321120755.yzi6ktwlwcnm4k4p@gravity
On Fri, Mar 20, 2020 at 04:21:03PM -0400, Leo Famulari wrote:
Toggle quote (8 lines)
> On Fri, Mar 20, 2020 at 08:32:49PM +0100, Jakub Kądziołka wrote:
> > ---
> > gnu/packages/crypto.scm | 39 +++++++++++++++++++
> > .../patches/hash-extender-test-suite.patch | 12 ++++++
>
> Remember to register the patch file in 'gnu/local.mk' and mention it in
> the commit message.

Ugh, I always forget to do this, even though I always notice it's
missing when I'm *reviewing* patches.

Toggle quote (11 lines)
> > + (replace 'install
> > + (lambda* (#:key outputs #:allow-other-keys)
> > + (let* ((outdir (assoc-ref outputs "out"))
> > + (bindir (string-append outdir "/bin")))
> > + (install-file "hash_extender" bindir)))))))
>
> Can you install the README.md too? It would go under something like:
> (string-append "share/doc/hash-extender" ,version "/")
>
> ... so that it fits correctly in the user's profile.

Huh. For a moment I thought the version is pointless here, but then I
noticed the LICENSE file. I did as suggested, though with a dash before the
version.

Toggle quote (4 lines)
> > diff --git a/gnu/packages/patches/hash-extender-test-suite.patch b/gnu/packages/patches/hash-extender-test-suite.patch
>
> And I would consider submitting this patch upstream.

Good idea!

Thanks for your review! Amended patch pushed as
bbeb710de70521010b3d432cb5b4b14ce6e45ca6.
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl52A5YACgkQ4xWnWEYT
FWQ9BA//SBrN2nsC4FsTea+wmnc0mPcRO9hUTtZYuVPcyGWBGLaaDd4+9XJdboHD
OUtka4qUgYx9GYgv3pjBJ2s5CPTE3RlKFwFDjQ67TU4bkImvli9lOgSs3ePPxI8m
pebBLvjM6wpoKfJGDd6Mmr5Gkm6FAhT6JMgH/PqCP4nSiaBMv61HrNZh/AFIm6x3
1B+WiyGYW3zTL6gzqj1GsdidTuxdxRHyEUtrhzCUb2x4T2M6ABvLrXgqTV/awdTF
ushVxB3GYugw70oZJ/sdrRHpS7UQGLhssLOA3mRtPfy0xdKWNYdiIk9L4MKWAM7x
7vtS1pzahIJOOFzCe8RzB5mVwH3ZXPu0ioYdQHtUodOafDlwoCPEeImjcv9YioKj
83Wb5P/7R4bjvJmCA9lRRUWMEy82/P/HGWpDHQoBl1BEK36EFclsYSAQn950HyCl
XJg6Xnkk44vESYWGkDMM6cumnMK2jw7OvpjAnOokQ6HWv87U7kA88M4pDjaM5nWY
qSr3BFg4f9LI9IbgluBvV6NnLE3pgPqA1XiTaxdt9VAGJR4FhlS1UqCL5ZfeLKEc
hCSYw7r3PihBI5Id5psbRLIQ3ZBQbMTYdQzzM8uHZ83tqbGt5iY+JkEVrnrXN8rB
cGbK7U59z+i5xoJzBBd1by/gx5wEoMmb95nk6hOgZfyc7aVhTZw=
=Or5S
-----END PGP SIGNATURE-----


Closed
?
Your comment

This issue is archived.

To comment on this conversation send email to 40154@debbugs.gnu.org