[PATCH 0/4] Fix multiple hashcat issue.

DoneSubmitted by Maxime Devos.
Details
2 participants
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Severity
normal
M
M
Maxime Devos wrote on 3 Sep 14:04 +0200
(name . guix-patches@gnu.org)(address . guix-patches@gnu.org)
2fb077fe-19b5-bc02-fd36-4de31fe414fa@telenet.be
X-Debbugs-CC: Hendursaga <hendursaga@aol.com>
X-Debbugs-CC: ( <paren@disroot.org>
X-Debbugs-CC: Tobias Geerinckx-Rice <me@tobias.gr>
X-Debbugs-CC: Ludovic Courtès <ludo@gnu.org>
(^ people involved in #57187)
This patch series:
* Removed bundled libraries, except for LZMA-SDK for which I didn't
find a corresponding Guix package
* Makes hashcat cross-compilable, at least from an x86_64-linux-gnu to
an aarch64-linux-gnu
* Removes the embedded build time timestamp reported in
My current working tree is a bit dirty, so there will be a small rebase
conflict because of the 6.2.4->6.2.5 and a few imports will need to be
moved to the top of the file.
Greetings,
Maxime.
Attachment: file
Attachment: OpenPGP_signature
M
M
Maxime Devos wrote on 3 Sep 14:08 +0200
[PATCH 4/4] gnu: hashcat: Fix cross-compilation.
(address . 57560@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220903120827.25648-4-maximedevos@telenet.be
* gnu/packages/password-utils.scm
(hashcat)[native-inputs]: Move to ...
(hashcat)[inputs]: ... here.
(hashcat)[arguments]<#:make-flags>: Set AR and CC.
---
gnu/packages/password-utils.scm | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

Toggle diff (35 lines)
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 172f633449..f92c47d539 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -1110,8 +1110,8 @@ (define-public pass-rotate
 your online accounts makes it necessary.")
     (license license:expat)))
 
-;; XXX: move this import upwards before merging this patch
-(use-modules (gnu packages digest))
+;; XXX: move these imports upwards before merging this patch
+(use-modules (gnu packages digest) (guix utils))
 (define-public hashcat
   (package
     (name "hashcat")
@@ -1130,13 +1130,13 @@ (define-public hashcat
         ;; TODO: Unbundle LZMA-SDK as well
         #~(for-each delete-file-recursively
                     '("deps/zlib" "deps/xxHash" "deps/OpenCL-Headers")))))
-    (native-inputs
-     (list opencl-headers))
-    (inputs (list minizip xxhash zlib))
+    (inputs (list minizip opencl-headers xxhash zlib))
     (build-system gnu-build-system)
     (arguments
      (list #:tests? #f ;no tests
-           #:make-flags #~(list (string-append "PREFIX="
+           #:make-flags #~(list (string-append "AR=" #$(ar-for-target))
+                                (string-append "CC=" #$(cc-for-target))
+                                (string-append "PREFIX="
                                                #$output)
                                 (string-append "USE_SYSTEM_ZLIB=1")
                                 (string-append "USE_SYSTEM_OPENCL=1")
-- 
2.37.2
M
M
Maxime Devos wrote on 3 Sep 14:08 +0200
[PATCH 3/4] hashcat: Rewrite with G-exps.
(address . 57560@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220903120827.25648-3-maximedevos@telenet.be
This is required for cross-compilation, as %output does not exist when
cross-compiling.

* gnu/packages/password-utils.scm (hashcat)[arguments]: Rewrite with G-exps.
---
gnu/packages/password-utils.scm | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)

Toggle diff (41 lines)
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index ec4aff048a..172f633449 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -1135,21 +1135,19 @@ (define-public hashcat
     (inputs (list minizip xxhash zlib))
     (build-system gnu-build-system)
     (arguments
-     '(#:tests? #f                      ;no tests
-       #:make-flags (list (string-append "PREFIX=" %output)
-                          ;; TODO: unbundle
-                          ;; (string-append "USE_SYSTEM_LZMA=1")
-                          (string-append "USE_SYSTEM_ZLIB=1")
-                          (string-append "USE_SYSTEM_OPENCL=1")
-                          (string-append "USE_SYSTEM_XXHASH=1"))
-       #:phases
-       (modify-phases %standard-phases
-         ;; Don't embed timestamps, for bit-for-bit reproducibility.
-         (add-after 'unpack 'fix-reproducibility
-           (lambda _
-             (substitute* "src/Makefile"
-               (("\\$\\(shell date \\+%s\\)") "0"))))
-         (delete 'configure))))
+     (list #:tests? #f ;no tests
+           #:make-flags #~(list (string-append "PREFIX="
+                                               #$output)
+                                (string-append "USE_SYSTEM_ZLIB=1")
+                                (string-append "USE_SYSTEM_OPENCL=1")
+                                (string-append "USE_SYSTEM_XXHASH=1"))
+           #:phases #~(modify-phases %standard-phases
+                        (add-after 'unpack 'fix-reproducibility
+                          (lambda _
+                            (substitute* "src/Makefile"
+                              (("\\$\\(shell date \\+%s\\)")
+                               "0"))))
+                        (delete 'configure))))
     (home-page "https://hashcat.net/hashcat/")
     (synopsis "Advanced password recovery utility")
     (description "Hashcat is an password recovery utility, supporting five
-- 
2.37.2
M
M
Maxime Devos wrote on 3 Sep 14:08 +0200
[PATCH 2/4] hashcat: Unbundle everything but LZMA-SDK.
(address . 57560@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220903120827.25648-2-maximedevos@telenet.be
There does not appear to be a convenient Guix package for LZMA-SDK yet.
I currently have a bit of a dirty working tree (fiddling with imports), so the
use-modules is in the wrong place. Also, a small rebase conflict, the version
and source hash of hashcat has been updated.

* gnu/packages/password-utils.scm (hashcat)[source]{snippet}: Delete
everything from deps except for deps/LZMA-SDK.
(hashcat)[inputs]: Add minizip, xxhash and zlib.
(hashcat)[arguments]<#:make-flags>: Add USE_SYSTEM_ZLIB, USE_SYSTEM_OPENCL and
USE_SYSTEM_XXHASH.
---
gnu/packages/password-utils.scm | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)

Toggle diff (43 lines)
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index f64a205610..ec4aff048a 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -1110,6 +1110,8 @@ (define-public pass-rotate
 your online accounts makes it necessary.")
     (license license:expat)))
 
+;; XXX: move this import upwards before merging this patch
+(use-modules (gnu packages digest))
 (define-public hashcat
   (package
     (name "hashcat")
@@ -1121,13 +1123,25 @@ (define-public hashcat
                            version ".tar.gz"))
        (sha256
         (base32
-         "104z63m7lqbb0sdrxhf9yi15l4a9zwf9m6zs9dbb3gf0nfxl1h9r"))))
+         "104z63m7lqbb0sdrxhf9yi15l4a9zwf9m6zs9dbb3gf0nfxl1h9r"))
+       (modules '((guix build utils)))
+       ;; Delete bundled libraries.
+       (snippet
+        ;; TODO: Unbundle LZMA-SDK as well
+        #~(for-each delete-file-recursively
+                    '("deps/zlib" "deps/xxHash" "deps/OpenCL-Headers")))))
     (native-inputs
      (list opencl-headers))
+    (inputs (list minizip xxhash zlib))
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f                      ;no tests
-       #:make-flags (list (string-append "PREFIX=" %output))
+       #:make-flags (list (string-append "PREFIX=" %output)
+                          ;; TODO: unbundle
+                          ;; (string-append "USE_SYSTEM_LZMA=1")
+                          (string-append "USE_SYSTEM_ZLIB=1")
+                          (string-append "USE_SYSTEM_OPENCL=1")
+                          (string-append "USE_SYSTEM_XXHASH=1"))
        #:phases
        (modify-phases %standard-phases
          ;; Don't embed timestamps, for bit-for-bit reproducibility.
-- 
2.37.2
M
M
Maxime Devos wrote on 3 Sep 14:08 +0200
[PATCH 1/4] hashcat: Don't embed timestamp, fixing reproducibility.
(address . 57560@debbugs.gnu.org)(name . Maxime Devos)(address . maximedevos@telenet.be)
20220903120827.25648-1-maximedevos@telenet.be
* gnu/packages/password-utils.scm (hashcat)[arguments]{#:phases}:
Remove timestamp, fixing reproducibility.
---
gnu/packages/password-utils.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (65 lines)
diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 0069fdd74c..f64a205610 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -35,6 +35,7 @@
 ;;; Copyright © 2020 Hartmut Goebel <h.goebel@crazy-compilers.com>
 ;;; Copyright © 2021 David Dashyan <mail@davie.li>
 ;;; Copyright © 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1129,6 +1130,11 @@ (define-public hashcat
        #:make-flags (list (string-append "PREFIX=" %output))
        #:phases
        (modify-phases %standard-phases
+         ;; Don't embed timestamps, for bit-for-bit reproducibility.
+         (add-after 'unpack 'fix-reproducibility
+           (lambda _
+             (substitute* "src/Makefile"
+               (("\\$\\(shell date \\+%s\\)") "0"))))
          (delete 'configure))))
     (home-page "https://hashcat.net/hashcat/")
     (synopsis "Advanced password recovery utility")

base-commit: 57f8f69562e942557e3331bb81c7e4acd973d189
prerequisite-patch-id: 78c06b38a189109a5108a157d39ffe7eab8be109
prerequisite-patch-id: aaf0731113d36df901ed2186975e3bb872ec22c0
prerequisite-patch-id: 28e8223cfd59adf84007db9ceefd8a78c41fd10d
prerequisite-patch-id: fb73228d99c36f50e2959c2303c7c707460fd147
prerequisite-patch-id: 7626f1464f4926416fb13daf3d846176aa93f51b
prerequisite-patch-id: 445c6f624e99627959f2e54a6ee97337c44d9ea6
prerequisite-patch-id: 7a16c500faec9d58700a2b50b26bded079e9c3ac
prerequisite-patch-id: f7d406c61e069c04c3b7da453192f51c04763db1
prerequisite-patch-id: 4674bf40052d97215f837c9dfd4e7e1ae999492d
prerequisite-patch-id: 6259468375bfa157277521b17fdd97d6ab0748b7
prerequisite-patch-id: 9d14b38a33b68883c43d6b26dcdbdf7c28e417e7
prerequisite-patch-id: f0e3faffe768e9c660b0a9340042acfa0f790308
prerequisite-patch-id: 550485506255a67c0a1cb9ede7778d4d538b6e2a
prerequisite-patch-id: 9282e95ff076cc2c742be8d2fede83ac14006f6f
prerequisite-patch-id: 1503aa5c698f72ee47b7a987a95c0919efb203c4
prerequisite-patch-id: 24297940086a3780fd7e2e7fa345f262b12efb6f
prerequisite-patch-id: c5f647b5472465666328b123f0f314a6138d6293
prerequisite-patch-id: 56386c4df9130221cad664ec161d1ad9713f4dc3
prerequisite-patch-id: f09ccfb7e53bc7934326af603a197344f4ef53f3
prerequisite-patch-id: 0c18c83d1f2da4639b43861103a028706a147022
prerequisite-patch-id: 066bfca8bf0c3d3bc57a14b48aa1e241555c1e86
prerequisite-patch-id: 13d9ac7b0fadc92b9351409df26b41443497a964
prerequisite-patch-id: ad831a04543475288aba1c938078dcc5ad05870e
prerequisite-patch-id: ed9ec2d0bea23c2c2dbfa4c62290893f1a938f7f
prerequisite-patch-id: 335ce9dbbb2b36b960203a79fdc8f6033ebda2fb
prerequisite-patch-id: f2ca362056369913d0b8319187a8f46ea78b6dc7
prerequisite-patch-id: c02a17479ad4e01837fc307cf6defe0ae92e2435
prerequisite-patch-id: 3a794307f3bbd3641023d978f4b359eb2f5a46e4
prerequisite-patch-id: c545007535db365a29dc3a86e10866f5eef7b7d5
prerequisite-patch-id: 8b8fd18762282129e2d034f7cdceb368f53295d6
prerequisite-patch-id: d435d42bafa65f14049740a3d6cf1a163f855f97
prerequisite-patch-id: 27da1b857019b217b25b6795b84577fdc992a84c
prerequisite-patch-id: aef95e76144ae5e92a41f81b11e84ddc7ececd91
prerequisite-patch-id: 95aa6b45d93026e4375b53a471f0f96e2016914e
prerequisite-patch-id: 715d2bb93fe711e72388458846a0afde6babdc97
prerequisite-patch-id: 1851b8f26420465ac59f7447d9c8bd6698b77130
prerequisite-patch-id: 2bd6d4b30b6c71edef4bc6286a290f8eac5c18bd
-- 
2.37.2
L
L
Ludovic Courtès wrote on 4 Sep 23:08 +0200
Re: bug#57560: [PATCH 0/4] Fix multiple hashcat issue.
(name . Maxime Devos)(address . maximedevos@telenet.be)
87o7vusv9f.fsf@gnu.org
Hi,

Maxime Devos <maximedevos@telenet.be> skribis:

Toggle quote (5 lines)
> X-Debbugs-CC: Hendursaga <hendursaga@aol.com>
> X-Debbugs-CC: ( <paren@disroot.org>
> X-Debbugs-CC: Tobias Geerinckx-Rice <me@tobias.gr>
> X-Debbugs-CC: Ludovic Courtès <ludo@gnu.org>

That didn’t work. :-)

Toggle quote (9 lines)
> This patch series:
>
> * Removed bundled libraries, except for LZMA-SDK for which I didn't
> find a corresponding Guix package
> * Makes hashcat cross-compilable, at least from an x86_64-linux-gnu to
> an aarch64-linux-gnu
> * Removes the embedded build time timestamp reported in
> <https://guix.gnu.org/57187>.

Perfect! I’ve applied it all.

Toggle quote (4 lines)
> My current working tree is a bit dirty, so there will be a small
> rebase conflict because of the 6.2.4->6.2.5 and a few imports will
> need to be moved to the top of the file.

Right, I had to fiddle quite a bit with the patches to get them to
apply.

Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

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