Subject: cryptsetup 2.0.2

From: Marius Bakke <[email-masked]>
Date: Wed, 28 Mar 2018 21:01:41 +0200

Guix,

This patch updates cryptsetup to the latest release.  It Works For Me™,
but I'd like others to try it on their systems before pushing.

The size of "cryptsetup-static" increases from 5 MiB to 11.2 MiB.  Not
sure why, json-c and argon2 are only a few 100 KiB each.  Thoughts?

From 8d00660fecb0c23c4ce0ca670979e9d1503eaf16 Mon Sep 17 00:00:00 2001
From: Marius Bakke <[email-masked]>
Date: Wed, 28 Mar 2018 20:57:40 +0200
Subject: [PATCH] gnu: cryptsetup: Update to 2.0.2.

* gnu/packages/cryptsetup.scm (cryptsetup): Update to 2.0.2.
[source](snippet): Delete bundled argon2.
[arguments]: Add #:configure-flags to use system argon2.
[inputs]: Add ARGON2 and JSON-C.
[native-inputs]: Add PKG-CONFIG.
(cryptsetup-static)[inputs]: Add ARGON2 and JSON-C.
[arguments]: Add "--enable-libargon2" to #:configure-flags.
---
 gnu/packages/cryptsetup.scm | 37 ++++++++++++++++++++++++++++++-------
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/cryptsetup.scm b/gnu/packages/cryptsetup.scm
index 9df26edc7..a12d238b2 100644
--- a/gnu/packages/cryptsetup.scm
+++ b/gnu/packages/cryptsetup.scm
@@ -25,14 +25,17 @@
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages gnupg)
+  #:use-module (gnu packages linux)
+  #:use-module (gnu packages password-utils)
+  #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages popt)
   #:use-module (gnu packages python)
-  #:use-module (gnu packages linux))
+  #:use-module (gnu packages web))
 
 (define-public cryptsetup
   (package
    (name "cryptsetup")
-   (version "1.7.5")
+   (version "2.0.2")
    (source (origin
             (method url-fetch)
             (uri (string-append "mirror://kernel.org/linux/utils/cryptsetup/v"
@@ -40,15 +43,30 @@
                                 "/" name "-" version ".tar.xz"))
             (sha256
              (base32
-              "1gail831j826lmpdx2gsc83lp3br6wfnwh3vqwxaa1nn1lfwsc1b"))))
+              "15wyjfgcqjf0wy5gxnmjj8aah33csv5v6n1hv9c8sxdzygbhb0ag"))
+            (modules '((guix build utils)))
+            (snippet
+             '(begin
+                ;; Delete bundled argon2 library.  Preserve the build files
+                ;; so that we don't trigger 'autoreconf'.
+                (for-each (lambda (file)
+                            (delete-file file))
+                          (find-files "lib/crypto_backend/argon2"
+                                      "(README|LICENSE|\\.[ch])$"))
+                #t))))
    (build-system gnu-build-system)
+   (arguments
+    `(#:configure-flags '("--enable-libargon2")))
    (inputs
-    `(("libgcrypt" ,libgcrypt)
+    `(("argon2" ,argon2)
+      ("json-c" ,json-c)
+      ("libgcrypt" ,libgcrypt)
       ("lvm2" ,lvm2)
       ("util-linux" ,util-linux)
       ("popt" ,popt)))
    (native-inputs
-    `(("python" ,python-wrapper)))
+    `(("pkg-config" ,pkg-config)
+      ("python" ,python-wrapper)))
    (synopsis "Hard disk encryption tool")
    (description
     "LUKS (Linux Unified Key Setup)/Cryptsetup provides a standard on-disk
@@ -80,6 +98,7 @@ files).  This assumes LIBRARY uses Libtool."
     (arguments
      '(#:configure-flags '("--disable-shared"
                            "--enable-static-cryptsetup"
+                           "--enable-libargon2"
 
                            ;; 'libdevmapper.a' pulls in libpthread, libudev and libm.
                            "LIBS=-ludev -pthread -lm")
@@ -109,7 +128,9 @@ files).  This assumes LIBRARY uses Libtool."
                                                                     ".static")
                                                      file)
                                         (remove-store-references file))
-                                      '("sbin/cryptsetup" "sbin/veritysetup"))
+                                      '("sbin/cryptsetup" "sbin/veritysetup"
+                                        "sbin/cryptsetup-reencrypt"
+                                        "sbin/integritysetup"))
                             #t))))))))
     (inputs
      (let ((libgcrypt-static
@@ -117,7 +138,9 @@ files).  This assumes LIBRARY uses Libtool."
               (inherit (static-library libgcrypt))
               (propagated-inputs
                `(("libgpg-error-host" ,(static-library libgpg-error)))))))
-       `(("libgcrypt" ,libgcrypt-static)
+       `(("argon2" ,argon2)
+         ("json-c" ,json-c)
+         ("libgcrypt" ,libgcrypt-static)
          ("lvm2" ,lvm2-static)
          ("util-linux" ,util-linux "static")
          ("util-linux" ,util-linux)
-- 
2.16.3