Subject: Re: [bug#51024] [PATCH] gnu: veracrypt: New package

From: Maxime Devos <[email-masked]>
Date: Tue, 05 Oct 2021 09:43:09 +0200

Ryan Sundberg via Guix-patches via schreef op ma 04-10-2021 om 23:54 [-0700]:
> Adds a package for the Veracrypt disk encrption program
> 
> * gnu/packages/crypto.scm: Add veracrypt
> ---
>  gnu/packages/crypto.scm | 49 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
> 
> diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
> index af1412c44e..42c9916582 100644
> --- a/gnu/packages/crypto.scm
> +++ b/gnu/packages/crypto.scm
> @@ -43,6 +43,7 @@
>    #:use-module (gnu packages admin)
>    #:use-module (gnu packages aidc)
>    #:use-module (gnu packages attr)
> +  #:use-module (gnu packages assembly)
>    #:use-module (gnu packages autotools)
>    #:use-module (gnu packages boost)
>    #:use-module (gnu packages check)
> @@ -80,6 +81,7 @@
>    #:use-module (gnu packages tcl)
>    #:use-module (gnu packages tls)
>    #:use-module (gnu packages version-control)
> +  #:use-module (gnu packages wxwidgets)
>    #:use-module (gnu packages xml)
>    #:use-module ((guix licenses) #:prefix license:)
>    #:use-module (guix packages)
> @@ -1462,3 +1464,50 @@ via FUSE without root permissions.  It is similar to EncFS, but provides
>  additional security and privacy measures such as hiding file sizes and directory
>  structure.  However CryFS is not considered stable yet by the developers.")
>      (license license:lgpl3+)))
> +
> +(define-public veracrypt
> +  (package
> +    (name "veracrypt")
> +    (version "1.24")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +             "https://www.veracrypt.fr/code/VeraCrypt/snapshot/VeraCrypt_"
> +             version ".tar.gz"))

On <https://veracrypt.fr/en/Home.html>, I see there's a version
VeraCrypt 1.24-Update8 with bug fixes.

> +       (sha256
> +        (base32 "0nn44x7ldkblgkndrd726nkil5bsdaki7j11xi21pr1gjrp7kq2g"))))
> +    (build-system gnu-build-system)
> +    (arguments
> +      '(#:phases
> +        (modify-phases %standard-phases
> +          (delete 'configure)
> +          (add-before 'build 'build-env
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (chdir "src")
> +              (setenv "CC" "gcc")

I'm surprised (setenv "CC" "gcc") was necessary, because src/Makefile
sets "export CC ?= gcc".

Use (cc-for-target) instead of "gcc" to make veracrypt cross-compilable.
The makefile uses "g++" in some places, shis might need to be (g++-for-target)
instead.

The makefile adds -maes, -msse2 and -msse3 on i*86 and x86_64.  You might
want to check these are normally available on all i686 CPUs.

The makefile calls "uname -m" to determine the architecture that's it being
compiled for, while that command determines the architecture of the build
machine.

There's a bunch of files in src/Boot/EFI that look like binary files.
These need to be removed or built from source.

> +              (setenv "DESTDIR" (assoc-ref outputs "out"))
> +              #t))
> +          (add-after 'install 'fix-install
> +            (lambda* (#:key outputs version #:allow-other-keys)
> +              (let ((out (assoc-ref outputs "out")))
> +                (install-file (string-append out "/usr/bin/veracrypt") (string-append out "/bin"))
> +                (copy-recursively (string-append out "/usr/share/applications") (string-append out "/share/applications"))
> +                (copy-recursively (string-append out "/usr/share/pixmaps") (string-append out "/share/pixmaps"))
> +                (copy-recursively (string-append out "/usr/share/doc/veracrypt/HTML") (string-append out "/share/doc/veracrypt-1.24/HTML"))
> +                (delete-file-recursively (string-append out "/usr"))))))
> +        ; Veracrypt only has a test suite for Windows.
> +        #:tests? #f))
> +    (native-inputs
> +     `(("pkg-config" ,pkg-config)
> +       ("yasm" ,yasm)))
> +    (inputs
> +      `(("fuse" ,fuse)
> +        ("wxwidgets" ,wxwidgets)))
> +    (propagated-inputs
> +      `(("lvm2" ,lvm2)))
> +    (home-page "https://www.veracrypt.fr/")
> +    (synopsis "Disk encryption software")
> +    (description "VeraCrypt is a free open source disk encryption software
> +based on TrueCrypt 7.1a.")
> +    (license license:asl2.0)))

src/Boot/Bios.h has a line ‘ Copyright (c) 2008-2012 TrueCrypt Developers Association and which is governed
 by the TrueCrypt License 3.0.’
That license is non-free according to http://directory.fsf.org/wiki/License:TrueCrypt.
That line appears in other source files as well.

Greetings,
Maxime.