1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox>
6 ;;; Copyright © 2016 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2016 ng0 <ng0@we.make.ritual.n0.is>
8 ;;; Copyright © 2016, 2017 Eric Bavier <bavier@member.fsf.org>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages crypto)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages aidc)
29 #:use-module (gnu packages attr)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages boost)
32 #:use-module (gnu packages cryptsetup)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages gnupg)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages libbsd)
38 #:use-module (gnu packages linux)
39 #:use-module (gnu packages nettle)
40 #:use-module (gnu packages password-utils)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages readline)
43 #:use-module (gnu packages search)
44 #:use-module (gnu packages serialization)
45 #:use-module (gnu packages shells)
46 #:use-module (gnu packages tcl)
47 #:use-module (gnu packages tls)
48 #:use-module (gnu packages xml)
49 #:use-module ((guix licenses) #:prefix license:)
50 #:use-module (guix packages)
51 #:use-module (guix download)
52 #:use-module (guix git-download)
53 #:use-module (guix build-system cmake)
54 #:use-module (guix build-system gnu)
55 #:use-module (guix build-system python))
57 (define-public libsodium
63 (uri (list (string-append
64 "http://download.libsodium.org/libsodium/"
65 "releases/libsodium-" version ".tar.gz")
67 "https://download.libsodium.org/libsodium/"
68 "releases/old/libsodium-" version ".tar.gz")))
71 "1z93wfg4k5svg8yck6cgdr6ysj91kbpn03nyzwxanncy3b5sq4ww"))))
72 (build-system gnu-build-system)
73 (synopsis "Portable NaCl-based crypto library")
75 "Sodium is a new easy-to-use high-speed software library for network
76 communication, encryption, decryption, signatures, etc.")
78 (home-page "http://libsodium.org")))
80 (define-public signify
86 (uri (string-append "https://github.com/aperezdc/signify/"
87 "archive/v" version ".tar.gz"))
88 (file-name (string-append name "-" version ".tar.gz"))
91 "0jd26kxwmmar3bylpx9x5dpqxzs17ky5dvwx8pdgcg95n4lyk223"))))
92 (build-system gnu-build-system)
93 ;; TODO Build with libwaive (described in README.md), to implement something
94 ;; like OpenBSD's pledge().
96 `(#:tests? #f ; no test suite
99 (string-append "PREFIX=" (assoc-ref %outputs "out")))
101 (modify-phases %standard-phases
102 (delete 'configure))))
104 `(("pkg-config" ,pkg-config)))
106 `(("libbsd" ,libbsd)))
107 (synopsis "Create and verify cryptographic signatures")
108 (description "The signify utility creates and verifies cryptographic
109 signatures using the elliptic curve Ed25519. This is a Linux port of the
110 OpenBSD tool of the same name.")
111 (home-page "https://github.com/aperezdc/signify")
112 ;; This package includes third-party code that was originally released under
113 ;; various non-copyleft licenses. See the source files for clarification.
114 (license (list license:bsd-3 license:bsd-4 license:expat license:isc
115 license:public-domain (license:non-copyleft
117 "See base64.c in the distribution for
118 the license from IBM.")))))
121 (define-public opendht
130 "https://github.com/savoirfairelinux/" name
131 "/archive/" version ".tar.gz"))
132 (file-name (string-append name "-" version ".tar.gz"))
133 (modules '((guix build utils)))
136 (delete-file-recursively "src/argon2")
137 (substitute* "src/Makefile.am"
138 (("./argon2/libargon2.la") "")
139 (("SUBDIRS = argon2") ""))
140 (substitute* "src/crypto.cpp"
141 (("argon2/argon2.h") "argon2.h"))
142 (substitute* "configure.ac"
143 (("src/argon2/Makefile") ""))))
146 "09yvkmbqbym3b5md4n96qc1s9sf2n8ji404hagih45rmsj49599x"))))
147 (build-system gnu-build-system)
151 ("readline" ,readline)
154 `(("msgpack" ,msgpack))) ;included in several installed headers
156 `(("autoconf" ,autoconf)
157 ("pkg-config" ,pkg-config)
158 ("automake" ,automake)
159 ("libtool" ,libtool)))
161 `(#:configure-flags '("--disable-tools" "--disable-python")
162 #:phases (modify-phases %standard-phases
163 (add-before 'configure 'autoconf
165 (zero? (system* "autoreconf" "-vfi")))))))
166 (home-page "https://github.com/savoirfairelinux/opendht/")
167 (synopsis "Distributed Hash Table (DHT) library")
168 (description "OpenDHT is a Distributed Hash Table (DHT) library. It may
169 be used to manage peer-to-peer network connections as needed for real time
171 (license license:gpl3)))
181 (string-append "https://github.com/vgough/encfs/releases/download/v"
182 version "/encfs-" version ".tar.gz"))
185 "1906254dg5hwljh0h4gyrw09ms3b57dlhjfzhfzffv50yzpkl837"))
186 (modules '((guix build utils)))
187 ;; Remove bundled dependencies in favour of proper inputs.
188 (snippet '(for-each delete-file-recursively
189 (find-files "internal" "^tinyxml2-[0-9]"
190 #:directories? #t)))))
191 (build-system cmake-build-system)
193 `(("gettext" ,gettext-minimal)
195 ;; Test dependencies.
202 ("tinyxml2" ,tinyxml2)))
204 `(#:configure-flags (list "-DUSE_INTERNAL_TINYXML=OFF")))
205 (home-page "https://vgough.github.io/encfs")
206 (synopsis "Encrypted virtual file system")
208 "EncFS creates a virtual encrypted file system in user-space. Each file
209 created under an EncFS mount point is stored as a separate encrypted file on
210 the underlying file system. Like most encrypted file systems, EncFS is meant
211 to provide security against off-line attacks, such as a drive falling into
213 (license (list license:expat ; internal/easylogging++.h
214 license:lgpl3+ ; encfs library
215 license:gpl3+)))) ; command-line tools
217 (define-public keyutils
225 (string-append "https://people.redhat.com/dhowells/keyutils/keyutils-"
229 "1bl3w03ygxhc0hz69klfdlwqn33jvzxl1zfl2jmnb2v85iawb8jd"))
230 (modules '((guix build utils)))
231 ;; Create relative symbolic links instead of absolute ones to /lib/*
232 (snippet '(substitute* "Makefile" (("\\$\\(LNS\\) \\$\\(LIBDIR\\)/")
234 (build-system gnu-build-system)
236 `(#:phases (modify-phases %standard-phases
237 (delete 'configure)) ; no configure script
238 #:make-flags (list "CC=gcc"
239 "RPATH=-Wl,-rpath,$(DESTDIR)$(LIBDIR)"
240 (string-append "DESTDIR="
241 (assoc-ref %outputs "out"))
242 "INCLUDEDIR=/include"
245 "SHAREDIR=/share/keyutils")
246 #:test-target "test"))
247 (home-page "https://people.redhat.com/dhowells/keyutils/")
248 (synopsis "Linux key management utilities")
250 "Keyutils is a set of utilities for managing the key retention facility in
251 the Linux kernel, which can be used by file systems, block devices, and more to
252 gain and retain the authorization and encryption keys required to perform
253 secure operations. ")
254 (license (list license:lgpl2.1+ ; the files keyutils.*
255 license:gpl2+)))) ; the rest
257 ;; There is no release candidate but commits point out a version number,
258 ;; furthermore no tarball exists.
259 (define-public eschalot
260 (let ((commit "0bf31d88a11898c19b1ed25ddd2aff7b35dbac44")
264 (version (string-append "1.2.0-" revision "." (string-take commit 7)))
269 (url "https://github.com/schnabear/eschalot")
271 (file-name (string-append name "-" version))
274 "0lj38ldh8vzi11wp4ghw4k0fkwp0s04zv8k8d473p1snmbh7mx98"))))
276 `(("openssl" ,openssl))) ; It needs: openssl/{bn,pem,rsa,sha}.h
277 (build-system gnu-build-system)
279 `(#:make-flags (list "CC=gcc"
280 (string-append "PREFIX=" (assoc-ref %outputs "out"))
281 (string-append "INSTALL=" "install"))
282 ;; XXX: make test would run a !VERY! long hashing of names with the use
283 ;; of a wordlist, the amount of computing time this would waste on build
284 ;; servers is in no relation to the size or importance of this small
285 ;; application, therefore we run our own tests on eschalot and worgen.
287 (modify-phases %standard-phases
292 (zero? (system* "./worgen" "8-12" "top1000.txt" "3-10" "top400nouns.txt"
293 "3-6" "top150adjectives.txt" "3-6"))
294 (zero? (system* "./eschalot" "-r" "^guix|^guixsd"))
295 (zero? (system* "./eschalot" "-r" "^gnu|^free"))
296 (zero? (system* "./eschalot" "-r" "^cyber|^hack"))
297 (zero? (system* "./eschalot" "-r" "^troll")))))
298 ;; Make install can not create the bin dir, create it.
299 (add-before 'install 'create-bin-dir
300 (lambda* (#:key outputs #:allow-other-keys)
301 (let* ((out (assoc-ref outputs "out"))
302 (bin (string-append out "/bin")))
305 (home-page "https://github.com/schnabear/eschalot")
306 (synopsis "Tor hidden service name generator")
308 "Eschalot is a tor hidden service name generator, it allows one to
309 produce customized vanity .onion addresses using a brute-force method. Searches
310 for valid names can be run with regular expressions and wordlists. For the
311 generation of wordlists the included tool @code{worgen} can be used. There is
312 no man page, refer to the home page for usage details.")
313 (license (list license:isc license:expat)))))
321 (uri (string-append "https://files.dyne.org/tomb/"
322 "Tomb-" version ".tar.gz"))
325 "1hv1w79as7swqj0n137vz8n8mwvcgwlvd91sdyssz41jarg7f1vr"))))
326 (build-system gnu-build-system)
327 (native-inputs `(("sudo" ,sudo))) ;presence needed for 'check' phase
331 ("cryptsetup" ,cryptsetup)
332 ("e2fsprogs" ,e2fsprogs) ;for mkfs.ext4
333 ("gettext" ,gettext-minimal) ;used at runtime
335 ("pinentry" ,pinentry)
336 ("qrencode" ,qrencode)
337 ("steghide" ,steghide)))
339 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
340 ;; TODO: Build and install gtk and qt trays
342 (modify-phases %standard-phases
343 (delete 'configure) ;no configuration to be done
344 (add-after 'install 'i18n
345 (lambda* (#:key make-flags #:allow-other-keys)
346 (zero? (apply system*
347 "make" "-C" "extras/translations"
348 "install" make-flags))))
349 (add-after 'install 'wrap
350 (lambda* (#:key inputs outputs #:allow-other-keys)
351 (let ((out (assoc-ref outputs "out")))
352 (wrap-program (string-append out "/bin/tomb")
354 (,(string-append (assoc-ref inputs "mlocate") "/bin")
355 ,@(map (lambda (program)
356 (or (and=> (which program) dirname)
357 (error "program not found:" program)))
358 '("seq" "mkfs.ext4" "pinentry" "sudo"
359 "gpg" "cryptsetup" "gettext"
360 "qrencode" "steghide")))))
363 (add-after 'wrap 'check
364 (lambda* (#:key outputs #:allow-other-keys)
365 ;; Running the full tests requires sudo/root access for
366 ;; cryptsetup, which is not available in the build environment.
367 ;; But we can run `tomb dig` without root, so make sure that
368 ;; works. TODO: It Would Be Nice to check the expected "index",
369 ;; "search", "bury", and "exhume" features are available by
370 ;; querying `tomb -h`.
371 (let ((tomb (string-append (assoc-ref outputs "out")
373 (zero? (system* tomb "dig" "-s" "10" "secrets.tomb"))))))))
374 (home-page "http://www.dyne.org/software/tomb")
375 (synopsis "File encryption for secret data")
377 "Tomb is an application to manage the creation and access of encrypted
378 storage files: it can be operated from commandline and it can integrate with a
379 user's graphical desktop.")
380 (license license:gpl3+)))
382 (define-public scrypt
389 (uri (string-append "https://www.tarsnap.com/scrypt/scrypt-"
393 "0xy5yhrwwv13skv9im9vm76rybh9f29j2dh4hlh2x01gvbkza8a6"))))
394 (build-system gnu-build-system)
396 `(#:phases (modify-phases %standard-phases
397 (add-after 'unpack 'patch-command-invocations
399 (substitute* "Makefile.in"
402 (add-after 'install 'install-docs
403 (lambda* (#:key outputs #:allow-other-keys)
404 (let* ((out (assoc-ref %outputs "out"))
405 (misc (string-append out "/share/doc/scrypt")))
406 (install-file "FORMAT" misc)
409 `(("openssl" ,openssl)))
410 (home-page "https://www.tarsnap.com/scrypt.html")
411 (synopsis "Memory-hard encryption tool based on scrypt")
412 (description "This packages provides a simple password-based encryption
413 utility as a demonstration of the @code{scrypt} key derivation function.
414 @code{Scrypt} is designed to be far more resistant against hardware brute-force
415 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
416 (license license:bsd-2)))
418 (define-public python-asn1crypto
420 (name "python-asn1crypto")
425 (uri (string-append "https://github.com/wbond/asn1crypto/archive/"
429 "1kn910896l3knmilla1c9ly20q181s43w1ah08lzkbm1h3j6pcz0"))))
430 (build-system python-build-system)
431 (home-page "https://github.com/wbond/asn1crypto")
432 (synopsis "ASN.1 parser and serializer in Python")
433 (description "asn1crypto is an ASN.1 parser and serializer with definitions
434 for private keys, public keys, certificates, CRL, OCSP, CMS, PKCS#3, PKCS#7,
435 PKCS#8, PKCS#12, PKCS#5, X.509 and TSP.")
436 (license license:expat)))
438 (define-public python2-asn1crypto
439 (package-with-python2 python-asn1crypto))