Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / crypto.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
3 ;;; Copyright © 2015, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2016, 2017, 2018, 2019 Leo Famulari <leo@famulari.name>
5 ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox>
6 ;;; Copyright © 2016, 2017, 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
8 ;;; Copyright © 2016, 2017, 2019 Eric Bavier <bavier@member.fsf.org>
9 ;;; Copyright © 2017 Pierre Langlois <pierre.langlois@gmx.com>
10 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
12 ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
13 ;;; Copyright © 2018, 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
14 ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
15 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
16 ;;; Copyright © 2019 Tanguy Le Carrour <tanguy@bioneland.org>
17 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
18 ;;;
19 ;;; This file is part of GNU Guix.
20 ;;;
21 ;;; GNU Guix is free software; you can redistribute it and/or modify it
22 ;;; under the terms of the GNU General Public License as published by
23 ;;; the Free Software Foundation; either version 3 of the License, or (at
24 ;;; your option) any later version.
25 ;;;
26 ;;; GNU Guix is distributed in the hope that it will be useful, but
27 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
28 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 ;;; GNU General Public License for more details.
30 ;;;
31 ;;; You should have received a copy of the GNU General Public License
32 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
33
34 (define-module (gnu packages crypto)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages admin)
37 #:use-module (gnu packages aidc)
38 #:use-module (gnu packages attr)
39 #:use-module (gnu packages autotools)
40 #:use-module (gnu packages boost)
41 #:use-module (gnu packages check)
42 #:use-module (gnu packages compression)
43 #:use-module (gnu packages cryptsetup)
44 #:use-module (gnu packages gettext)
45 #:use-module (gnu packages gnupg)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages kerberos)
48 #:use-module (gnu packages libbsd)
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages lsof)
52 #:use-module (gnu packages nettle)
53 #:use-module (gnu packages password-utils)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages perl-check)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-xyz)
59 #:use-module (gnu packages readline)
60 #:use-module (gnu packages search)
61 #:use-module (gnu packages serialization)
62 #:use-module (gnu packages shells)
63 #:use-module (gnu packages sqlite)
64 #:use-module (gnu packages tcl)
65 #:use-module (gnu packages tls)
66 #:use-module (gnu packages xml)
67 #:use-module ((guix licenses) #:prefix license:)
68 #:use-module (guix packages)
69 #:use-module (guix download)
70 #:use-module (guix git-download)
71 #:use-module (guix build-system cmake)
72 #:use-module (guix build-system gnu)
73 #:use-module (guix build-system perl)
74 #:use-module (srfi srfi-1)
75 #:use-module (srfi srfi-26))
76
77 (define-public libsodium
78 (package
79 (name "libsodium")
80 (version "1.0.18")
81 (source (origin
82 (method url-fetch)
83 (uri (list (string-append
84 "https://download.libsodium.org/libsodium/"
85 "releases/libsodium-" version ".tar.gz")
86 (string-append
87 "https://download.libsodium.org/libsodium/"
88 "releases/old/libsodium-" version ".tar.gz")))
89 (sha256
90 (base32
91 "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g"))))
92 (build-system gnu-build-system)
93 (synopsis "Portable NaCl-based crypto library")
94 (description
95 "Sodium is a new easy-to-use high-speed software library for network
96 communication, encryption, decryption, signatures, etc.")
97 (license license:isc)
98 (home-page "https://libsodium.org")))
99
100 (define-public libmd
101 (package
102 (name "libmd")
103 (version "1.0.1")
104 (source (origin
105 (method url-fetch)
106 (uri
107 (list
108 (string-append "https://archive.hadrons.org/software/libmd/libmd-"
109 version ".tar.xz")
110 (string-append "https://libbsd.freedesktop.org/releases/libmd-"
111 version ".tar.xz")))
112 (sha256
113 (base32
114 "0waclg2d5qin3r26gy5jvy4584ik60njc8pqbzwk0lzq3j9ynkp1"))))
115 (build-system gnu-build-system)
116 (synopsis "Message Digest functions from BSD systems")
117 (description
118 "The currently provided message digest algorithms are:
119 @itemize
120 @item MD2
121 @item MD4
122 @item MD5
123 @item RIPEMD-160
124 @item SHA-1
125 @item SHA-2 (SHA-256, SHA-384 and SHA-512)
126 @end itemize")
127 (license (list license:bsd-3
128 license:bsd-2
129 license:isc
130 license:public-domain))
131 (home-page "https://www.hadrons.org/software/libmd/")))
132
133 (define-public signify
134 (package
135 (name "signify")
136 (version "28")
137 (home-page "https://github.com/aperezdc/signify")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "https://github.com/aperezdc/signify/releases"
141 "/download/v" version "/signify-" version ".tar.xz"))
142 (sha256
143 (base32
144 "05v970glhpaxv0m4cnidfxsdnsjp12nf2crzrdq4ml7g5a3g6hdq"))))
145 (build-system gnu-build-system)
146 ;; TODO Build with libwaive (described in README.md), to implement something
147 ;; like OpenBSD's pledge().
148 (arguments
149 `(#:make-flags
150 (list "CC=gcc"
151 (string-append "PREFIX=" (assoc-ref %outputs "out")))
152 #:phases
153 (modify-phases %standard-phases
154 (delete 'configure))))
155 (native-inputs
156 `(("pkg-config" ,pkg-config)))
157 (inputs
158 `(("libbsd" ,libbsd)))
159 (synopsis "Create and verify cryptographic signatures")
160 (description "The signify utility creates and verifies cryptographic
161 signatures using the elliptic curve Ed25519. This is a Linux port of the
162 OpenBSD tool of the same name.")
163 ;; This package includes third-party code that was originally released under
164 ;; various non-copyleft licenses. See the source files for clarification.
165 (license (list license:bsd-3 license:bsd-4 license:expat license:isc
166 license:public-domain (license:non-copyleft
167 "file://base64.c"
168 "See base64.c in the distribution for
169 the license from IBM.")))))
170
171 (define-public encfs
172 (package
173 (name "encfs")
174 (version "1.9.5")
175 (source
176 (origin
177 (method url-fetch)
178 (uri
179 (string-append "https://github.com/vgough/encfs/releases/download/v"
180 version "/encfs-" version ".tar.gz"))
181 (sha256
182 (base32
183 "0qzxavvv20577bxvly8s7d3y7bqasqclc2mllp0ddfncjm9z02a7"))
184 (modules '((guix build utils)))
185 ;; Remove bundled dependencies in favour of proper inputs.
186 (snippet '(begin
187 (for-each delete-file-recursively
188 '("vendor/github.com/leethomason/tinyxml2"
189 "vendor/github.com/google/googletest"))
190 #t))))
191 (build-system cmake-build-system)
192 (native-inputs
193 `(("gettext" ,gettext-minimal)
194
195 ;; Test dependencies.
196 ("expect" ,expect)
197 ("googletest-source" ,(package-source googletest))
198 ("perl" ,perl)))
199 (inputs
200 `(("attr" ,attr)
201 ("fuse" ,fuse)
202 ("openssl" ,openssl)
203 ("tinyxml2" ,tinyxml2)))
204 (arguments
205 `(#:configure-flags (list "-DUSE_INTERNAL_TINYXML=OFF")
206 #:phases
207 (modify-phases %standard-phases
208 (add-after 'unpack 'unpack-googletest
209 (lambda* (#:key inputs #:allow-other-keys)
210 (mkdir-p "vendor/github.com/google/googletest")
211 (copy-recursively (assoc-ref inputs "googletest-source")
212 "vendor/github.com/google/googletest")
213 #t))
214 (add-before 'configure 'patch-CMakeLists.txt
215 (lambda _
216 ;; Prevent CMake from adding libc on the system include path.
217 ;; Otherwise it will interfere with the libc used by GCC and
218 ;; ultimately cause #include_next errors.
219 (substitute* "CMakeLists.txt"
220 (("include_directories \\(SYSTEM \\$\\{Intl_INCLUDE_DIRS\\}\\)")
221 ""))
222 #t))
223 (add-before 'check 'make-unittests
224 (lambda _
225 (invoke "make" "unittests"))))))
226 (home-page "https://vgough.github.io/encfs")
227 (synopsis "Encrypted virtual file system")
228 (description
229 "EncFS creates a virtual encrypted file system in user-space. Each file
230 created under an EncFS mount point is stored as a separate encrypted file on
231 the underlying file system. Like most encrypted file systems, EncFS is meant
232 to provide security against off-line attacks, such as a drive falling into
233 the wrong hands.")
234 (license (list license:expat ; internal/easylogging++.h
235 license:lgpl3+ ; encfs library
236 license:gpl3+)))) ; command-line tools
237
238 (define-public keyutils
239 (package
240 (name "keyutils")
241 (version "1.6.1")
242 (source
243 (origin
244 (method url-fetch)
245 (uri
246 (string-append "https://people.redhat.com/dhowells/keyutils/keyutils-"
247 version ".tar.bz2"))
248 (sha256
249 (base32 "1kk4pmyflgplkgxn2bzpc069ph9c9jdd9ikcsyd5pnaimqi5gcf8"))
250 (modules '((guix build utils)))
251 ;; Create relative symbolic links instead of absolute ones to /lib/*.
252 (snippet '(begin
253 (substitute* "Makefile" (("\\$\\(LNS\\) \\$\\(LIBDIR\\)/")
254 "$(LNS) "))
255 #t))))
256 (build-system gnu-build-system)
257 (arguments
258 `(#:phases (modify-phases %standard-phases
259 (delete 'configure)) ; no configure script
260 #:make-flags (list "CC=gcc"
261 "RPATH=-Wl,-rpath,$(DESTDIR)$(LIBDIR)"
262 (string-append "DESTDIR="
263 (assoc-ref %outputs "out"))
264 "INCLUDEDIR=/include"
265 "LIBDIR=/lib"
266 "MANDIR=/share/man"
267 "SHAREDIR=/share/keyutils")
268 #:test-target "test"))
269 (inputs
270 `(("mit-krb5" ,mit-krb5)))
271 (home-page "https://people.redhat.com/dhowells/keyutils/")
272 (synopsis "Linux key management utilities")
273 (description
274 "Keyutils is a set of utilities for managing the key retention facility in
275 the Linux kernel, which can be used by file systems, block devices, and more to
276 gain and retain the authorization and encryption keys required to perform
277 secure operations. ")
278 (license (list license:lgpl2.1+ ; the files keyutils.*
279 license:gpl2+)))) ; the rest
280
281 ;; There is no release candidate but commits point out a version number,
282 ;; furthermore no tarball exists.
283 (define-public eschalot
284 (let ((commit "0bf31d88a11898c19b1ed25ddd2aff7b35dbac44")
285 (revision "1"))
286 (package
287 (name "eschalot")
288 (version (string-append "1.2.0-" revision "." (string-take commit 7)))
289 (source
290 (origin
291 (method git-fetch)
292 (uri (git-reference
293 (url "https://github.com/schnabear/eschalot")
294 (commit commit)))
295 (file-name (string-append name "-" version))
296 (sha256
297 (base32
298 "0lj38ldh8vzi11wp4ghw4k0fkwp0s04zv8k8d473p1snmbh7mx98"))))
299 (inputs
300 `(("openssl" ,openssl))) ; It needs: openssl/{bn,pem,rsa,sha}.h
301 (build-system gnu-build-system)
302 (arguments
303 `(#:make-flags (list "CC=gcc"
304 (string-append "PREFIX=" (assoc-ref %outputs "out"))
305 (string-append "INSTALL=" "install"))
306 ;; XXX: make test would run a !VERY! long hashing of names with the use
307 ;; of a wordlist, the amount of computing time this would waste on build
308 ;; servers is in no relation to the size or importance of this small
309 ;; application, therefore we run our own tests on eschalot and worgen.
310 #:phases
311 (modify-phases %standard-phases
312 (delete 'configure)
313 (replace 'check
314 (lambda _
315 (invoke "./worgen" "8-12" "top1000.txt" "3-10" "top400nouns.txt"
316 "3-6" "top150adjectives.txt" "3-6")
317 (invoke "./eschalot" "-r" "^guix|^guixsd")
318 (invoke "./eschalot" "-r" "^gnu|^free")
319 (invoke "./eschalot" "-r" "^cyber|^hack")
320 (invoke "./eschalot" "-r" "^troll")))
321 ;; Make install can not create the bin dir, create it.
322 (add-before 'install 'create-bin-dir
323 (lambda* (#:key outputs #:allow-other-keys)
324 (let* ((out (assoc-ref outputs "out"))
325 (bin (string-append out "/bin")))
326 (mkdir-p bin)
327 #t))))))
328 (home-page "https://github.com/schnabear/eschalot")
329 (synopsis "Tor hidden service name generator")
330 (description
331 "Eschalot is a tor hidden service name generator, it allows one to
332 produce customized vanity .onion addresses using a brute-force method. Searches
333 for valid names can be run with regular expressions and wordlists. For the
334 generation of wordlists the included tool @code{worgen} can be used. There is
335 no man page, refer to the home page for usage details.")
336 (license (list license:isc license:expat)))))
337
338 (define-public tomb
339 (package
340 (name "tomb")
341 (version "2.7")
342 (source (origin
343 (method url-fetch)
344 (uri (string-append "https://files.dyne.org/tomb/"
345 "Tomb-" version ".tar.gz"))
346 (sha256
347 (base32
348 "0x3al02796vx1cvy6y6h685c367qx70dwv471g0hmks2gr10f0cn"))
349 (patches (search-patches "tomb-fix-errors-on-open.patch"))))
350 (build-system gnu-build-system)
351 (native-inputs `(("sudo" ,sudo))) ;presence needed for 'check' phase
352 (inputs
353 `(("zsh" ,zsh)
354 ("gnupg" ,gnupg)
355 ("cryptsetup" ,cryptsetup)
356 ("e2fsprogs" ,e2fsprogs) ;for mkfs.ext4
357 ("gettext" ,gettext-minimal) ;used at runtime
358 ("lsof" ,lsof)
359 ("mlocate" ,mlocate)
360 ("pinentry" ,pinentry)
361 ("qrencode" ,qrencode)
362 ("steghide" ,steghide)
363 ("util-linux" ,util-linux)))
364 (arguments
365 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
366 ;; The "sudo" input is needed only to satisfy dependency checks in the
367 ;; 'check' phase. The "sudo" used at runtime should come from the
368 ;; system's setuid-programs, so ensure no reference is kept.
369 #:disallowed-references (,sudo)
370 ;; TODO: Build and install gtk and qt trays
371 #:phases
372 (modify-phases %standard-phases
373 (delete 'configure) ;no configuration to be done
374 (add-after 'install 'i18n
375 (lambda* (#:key make-flags #:allow-other-keys)
376 (apply invoke "make" "-C" "extras/translations"
377 "install" make-flags)
378 #t))
379 (add-after 'install 'wrap
380 (lambda* (#:key inputs outputs #:allow-other-keys)
381 (let ((out (assoc-ref outputs "out")))
382 (wrap-program (string-append out "/bin/tomb")
383 `("PATH" ":" prefix
384 (,(string-append (assoc-ref inputs "mlocate") "/bin")
385 ,@(map (lambda (program)
386 (or (and=> (which program) dirname)
387 (error "program not found:" program)))
388 '("seq" "mkfs.ext4" "pinentry"
389 "gpg" "cryptsetup" "gettext" "lsof"
390 "qrencode" "steghide" "findmnt")))))
391 #t)))
392 (delete 'check)
393 (add-after 'wrap 'check
394 (lambda* (#:key outputs #:allow-other-keys)
395 ;; Running the full tests requires sudo/root access for
396 ;; cryptsetup, which is not available in the build environment.
397 ;; But we can run `tomb dig` without root, so make sure that
398 ;; works. TODO: It Would Be Nice to check the expected "index",
399 ;; "search", "bury", and "exhume" features are available by
400 ;; querying `tomb -h`.
401 (let ((tomb (string-append (assoc-ref outputs "out")
402 "/bin/tomb")))
403 (invoke tomb "dig" "-s" "10" "secrets.tomb")
404 #t))))))
405 (home-page "https://www.dyne.org/software/tomb")
406 (synopsis "File encryption for secret data")
407 (description
408 "Tomb is an application to manage the creation and access of encrypted
409 storage files: it can be operated from commandline and it can integrate with a
410 user's graphical desktop.")
411 (license license:gpl3+)))
412
413 (define-public scrypt
414 (package
415 (name "scrypt")
416 (version "1.2.1")
417 (source
418 (origin
419 (method url-fetch)
420 (uri (string-append "https://www.tarsnap.com/scrypt/scrypt-"
421 version ".tgz"))
422 (sha256
423 (base32
424 "0xy5yhrwwv13skv9im9vm76rybh9f29j2dh4hlh2x01gvbkza8a6"))))
425 (build-system gnu-build-system)
426 (arguments
427 `(#:phases (modify-phases %standard-phases
428 (add-after 'unpack 'patch-command-invocations
429 (lambda _
430 (substitute* "Makefile.in"
431 (("command -p") ""))
432 #t))
433 (add-after 'install 'install-docs
434 (lambda* (#:key outputs #:allow-other-keys)
435 (let* ((out (assoc-ref %outputs "out"))
436 (misc (string-append out "/share/doc/scrypt")))
437 (install-file "FORMAT" misc)
438 #t))))))
439 (inputs
440 `(("openssl" ,openssl)))
441 (home-page "https://www.tarsnap.com/scrypt.html")
442 (synopsis "Memory-hard encryption tool based on scrypt")
443 (description "This package provides a simple password-based encryption
444 utility as a demonstration of the @code{scrypt} key derivation function.
445 @code{Scrypt} is designed to be far more resistant against hardware brute-force
446 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
447 (license license:bsd-2)))
448
449 (define-public libscrypt
450 (package
451 (name "libscrypt")
452 (version "1.21")
453 (source
454 (origin
455 (method git-fetch)
456 (uri (git-reference
457 (url "https://github.com/technion/libscrypt.git")
458 (commit (string-append "v" version))))
459 (file-name (git-file-name name version))
460 (sha256
461 (base32
462 "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng"))))
463 (build-system gnu-build-system)
464 (arguments
465 `(#:make-flags (list (string-append "PREFIX=" %output)
466 "CC=gcc")
467 #:phases
468 (modify-phases %standard-phases
469 (delete 'configure))))
470 (home-page "https://lolware.net/libscrypt.html")
471 (synopsis "Password hashing library")
472 (description "@code{libscrypt} implements @code{scrypt} key derivation
473 function. It is designed to be far more secure against hardware brute-force
474 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
475 (license license:bsd-3)))
476
477 (define-public perl-math-random-isaac-xs
478 (package
479 (name "perl-math-random-isaac-xs")
480 (version "1.004")
481 (source
482 (origin
483 (method url-fetch)
484 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
485 "Math-Random-ISAAC-XS-" version ".tar.gz"))
486 (sha256
487 (base32
488 "0yxqqcqvj51fn7b7j5xqhz65v74arzgainn66c6k7inijbmr1xws"))))
489 (build-system perl-build-system)
490 (native-inputs
491 `(("perl-module-build" ,perl-module-build)
492 ("perl-test-nowarnings" ,perl-test-nowarnings)))
493 (home-page "https://metacpan.org/release/Math-Random-ISAAC-XS")
494 (synopsis "C implementation of the ISAAC PRNG algorithm")
495 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
496 fast pseudo-random number generator. It is suitable for applications where a
497 significant amount of random data needs to be produced quickly, such as
498 solving using the Monte Carlo method or for games. The results are uniformly
499 distributed, unbiased, and unpredictable unless you know the seed.
500
501 This package implements the same interface as @code{Math::Random::ISAAC}.")
502 (license license:public-domain)))
503
504 (define-public perl-math-random-isaac
505 (package
506 (name "perl-math-random-isaac")
507 (version "1.004")
508 (source
509 (origin
510 (method url-fetch)
511 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
512 "Math-Random-ISAAC-" version ".tar.gz"))
513 (sha256
514 (base32
515 "0z1b3xbb3xz71h25fg6jgsccra7migq7s0vawx2rfzi0pwpz0wr7"))))
516 (build-system perl-build-system)
517 (native-inputs
518 `(("perl-test-nowarnings" ,perl-test-nowarnings)))
519 (propagated-inputs
520 `(("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)))
521 (home-page "https://metacpan.org/release/Math-Random-ISAAC")
522 (synopsis "Perl interface to the ISAAC PRNG algorithm")
523 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
524 fast pseudo-random number generator. It is suitable for applications where a
525 significant amount of random data needs to be produced quickly, such as
526 solving using the Monte Carlo method or for games. The results are uniformly
527 distributed, unbiased, and unpredictable unless you know the seed.
528
529 This package provides a Perl interface to the ISAAC pseudo random number
530 generator.")
531 (license license:public-domain)))
532
533 (define-public perl-crypt-random-source
534 (package
535 (name "perl-crypt-random-source")
536 (version "0.14")
537 (source
538 (origin
539 (method url-fetch)
540 (uri (string-append "mirror://cpan/authors/id/E/ET/ETHER/"
541 "Crypt-Random-Source-" version ".tar.gz"))
542 (sha256
543 (base32 "1rpdds3sy5l1fhngnkrsgwsmwd54wpicx3i9ds69blcskwkcwkpc"))))
544 (build-system perl-build-system)
545 (native-inputs
546 `(("perl-module-build-tiny" ,perl-module-build-tiny)
547 ("perl-test-fatal" ,perl-test-fatal)))
548 (propagated-inputs
549 `(("perl-capture-tiny" ,perl-capture-tiny)
550 ("perl-module-find" ,perl-module-find)
551 ("perl-module-runtime" ,perl-module-runtime)
552 ("perl-moo" ,perl-moo)
553 ("perl-namespace-clean" ,perl-namespace-clean)
554 ("perl-sub-exporter" ,perl-sub-exporter)
555 ("perl-type-tiny" ,perl-type-tiny)))
556 (home-page "https://metacpan.org/release/Crypt-Random-Source")
557 (synopsis "Get weak or strong random data from pluggable sources")
558 (description "This module provides implementations for a number of
559 byte-oriented sources of random data.")
560 (license license:perl-license)))
561
562 (define-public perl-math-random-secure
563 (package
564 (name "perl-math-random-secure")
565 (version "0.080001")
566 (source
567 (origin
568 (method url-fetch)
569 (uri (string-append "mirror://cpan/authors/id/F/FR/FREW/"
570 "Math-Random-Secure-" version ".tar.gz"))
571 (sha256
572 (base32
573 "0dgbf4ncll4kmgkyb9fsaxn0vf2smc9dmwqzgh3259zc2zla995z"))))
574 (build-system perl-build-system)
575 (native-inputs
576 `(("perl-list-moreutils" ,perl-list-moreutils)
577 ("perl-test-leaktrace" ,perl-test-leaktrace)
578 ("perl-test-sharedfork" ,perl-test-sharedfork)
579 ("perl-test-warn" ,perl-test-warn)))
580 (inputs
581 `(("perl-crypt-random-source" ,perl-crypt-random-source)
582 ("perl-math-random-isaac" ,perl-math-random-isaac)
583 ("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)
584 ("perl-moo" ,perl-moo)))
585 (home-page "https://metacpan.org/release/Math-Random-Secure")
586 (synopsis "Cryptographically secure replacement for rand()")
587 (description "This module is intended to provide a
588 cryptographically-secure replacement for Perl's built-in @code{rand} function.
589 \"Crytographically secure\", in this case, means:
590
591 @enumerate
592 @item No matter how many numbers you see generated by the random number
593 generator, you cannot guess the future numbers, and you cannot guess the seed.
594 @item There are so many possible seeds that it would take decades, centuries,
595 or millennia for an attacker to try them all.
596 @item The seed comes from a source that generates relatively strong random
597 data on your platform, so the seed itself will be as random as possible.
598 @end enumerate\n")
599 (license license:artistic2.0)))
600
601 (define-public crypto++
602 (package
603 (name "crypto++")
604 (version "8.0.0")
605 (source (origin
606 (method url-fetch/zipbomb)
607 (uri (string-append "https://cryptopp.com/cryptopp"
608 (string-join (string-split version #\.) "")
609 ".zip"))
610 (sha256
611 (base32
612 "0b5qrsm4jhy4nzxgrm13nixhvbswr242plx1jw6r4sw492rqkzdv"))))
613 (build-system gnu-build-system)
614 (arguments
615 `(#:make-flags
616 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
617 ;; Override "/sbin/ldconfig" with simply "echo" since
618 ;; we don't need ldconfig(8).
619 "LDCONF=echo")
620 #:phases
621 (modify-phases %standard-phases
622 (add-after 'unpack 'disable-native-optimisation
623 ;; This package installs more than just headers. Ensure that the
624 ;; cryptest.exe binary & static library aren't CPU model specific.
625 (lambda _
626 (substitute* "GNUmakefile"
627 ((" -march=native") ""))
628 #t))
629 (delete 'configure)
630 (add-after 'build 'build-shared
631 (lambda _
632 ;; By default, only the static library is built.
633 (invoke "make" "shared")))
634 (add-after 'install 'install-shared-library-links
635 ;; By default, only .so and .so.x.y.z are installed.
636 ;; Create all the ‘intermediates’ expected by dependent packages.
637 (lambda* (#:key outputs #:allow-other-keys)
638 (let* ((out (assoc-ref outputs "out"))
639 (lib (string-append out "/lib")))
640 (with-directory-excursion lib
641 (symlink "libcryptopp.so.8.0.0" "libcryptopp.so.8.0")
642 (symlink "libcryptopp.so.8.0.0" "libcryptopp.so.8")
643 #t))))
644 (add-after 'install 'install-pkg-config
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let* ((out (assoc-ref outputs "out"))
647 (pkg-dir (string-append out "/lib/pkgconfig")))
648 (mkdir-p pkg-dir)
649 (with-output-to-file (string-append pkg-dir "/libcrypto++.pc")
650 (lambda _
651 (display
652 (string-append
653 "prefix=" out "\n"
654 "libdir=" out "/lib\n"
655 "includedir=" out "/include\n\n"
656 "Name: libcrypto++-" ,version "\n"
657 "Description: Class library of cryptographic schemes"
658 "Version: " ,version "\n"
659 "Libs: -L${libdir} -lcryptopp\n"
660 "Cflags: -I${includedir}\n"))))))))))
661 (native-inputs
662 `(("unzip" ,unzip)))
663 (home-page "https://cryptopp.com/")
664 (synopsis "C++ class library of cryptographic schemes")
665 (description "Crypto++ is a C++ class library of cryptographic schemes.")
666 ;; The compilation is distributed under the Boost license; the individual
667 ;; files in the compilation are in the public domain.
668 (license (list license:boost1.0 license:public-domain))))
669
670 (define-public libb2
671 (package
672 (name "libb2")
673 (version "0.98.1")
674 (source (origin
675 (method url-fetch)
676 (uri (string-append
677 "https://github.com/BLAKE2/libb2/releases/download/v"
678 version "/libb2-" version ".tar.gz"))
679 (sha256
680 (base32
681 "0bn7yrzdixdvzm46shbhpkqbr6zyqyxiqn7a7x54ag3mrvfnyqjk"))))
682 (build-system gnu-build-system)
683 (arguments
684 `(#:configure-flags
685 (list
686 ,@(if (any (cute string-prefix? <> (or (%current-system)
687 (%current-target-system)))
688 '("x86_64" "i686"))
689 ;; fat only checks for Intel optimisations
690 '("--enable-fat")
691 '())
692 "--disable-native"))) ;don't optimise at build time
693 (home-page "https://blake2.net/")
694 (synopsis "Library implementing the BLAKE2 family of hash functions")
695 (description
696 "libb2 is a portable implementation of the BLAKE2 family of cryptographic
697 hash functions. It includes optimised implementations for IA-32 and AMD64
698 processors, and an interface layer that automatically selects the best
699 implementation for the processor it is run on.
700
701 @dfn{BLAKE2} (RFC 7693) is a family of high-speed cryptographic hash functions
702 that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
703 as the latest standard, SHA-3. It is an improved version of the SHA-3 finalist
704 BLAKE.")
705 (license license:public-domain)))
706
707 (define-public rhash
708 (package
709 (name "rhash")
710 (version "1.3.9")
711 (source
712 (origin
713 (method url-fetch)
714 (uri (string-append "mirror://sourceforge/rhash/rhash/" version
715 "/rhash-" version "-src.tar.gz"))
716 (file-name (string-append "rhash-" version ".tar.gz"))
717 (sha256
718 (base32
719 "1xn9fqa6rlnhsbgami45g82dlw9i1skg2sri3ydiinwak5ph1ca2"))))
720 (build-system gnu-build-system)
721 (arguments
722 `(#:configure-flags
723 (list (string-append "--prefix=" (assoc-ref %outputs "out"))
724 ,@(let ((target (%current-target-system)))
725 (if target
726 `((string-append "--target=" ,target)
727 (string-append "--cc="
728 (assoc-ref %build-inputs "cross-gcc")
729 "/bin/" ,target "-gcc"))
730 '())))
731 #:make-flags
732 ;; The binaries in /bin need some help finding librhash.so.0.
733 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
734 #:test-target "test" ; ‘make check’ just checks the sources
735 #:phases
736 (modify-phases %standard-phases
737 (replace 'configure
738 ;; ./configure is not GNU autotools' and doesn't gracefully handle
739 ;; unrecognized options, so we must call it manually.
740 (lambda* (#:key configure-flags #:allow-other-keys)
741 (apply invoke "./configure" configure-flags)))
742 (add-before 'check 'patch-/bin/sh
743 (lambda _
744 (substitute* "Makefile"
745 (("/bin/sh") (which "sh")))
746 #t))
747 (add-after 'install 'install-library-extras
748 (lambda* (#:key make-flags #:allow-other-keys)
749 (apply invoke
750 "make" "-C" "librhash"
751 "install-lib-headers" "install-so-link"
752 make-flags))))))
753 (home-page "https://sourceforge.net/projects/rhash/")
754 (synopsis "Utility for computing hash sums")
755 (description "RHash is a console utility for calculation and verification
756 of magnet links and a wide range of hash sums like CRC32, MD4, MD5, SHA1,
757 SHA256, SHA512, SHA3, AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R
758 34.11-94, RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.")
759 (license (license:non-copyleft "file://COPYING"))))
760
761 (define-public botan
762 (package
763 (name "botan")
764 (version "2.12.1")
765 (source (origin
766 (method url-fetch)
767 (uri (string-append "https://botan.randombit.net/releases/"
768 "Botan-" version ".tar.xz"))
769 (sha256
770 (base32
771 "1ada3ga7b0z4m0vjmxlvfi4nsic2l8kjcy85jwss3z2i58a5y0vy"))))
772 (build-system gnu-build-system)
773 (arguments
774 '(#:phases
775 (modify-phases %standard-phases
776 (replace 'configure
777 (lambda* (#:key inputs outputs #:allow-other-keys)
778 (let* ((out (assoc-ref %outputs "out"))
779 (lib (string-append out "/lib")))
780 ;; Upstream tests and benchmarks with -O3.
781 (setenv "CXXFLAGS" "-O3")
782 (invoke "python" "./configure.py"
783 (string-append "--prefix=" out)
784 ;; Otherwise, the `botan` executable cannot find
785 ;; libbotan.
786 (string-append "--ldflags=-Wl,-rpath=" lib)
787
788 "--with-os-feature=getentropy"
789 "--with-rst2man"
790
791 ;; Recommended by upstream
792 "--with-zlib" "--with-bzip2" "--with-sqlite3"))))
793 (replace 'check
794 (lambda _ (invoke "./botan-test"))))))
795 (native-inputs
796 `(("python" ,python-wrapper)
797 ("python-docutils" ,python-docutils)))
798 (inputs
799 `(("sqlite" ,sqlite)
800 ("bzip2" ,bzip2)
801 ("zlib" ,zlib)))
802 (synopsis "Cryptographic library in C++11")
803 (description "Botan is a cryptography library, written in C++11, offering
804 the tools necessary to implement a range of practical systems, such as TLS/DTLS,
805 PKIX certificate handling, PKCS#11 and TPM hardware support, password hashing,
806 and post-quantum crypto schemes. In addition to the C++, botan has a C89 API
807 specifically designed to be easy to call from other languages. A Python binding
808 using ctypes is included, and several other language bindings are available.")
809 (home-page "https://botan.randombit.net")
810 (license license:bsd-2)))
811
812 (define-public ccrypt
813 (package
814 (name "ccrypt")
815 (version "1.11")
816 (source (origin
817 (method url-fetch)
818 (uri (string-append "mirror://sourceforge/ccrypt/"
819 version "/ccrypt-" version ".tar.gz"))
820 (sha256
821 (base32
822 "0kx4a5mhmp73ljknl2lcccmw9z3f5y8lqw0ghaymzvln1984g75i"))))
823 (build-system gnu-build-system)
824 (home-page "http://ccrypt.sourceforge.net")
825 (synopsis "Command-line utility for encrypting and decrypting files and streams")
826 (description "@command{ccrypt} is a utility for encrypting and decrypting
827 files and streams. It was designed as a replacement for the standard unix
828 @command{crypt} utility, which is notorious for using a very weak encryption
829 algorithm. @command{ccrypt} is based on the Rijndael block cipher, a version of
830 which is also used in the Advanced Encryption Standard (AES, see
831 @url{http://www.nist.gov/aes}). This cipher is believed to provide very strong
832 security.")
833 (license license:gpl2)))
834
835 (define-public asignify
836 (let ((commit "f58e7977a599f040797975d649ed318e25cbd2d5")
837 (revision "0"))
838 (package
839 (name "asignify")
840 (version (git-version "1.1" revision commit))
841 (source (origin
842 (method git-fetch)
843 (uri (git-reference
844 (url "https://github.com/vstakhov/asignify.git")
845 (commit commit)))
846 (file-name (git-file-name name version))
847 (sha256
848 (base32
849 "1zl68qq6js6fdahxzyhvhrpyrwlv8c2zhdplycnfxyr1ckkhq8dw"))))
850 (build-system gnu-build-system)
851 (arguments
852 `(#:configure-flags
853 (list "--enable-openssl"
854 (string-append "--with-openssl="
855 (assoc-ref %build-inputs "openssl")))))
856 (native-inputs
857 `(("autoconf" ,autoconf)
858 ("automake" ,automake)
859 ("libtool" ,libtool)))
860 (inputs
861 `(("openssl" ,openssl)))
862 (home-page "https://github.com/vstakhov/asignify")
863 (synopsis "Cryptographic authentication and encryption tool and library")
864 (description "Asignify offers public cryptographic signatures and
865 encryption with a library or a command-line tool. The tool is heavily inspired
866 by signify as used in OpenBSD. The main goal of this project is to define a
867 high level API for signing files, validating signatures and encrypting using
868 public-key cryptography. Asignify is designed to be portable and self-contained
869 with zero external dependencies. Asignify can verify OpenBSD signatures, but it
870 cannot sign messages in OpenBSD format yet.")
871 (license license:bsd-2))))
872
873 (define-public enchive
874 (package
875 (name "enchive")
876 (version "3.5")
877 (source (origin
878 (method git-fetch)
879 (uri (git-reference
880 (url "https://github.com/skeeto/enchive")
881 (commit version)))
882 (sha256
883 (base32
884 "0fdrfc5l42lj2bvmv9dmkmhmm7qiszwk7cmdvnqad3fs7652g0qa"))
885 (file-name (git-file-name name version))))
886 (build-system gnu-build-system)
887 (arguments
888 '(#:tests? #f ; no check target '
889 #:make-flags (list "CC=gcc" "PREFIX=$(out)")
890 #:phases (modify-phases %standard-phases
891 (delete 'configure)
892 (add-after 'install 'post-install
893 (lambda _
894 (let* ((out (assoc-ref %outputs "out"))
895 (lisp (string-append out "/share/emacs/site-lisp")))
896 (install-file "enchive-mode.el" lisp)
897 #t))))))
898 (synopsis "Encrypted personal archives")
899 (description
900 "Enchive is a tool to encrypt files to yourself for long-term
901 archival. It's a focused, simple alternative to more complex solutions such as
902 GnuPG or encrypted filesystems. Enchive has no external dependencies and is
903 trivial to build for local use. Portability is emphasized over performance.")
904 (home-page "https://github.com/skeeto/enchive")
905 (license license:unlicense)))
906
907 (define-public libsecp256k1
908 (let ((commit "d644dda5c9dbdecee52d1aa259235510fdc2d4ee"))
909 (package
910 (name "libsecp256k1")
911 (version (git-version "20191213" "1" commit))
912 (source (origin
913 (method git-fetch)
914 (uri (git-reference
915 (url "https://github.com/bitcoin-core/secp256k1")
916 (commit commit)))
917 (sha256
918 (base32
919 "0zmx32746khsm2cx0p3pdy3j2vkwmafvf7axiixijhgcg0xjv93i"))
920 (file-name (git-file-name name version))))
921 (build-system gnu-build-system)
922 (native-inputs
923 `(("autoconf" ,autoconf)
924 ("automake" ,automake)
925 ("libtool" ,libtool)))
926 ;; WARNING: This package might need additional configure flags to run properly.
927 ;; See https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libsecp256k1.
928 (synopsis "C library for EC operations on curve secp256k1")
929 (description
930 "Optimized C library for EC operations on curve secp256k1.
931
932 This library is a work in progress and is being used to research best
933 practices. Use at your own risk.
934
935 Features:
936
937 @itemize
938 @item secp256k1 ECDSA signing/verification and key generation.
939 @item Adding/multiplying private/public keys.
940 @item Serialization/parsing of private keys, public keys, signatures.
941 @item Constant time, constant memory access signing and pubkey generation.
942 @item Derandomized DSA (via RFC6979 or with a caller provided function.)
943 @item Very efficient implementation.
944 @end itemize\n")
945 (home-page "https://github.com/bitcoin-core/secp256k1")
946 (license license:unlicense))))
947
948 (define-public stoken
949 (package
950 (name "stoken")
951 (version "0.92")
952 (source (origin
953 (method url-fetch)
954 (uri (string-append "mirror://sourceforge/stoken/"
955 "stoken-" version ".tar.gz"))
956 (sha256
957 (base32
958 "0npgr6y85gzwksy8jkwa4yzvqwjprwnplx3yiw3ayk4f0ldlhaxa"))))
959 (build-system gnu-build-system)
960 (native-inputs
961 `(("pkg-config" ,pkg-config)))
962 (inputs
963 `(("nettle" ,nettle)
964 ("libxml2" ,libxml2)))
965 (home-page "http://stoken.sf.net")
966 (synopsis "Software Token for cryptographic authentication")
967 (description
968 "@code{stoken} is a token code generator compatible with RSA SecurID
969 128-bit (AES) tokens. This package contains a standalone command-line program
970 that allows for importing token seeds, generating token codes, and various
971 utility/testing functions.")
972 (license license:lgpl2.1+)))
973
974 (define-public hpenc
975 (package
976 (name "hpenc")
977 (version "3.0")
978 (source (origin
979 (method git-fetch)
980 (uri (git-reference
981 (url "https://github.com/vstakhov/hpenc")
982 (commit version)))
983 (file-name (git-file-name name version))
984 (sha256
985 (base32
986 "1fb5yi3d2k8kd4zm7liiqagpz610y168xrr1cvn7cbq314jm2my1"))))
987 (build-system gnu-build-system)
988 (arguments
989 `(#:tests? #f ; No test suite
990 #:make-flags
991 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
992 ;; Build the program and the docs.
993 "SUBDIRS=src doc")
994 #:phases
995 (modify-phases %standard-phases
996 (delete 'configure) ; No ./configure script
997 (add-after 'unpack 'patch-path
998 (lambda _
999 (substitute* '("src/Makefile" "doc/Makefile")
1000 (("/usr/bin/install")
1001 "install"))))
1002 (add-before 'install 'make-output-directories
1003 (lambda* (#:key outputs #:allow-other-keys)
1004 (let* ((out (assoc-ref outputs "out"))
1005 (bin (string-append out "/bin"))
1006 (man1 (string-append out "/share/man/man1")))
1007 (mkdir-p bin)
1008 (mkdir-p man1)
1009 #t))))))
1010 (inputs
1011 `(("libsodium" ,libsodium)
1012 ("openssl" ,openssl)))
1013 (synopsis "High-performance command-line tool for stream encryption")
1014 (description "Hpenc is a command-line tool for performing authenticated
1015 encryption (AES-GCM and ChaCha20-Poly1305) of streaming data. It does not
1016 perform an asymmetric key exchange, instead requiring the user to distribute
1017 pre-shared keys out of band. It is designed to handle large amounts of data
1018 quickly by using all your CPU cores and hardware acceleration.")
1019 (home-page "https://github.com/vstakhov/hpenc")
1020 (license license:bsd-3)))
1021
1022 (define-public minisign
1023 (package
1024 (name "minisign")
1025 (version "0.8")
1026 (source
1027 (origin
1028 (method url-fetch)
1029 (uri
1030 (string-append "https://github.com/jedisct1/minisign/releases/download/"
1031 version "/minisign-" version ".tar.gz"))
1032 (sha256
1033 (base32
1034 "10hhgwxf9rcdlr00shrkcyxndrc22dh5lj8k5z27xg3nc0jba3hk"))))
1035 (build-system cmake-build-system)
1036 (arguments
1037 ; No test suite
1038 `(#:tests? #f))
1039 (native-inputs
1040 `(("pkg-config" ,pkg-config)))
1041 (inputs
1042 `(("libsodium" ,libsodium)))
1043 (home-page "https://jedisct1.github.io/minisign")
1044 (synopsis "Tool to sign files and verify signatures")
1045 (description
1046 "Minisign is a dead simple tool to sign files and verify signatures. It is
1047 portable, lightweight, and uses the highly secure Ed25519 public-key signature
1048 system. Signature written by minisign can be verified using OpenBSD's
1049 signify tool: public key files and signature files are compatible. However,
1050 minisign uses a slightly different format to store secret keys. Minisign
1051 signatures include trusted comments in addition to untrusted comments.
1052 Trusted comments are signed, thus verified, before being displayed.")
1053 (license license:isc)))
1054
1055 (define-public libolm
1056 (package
1057 (name "libolm")
1058 (version "3.1.4")
1059 (source (origin
1060 (method git-fetch)
1061 (uri (git-reference
1062 (url "https://git.matrix.org/git/olm")
1063 (commit version)))
1064 (sha256
1065 (base32
1066 "06s7rw4a9vn35wzz7chxn54mp0sjgbpv2bzz9lq0g4hnzw33cjbi"))
1067 (file-name (git-file-name name version))))
1068 (arguments
1069 `(#:phases
1070 (modify-phases %standard-phases
1071 (replace 'check
1072 (lambda _
1073 (invoke "ctest" "build/tests"))))))
1074 (build-system cmake-build-system)
1075 (synopsis "Implementation of the olm and megolm cryptographic ratchets")
1076 (description "The libolm library implements the Double Ratchet
1077 cryptographic ratchet. It is written in C and C++11, and exposed as a C
1078 API.")
1079 (home-page "https://matrix.org/docs/projects/other/olm/")
1080 (license license:asl2.0)))