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–2021 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
8 ;;; Copyright © 2016, 2017, 2019, 2020 Eric Bavier <bavier@posteo.net>
9 ;;; Copyright © 2017 Pierre Langlois <pierre.langlois@gmx.com>
10 ;;; Copyright © 2018, 2020 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 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
19 ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
20 ;;; Copyright © 2020 Hendur Saga <hendursaga@yahoo.com>
21 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
23 ;;; This file is part of GNU Guix.
25 ;;; GNU Guix is free software; you can redistribute it and/or modify it
26 ;;; under the terms of the GNU General Public License as published by
27 ;;; the Free Software Foundation; either version 3 of the License, or (at
28 ;;; your option) any later version.
30 ;;; GNU Guix is distributed in the hope that it will be useful, but
31 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
32 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 ;;; GNU General Public License for more details.
35 ;;; You should have received a copy of the GNU General Public License
36 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
38 (define-module (gnu packages crypto)
39 #:use-module (gnu packages)
40 #:use-module (gnu packages admin)
41 #:use-module (gnu packages aidc)
42 #:use-module (gnu packages attr)
43 #:use-module (gnu packages autotools)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages check)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages crates-io)
48 #:use-module (gnu packages cryptsetup)
49 #:use-module (gnu packages gettext)
50 #:use-module (gnu packages gnupg)
51 #:use-module (gnu packages golang)
52 #:use-module (gnu packages image)
53 #:use-module (gnu packages kerberos)
54 #:use-module (gnu packages libbsd)
55 #:use-module (gnu packages libffi)
56 #:use-module (gnu packages linux)
57 #:use-module (gnu packages lsof)
58 #:use-module (gnu packages man)
59 #:use-module (gnu packages multiprecision)
60 #:use-module (gnu packages nettle)
61 #:use-module (gnu packages password-utils)
62 #:use-module (gnu packages perl)
63 #:use-module (gnu packages perl-check)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages python)
66 #:use-module (gnu packages python-xyz)
67 #:use-module (gnu packages readline)
68 #:use-module (gnu packages search)
69 #:use-module (gnu packages serialization)
70 #:use-module (gnu packages shells)
71 #:use-module (gnu packages sqlite)
72 #:use-module (gnu packages tcl)
73 #:use-module (gnu packages tls)
74 #:use-module (gnu packages xml)
75 #:use-module ((guix licenses) #:prefix license:)
76 #:use-module (guix packages)
77 #:use-module (guix download)
78 #:use-module (guix git-download)
79 #:use-module (guix build-system cargo)
80 #:use-module (guix build-system cmake)
81 #:use-module (guix build-system gnu)
82 #:use-module (guix build-system go)
83 #:use-module (guix build-system perl)
84 #:use-module (guix utils)
85 #:use-module (srfi srfi-1)
86 #:use-module (srfi srfi-26))
88 (define-public libsodium
94 (uri (list (string-append
95 "https://download.libsodium.org/libsodium/"
96 "releases/libsodium-" version ".tar.gz")
98 "https://download.libsodium.org/libsodium/"
99 "releases/old/libsodium-" version ".tar.gz")))
102 "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g"))))
103 (build-system gnu-build-system)
104 (synopsis "Portable NaCl-based crypto library")
106 "Sodium is a new easy-to-use high-speed software library for network
107 communication, encryption, decryption, signatures, etc.")
108 (license license:isc)
109 (home-page "https://libsodium.org")))
119 (string-append "https://archive.hadrons.org/software/libmd/libmd-"
121 (string-append "https://libbsd.freedesktop.org/releases/libmd-"
125 "0waclg2d5qin3r26gy5jvy4584ik60njc8pqbzwk0lzq3j9ynkp1"))))
126 (build-system gnu-build-system)
127 (synopsis "Message Digest functions from BSD systems")
129 "The currently provided message digest algorithms are:
136 @item SHA-2 (SHA-256, SHA-384 and SHA-512)
138 (license (list license:bsd-3
141 license:public-domain))
142 (home-page "https://www.hadrons.org/software/libmd/")))
144 (define-public signify
148 (home-page "https://github.com/aperezdc/signify")
151 (uri (string-append "https://github.com/aperezdc/signify/releases"
152 "/download/v" version "/signify-" version ".tar.xz"))
155 "11l67j04gyxnlw6zrzsygqs5cgsc1sww1rh0apl05yay131hd17n"))))
156 (build-system gnu-build-system)
157 ;; TODO Build with libwaive (described in README.md), to implement something
158 ;; like OpenBSD's pledge().
162 (string-append "PREFIX=" (assoc-ref %outputs "out")))
164 (modify-phases %standard-phases
165 (delete 'configure))))
167 `(("pkg-config" ,pkg-config)))
169 `(("libbsd" ,libbsd)))
170 (synopsis "Create and verify cryptographic signatures")
171 (description "The signify utility creates and verifies cryptographic
172 signatures using the elliptic curve Ed25519. This is a Linux port of the
173 OpenBSD tool of the same name.")
174 ;; This package includes third-party code that was originally released under
175 ;; various non-copyleft licenses. See the source files for clarification.
176 (license (list license:bsd-3 license:bsd-4 license:expat license:isc
177 license:public-domain (license:non-copyleft
179 "See base64.c in the distribution for
180 the license from IBM.")))))
182 (define-public rust-minisign
184 (name "rust-minisign")
189 (uri (crate-uri "minisign" version))
191 (string-append name "-" version ".tar.gz"))
194 "0xmcvh2snravghaar8igc6b9r3s1snnmf9qam9l3zyhm4987767y"))))
195 (build-system cargo-build-system)
198 (("rust-getrandom" ,rust-getrandom-0.1)
199 ("rust-rpassword" ,rust-rpassword-4)
200 ("rust-scrypt" ,rust-scrypt-0.3))))
201 (home-page "https://github.com/jedisct1/rust-minisign")
202 (synopsis "Crate to sign files and verify signatures")
204 "This package provides a crate to sign files and verify signatures.")
205 (license license:expat)))
207 (define-public go-minisign
215 (url "https://github.com/jedisct1/go-minisign")
217 (file-name (git-file-name name version))
220 "0wc0rk5m60yz52f0cncmbgq67yvb1rcx91gvzjg6jpc4mpw2db27"))
221 (modules '((guix build utils)))
223 '(begin (delete-file-recursively "vendor") #t))))
224 (build-system go-build-system)
226 '(#:import-path "github.com/jedisct1/go-minisign"))
228 `(("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))
229 (home-page "https://github.com/jedisct1/go-minisign")
230 (synopsis "Minisign verification library for Golang")
231 (description "A Golang library to verify Minisign signatures.")
232 (license license:expat)))
242 (string-append "https://github.com/vgough/encfs/releases/download/v"
243 version "/encfs-" version ".tar.gz"))
246 "0qzxavvv20577bxvly8s7d3y7bqasqclc2mllp0ddfncjm9z02a7"))
247 (modules '((guix build utils)))
248 ;; Remove bundled dependencies in favour of proper inputs.
250 (for-each delete-file-recursively
251 '("vendor/github.com/leethomason/tinyxml2"
252 "vendor/github.com/google/googletest"))
254 (build-system cmake-build-system)
256 `(("gettext" ,gettext-minimal)
258 ;; Test dependencies.
260 ("googletest-source" ,(package-source googletest))
266 ("tinyxml2" ,tinyxml2)))
268 `(#:configure-flags (list "-DUSE_INTERNAL_TINYXML=OFF")
270 (modify-phases %standard-phases
271 (add-after 'unpack 'unpack-googletest
272 (lambda* (#:key inputs #:allow-other-keys)
273 (mkdir-p "vendor/github.com/google/googletest")
274 (copy-recursively (assoc-ref inputs "googletest-source")
275 "vendor/github.com/google/googletest")
277 (add-before 'configure 'patch-CMakeLists.txt
279 ;; Prevent CMake from adding libc on the system include path.
280 ;; Otherwise it will interfere with the libc used by GCC and
281 ;; ultimately cause #include_next errors.
282 (substitute* "CMakeLists.txt"
283 (("include_directories \\(SYSTEM \\$\\{Intl_INCLUDE_DIRS\\}\\)")
286 (add-before 'check 'make-unittests
288 (invoke "make" "unittests"))))))
289 (home-page "https://vgough.github.io/encfs")
290 (synopsis "Encrypted virtual file system")
292 "EncFS creates a virtual encrypted file system in user-space. Each file
293 created under an EncFS mount point is stored as a separate encrypted file on
294 the underlying file system. Like most encrypted file systems, EncFS is meant
295 to provide security against off-line attacks, such as a drive falling into
297 (license (list license:expat ; internal/easylogging++.h
298 license:lgpl3+ ; encfs library
299 license:gpl3+)))) ; command-line tools
301 (define-public keyutils
309 (string-append "https://people.redhat.com/dhowells/keyutils/keyutils-"
312 (base32 "1kk4pmyflgplkgxn2bzpc069ph9c9jdd9ikcsyd5pnaimqi5gcf8"))
313 (modules '((guix build utils)))
314 ;; Create relative symbolic links instead of absolute ones to /lib/*.
316 (substitute* "Makefile" (("\\$\\(LNS\\) \\$\\(LIBDIR\\)/")
319 (build-system gnu-build-system)
321 `(#:phases (modify-phases %standard-phases
322 (delete 'configure)) ; no configure script
323 #:make-flags (list "CC=gcc"
324 "RPATH=-Wl,-rpath,$(DESTDIR)$(LIBDIR)"
325 (string-append "DESTDIR="
326 (assoc-ref %outputs "out"))
327 "INCLUDEDIR=/include"
330 "SHAREDIR=/share/keyutils")
331 #:test-target "test"))
333 `(("mit-krb5" ,mit-krb5)))
334 (home-page "https://people.redhat.com/dhowells/keyutils/")
335 (synopsis "Linux key management utilities")
337 "Keyutils is a set of utilities for managing the key retention facility in
338 the Linux kernel, which can be used by file systems, block devices, and more to
339 gain and retain the authorization and encryption keys required to perform
340 secure operations. ")
341 (license (list license:lgpl2.1+ ; the files keyutils.*
342 license:gpl2+)))) ; the rest
344 ;; There is no release candidate but commits point out a version number,
345 ;; furthermore no tarball exists.
346 (define-public eschalot
347 (let ((commit "0bf31d88a11898c19b1ed25ddd2aff7b35dbac44")
351 (version (string-append "1.2.0-" revision "." (string-take commit 7)))
356 (url "https://github.com/schnabear/eschalot")
358 (file-name (string-append name "-" version))
361 "0lj38ldh8vzi11wp4ghw4k0fkwp0s04zv8k8d473p1snmbh7mx98"))))
363 `(("openssl" ,openssl-1.0))) ; for openssl/{bn,pem,rsa,sha}.h
364 (build-system gnu-build-system)
366 `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
367 (string-append "PREFIX=" (assoc-ref %outputs "out"))
368 (string-append "INSTALL=" "install"))
369 ;; XXX: make test would run a !VERY! long hashing of names with the use
370 ;; of a wordlist, the amount of computing time this would waste on build
371 ;; servers is in no relation to the size or importance of this small
372 ;; application, therefore we run our own tests on eschalot and worgen.
374 (modify-phases %standard-phases
378 (invoke "./worgen" "8-12" "top1000.txt" "3-10" "top400nouns.txt"
379 "3-6" "top150adjectives.txt" "3-6")
380 (invoke "./eschalot" "-r" "^guix|^guixsd")
381 (invoke "./eschalot" "-r" "^gnu|^free")
382 (invoke "./eschalot" "-r" "^cyber|^hack")
383 (invoke "./eschalot" "-r" "^troll")))
384 ;; Make install can not create the bin dir, create it.
385 (add-before 'install 'create-bin-dir
386 (lambda* (#:key outputs #:allow-other-keys)
387 (let* ((out (assoc-ref outputs "out"))
388 (bin (string-append out "/bin")))
391 (home-page "https://github.com/schnabear/eschalot")
392 (synopsis "Tor hidden service name generator")
394 "Eschalot is a tor hidden service name generator, it allows one to
395 produce customized vanity .onion addresses using a brute-force method. Searches
396 for valid names can be run with regular expressions and wordlists. For the
397 generation of wordlists the included tool @code{worgen} can be used. There is
398 no man page, refer to the home page for usage details.")
399 (license (list license:isc license:expat)))))
407 (uri (string-append "http://point-at-infinity.org/ssss/ssss-"
411 "15grn2fp1x8p92kxkwbmsx8rz16g93y9grl3hfqbh1jn21ama5jx"))))
412 (build-system gnu-build-system)
414 `(#:tests? #f ; No test suite
415 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
418 (modify-phases %standard-phases
419 (delete 'configure) ; no configuration to be done
421 (lambda* (#:key outputs #:allow-other-keys)
422 (let* ((outdir (assoc-ref outputs "out"))
423 (bindir (string-append outdir "/bin"))
424 (docdir (string-append outdir
427 (install-file "ssss-combine" bindir)
428 (install-file "ssss-split" bindir)
429 (install-file "ssss.1" docdir)
430 (install-file "ssss.1.html" docdir)
435 `(("xmltoman" ,xmltoman)))
436 (home-page "http://point-at-infinity.org/ssss/")
437 (synopsis "Shamir's secret sharing scheme implementation")
438 (description "@command{ssss-split} and @command{ssss-combine} are utilities that split
439 and combine secrets securely using Shamir's secret sharing scheme. This implementation
440 allows for a threshold scheme where the minimum number of shares can be less than the
441 total number of shares generated.")
442 (license license:gpl2+)))
450 (uri (string-append "https://files.dyne.org/tomb/releases/"
451 "Tomb-" version ".tar.gz"))
454 "136nfnpaz29hngwwnzrmc858gpnvnb977gf4ldbpapw1h1k3r8mk"))))
455 (build-system gnu-build-system)
456 (native-inputs `(("sudo" ,sudo))) ;presence needed for 'check' phase
460 ("cryptsetup" ,cryptsetup)
461 ("e2fsprogs" ,e2fsprogs) ;for mkfs.ext4
462 ("gettext" ,gettext-minimal) ;used at runtime
465 ("pinentry" ,pinentry)
466 ("qrencode" ,qrencode)
467 ("steghide" ,steghide)
468 ("util-linux" ,util-linux)))
470 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
471 ;; The "sudo" input is needed only to satisfy dependency checks in the
472 ;; 'check' phase. The "sudo" used at runtime should come from the
473 ;; system's setuid-programs, so ensure no reference is kept.
474 #:disallowed-references (,sudo)
475 ;; TODO: Build and install gtk and qt trays
477 (modify-phases %standard-phases
478 (delete 'configure) ;no configuration to be done
479 (add-after 'install 'i18n
480 (lambda* (#:key make-flags #:allow-other-keys)
481 (apply invoke "make" "-C" "extras/translations"
482 "install" make-flags)
484 (add-after 'install 'wrap
485 (lambda* (#:key inputs outputs #:allow-other-keys)
486 (let ((out (assoc-ref outputs "out")))
487 (wrap-program (string-append out "/bin/tomb")
489 (,(string-append (assoc-ref inputs "mlocate") "/bin")
490 ,@(map (lambda (program)
491 (or (and=> (which program) dirname)
492 (error "program not found:" program)))
493 '("seq" "mkfs.ext4" "pinentry"
494 "gpg" "cryptsetup" "gettext" "lsof"
495 "qrencode" "steghide" "findmnt" "getent")))))
498 (add-after 'wrap 'check
499 (lambda* (#:key outputs #:allow-other-keys)
500 ;; Running the full tests requires sudo/root access for
501 ;; cryptsetup, which is not available in the build environment.
502 ;; But we can run `tomb dig` without root, so make sure that
503 ;; works. TODO: It Would Be Nice to check the expected "index",
504 ;; "search", "bury", and "exhume" features are available by
505 ;; querying `tomb -h`.
506 (let ((tomb (string-append (assoc-ref outputs "out")
508 (invoke tomb "dig" "-s" "10" "secrets.tomb")
510 (home-page "https://www.dyne.org/software/tomb")
511 (synopsis "File encryption for secret data")
513 "Tomb is an application to manage the creation and access of encrypted
514 storage files: it can be operated from commandline and it can integrate with a
515 user's graphical desktop.")
516 (license license:gpl3+)))
518 (define-public scrypt
525 (uri (string-append "https://www.tarsnap.com/scrypt/scrypt-"
529 "1hnl0r6pmyxiy4dmafmqk1db7wpc0x9rqpzqcwr9d2cmghcj6byz"))))
530 (build-system gnu-build-system)
532 `(#:license-file-regexp "COPYRIGHT"
533 #:phases (modify-phases %standard-phases
534 (add-after 'unpack 'patch-$PATH-assumptions
536 (substitute* "configure"
537 (("\\{POSIX_PATH\\}")
539 (substitute* "Makefile.in"
542 (add-after 'install 'install-docs
543 (lambda* (#:key outputs #:allow-other-keys)
544 (let* ((out (assoc-ref %outputs "out"))
545 (doc (string-append out "/share/doc/" ,name "-" ,version)))
546 (install-file "FORMAT" doc)
549 `(("openssl" ,openssl)))
550 (home-page "https://www.tarsnap.com/scrypt.html")
551 (synopsis "Memory-hard encryption tool based on scrypt")
552 (description "This package provides a simple password-based encryption
553 utility as a demonstration of the @code{scrypt} key derivation function.
554 @code{Scrypt} is designed to be far more resistant against hardware brute-force
555 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
556 (license license:bsd-2)))
558 (define-public libscrypt
566 (url "https://github.com/technion/libscrypt")
567 (commit (string-append "v" version))))
568 (file-name (git-file-name name version))
571 "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng"))))
572 (build-system gnu-build-system)
573 (outputs (list "out" "static"))
575 `(#:make-flags (list (string-append "PREFIX=" %output)
578 (modify-phases %standard-phases
579 (delete 'configure) ; no configure script
580 (add-after 'install 'install:static
581 (lambda* (#:key outputs #:allow-other-keys)
582 (let* ((out (assoc-ref outputs "out"))
583 (lib (string-append out "/lib")))
584 (install-file "libscrypt.a" lib)
586 (home-page "https://lolware.net/libscrypt.html")
587 (synopsis "Password hashing library")
588 (description "@code{libscrypt} implements @code{scrypt} key derivation
589 function. It is designed to be far more secure against hardware brute-force
590 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
591 (license license:bsd-3)))
593 (define-public perl-math-random-isaac-xs
595 (name "perl-math-random-isaac-xs")
600 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
601 "Math-Random-ISAAC-XS-" version ".tar.gz"))
604 "0yxqqcqvj51fn7b7j5xqhz65v74arzgainn66c6k7inijbmr1xws"))))
605 (build-system perl-build-system)
607 `(("perl-module-build" ,perl-module-build)
608 ("perl-test-nowarnings" ,perl-test-nowarnings)))
609 (home-page "https://metacpan.org/release/Math-Random-ISAAC-XS")
610 (synopsis "C implementation of the ISAAC PRNG algorithm")
611 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
612 fast pseudo-random number generator. It is suitable for applications where a
613 significant amount of random data needs to be produced quickly, such as
614 solving using the Monte Carlo method or for games. The results are uniformly
615 distributed, unbiased, and unpredictable unless you know the seed.
617 This package implements the same interface as @code{Math::Random::ISAAC}.")
618 (license license:public-domain)))
620 (define-public perl-math-random-isaac
622 (name "perl-math-random-isaac")
627 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
628 "Math-Random-ISAAC-" version ".tar.gz"))
631 "0z1b3xbb3xz71h25fg6jgsccra7migq7s0vawx2rfzi0pwpz0wr7"))))
632 (build-system perl-build-system)
634 `(("perl-test-nowarnings" ,perl-test-nowarnings)))
636 `(("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)))
637 (home-page "https://metacpan.org/release/Math-Random-ISAAC")
638 (synopsis "Perl interface to the ISAAC PRNG algorithm")
639 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
640 fast pseudo-random number generator. It is suitable for applications where a
641 significant amount of random data needs to be produced quickly, such as
642 solving using the Monte Carlo method or for games. The results are uniformly
643 distributed, unbiased, and unpredictable unless you know the seed.
645 This package provides a Perl interface to the ISAAC pseudo random number
647 (license license:public-domain)))
649 (define-public perl-crypt-random-source
651 (name "perl-crypt-random-source")
656 (uri (string-append "mirror://cpan/authors/id/E/ET/ETHER/"
657 "Crypt-Random-Source-" version ".tar.gz"))
659 (base32 "1rpdds3sy5l1fhngnkrsgwsmwd54wpicx3i9ds69blcskwkcwkpc"))))
660 (build-system perl-build-system)
662 `(("perl-module-build-tiny" ,perl-module-build-tiny)
663 ("perl-test-fatal" ,perl-test-fatal)))
665 `(("perl-capture-tiny" ,perl-capture-tiny)
666 ("perl-module-find" ,perl-module-find)
667 ("perl-module-runtime" ,perl-module-runtime)
668 ("perl-moo" ,perl-moo)
669 ("perl-namespace-clean" ,perl-namespace-clean)
670 ("perl-sub-exporter" ,perl-sub-exporter)
671 ("perl-type-tiny" ,perl-type-tiny)))
672 (home-page "https://metacpan.org/release/Crypt-Random-Source")
673 (synopsis "Get weak or strong random data from pluggable sources")
674 (description "This module provides implementations for a number of
675 byte-oriented sources of random data.")
676 (license license:perl-license)))
678 (define-public perl-math-random-secure
680 (name "perl-math-random-secure")
685 (uri (string-append "mirror://cpan/authors/id/F/FR/FREW/"
686 "Math-Random-Secure-" version ".tar.gz"))
689 "0dgbf4ncll4kmgkyb9fsaxn0vf2smc9dmwqzgh3259zc2zla995z"))))
690 (build-system perl-build-system)
692 `(("perl-list-moreutils" ,perl-list-moreutils)
693 ("perl-test-leaktrace" ,perl-test-leaktrace)
694 ("perl-test-sharedfork" ,perl-test-sharedfork)
695 ("perl-test-warn" ,perl-test-warn)))
697 `(("perl-crypt-random-source" ,perl-crypt-random-source)
698 ("perl-math-random-isaac" ,perl-math-random-isaac)
699 ("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)
700 ("perl-moo" ,perl-moo)))
701 (home-page "https://metacpan.org/release/Math-Random-Secure")
702 (synopsis "Cryptographically secure replacement for rand()")
703 (description "This module is intended to provide a
704 cryptographically-secure replacement for Perl's built-in @code{rand} function.
705 \"Crytographically secure\", in this case, means:
708 @item No matter how many numbers you see generated by the random number
709 generator, you cannot guess the future numbers, and you cannot guess the seed.
710 @item There are so many possible seeds that it would take decades, centuries,
711 or millennia for an attacker to try them all.
712 @item The seed comes from a source that generates relatively strong random
713 data on your platform, so the seed itself will be as random as possible.
715 (license license:artistic2.0)))
717 (define-public crypto++
722 (method url-fetch/zipbomb)
723 (uri (string-append "https://cryptopp.com/cryptopp"
724 (string-join (string-split version #\.) "")
728 "16kvfm11xv7j9a3yykzysjgw38a9b7lnc5n5x5h82g395k6ybxf0"))))
729 (build-system gnu-build-system)
732 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
733 ;; Override "/sbin/ldconfig" with simply "echo" since
734 ;; we don't need ldconfig(8).
737 (modify-phases %standard-phases
738 (add-after 'unpack 'disable-native-optimisation
739 ;; This package installs more than just headers. Ensure that the
740 ;; cryptest.exe binary & static library aren't CPU model specific.
742 (substitute* "GNUmakefile"
743 ((" -march=native") ""))
747 ;; By default, only the static library is built.
748 (lambda* (#:key (make-flags '()) #:allow-other-keys)
749 (apply invoke "make" "shared"
750 "-j" (number->string (parallel-job-count))
752 (add-after 'install 'install-shared-library-links
753 ;; By default, only .so and .so.x.y.z are installed.
754 ;; Create all the ‘intermediates’ expected by dependent packages.
755 (lambda* (#:key outputs #:allow-other-keys)
756 (let* ((out (assoc-ref outputs "out"))
757 (lib (string-append out "/lib"))
758 (prefix "libcryptopp.so.")
759 (target (string-append prefix ,version)))
760 (with-directory-excursion lib
762 (string-append prefix ,(version-major+minor version)))
764 (string-append prefix ,(version-major version)))
766 (add-after 'install 'install-pkg-config
767 (lambda* (#:key outputs #:allow-other-keys)
768 (let* ((out (assoc-ref outputs "out"))
769 (pkg-dir (string-append out "/lib/pkgconfig")))
771 (with-output-to-file (string-append pkg-dir "/libcrypto++.pc")
776 "libdir=" out "/lib\n"
777 "includedir=" out "/include\n\n"
778 "Name: libcrypto++-" ,version "\n"
779 "Description: Class library of cryptographic schemes\n"
780 "Version: " ,version "\n"
781 "Libs: -L${libdir} -lcryptopp\n"
782 "Cflags: -I${includedir}\n"))
786 (home-page "https://cryptopp.com/")
787 (synopsis "C++ class library of cryptographic schemes")
788 (description "Crypto++ is a C++ class library of cryptographic schemes.")
789 ;; The compilation is distributed under the Boost license; the individual
790 ;; files in the compilation are in the public domain.
791 (license (list license:boost1.0 license:public-domain))))
800 "https://github.com/BLAKE2/libb2/releases/download/v"
801 version "/libb2-" version ".tar.gz"))
804 "0bn7yrzdixdvzm46shbhpkqbr6zyqyxiqn7a7x54ag3mrvfnyqjk"))))
805 (build-system gnu-build-system)
809 ,@(if (any (cute string-prefix? <> (or (%current-system)
810 (%current-target-system)))
812 ;; fat only checks for Intel optimisations
815 "--disable-native"))) ;don't optimise at build time
816 (home-page "https://blake2.net/")
817 (synopsis "Library implementing the BLAKE2 family of hash functions")
819 "libb2 is a portable implementation of the BLAKE2 family of cryptographic
820 hash functions. It includes optimised implementations for IA-32 and AMD64
821 processors, and an interface layer that automatically selects the best
822 implementation for the processor it is run on.
824 @dfn{BLAKE2} (RFC 7693) is a family of high-speed cryptographic hash functions
825 that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
826 as the latest standard, SHA-3. It is an improved version of the SHA-3 finalist
828 (license license:public-domain)))
837 (uri (string-append "mirror://sourceforge/rhash/rhash/" version
838 "/rhash-" version "-src.tar.gz"))
839 (file-name (string-append "rhash-" version ".tar.gz"))
842 "1xn9fqa6rlnhsbgami45g82dlw9i1skg2sri3ydiinwak5ph1ca2"))))
843 (build-system gnu-build-system)
846 (list (string-append "--prefix=" (assoc-ref %outputs "out"))
847 ,@(let ((target (%current-target-system)))
849 `((string-append "--target=" ,target)
850 (string-append "--cc="
851 (assoc-ref %build-inputs "cross-gcc")
852 "/bin/" ,target "-gcc"))
855 ;; The binaries in /bin need some help finding librhash.so.0.
856 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
857 #:test-target "test" ; ‘make check’ just checks the sources
859 (modify-phases %standard-phases
861 ;; ./configure is not GNU autotools' and doesn't gracefully handle
862 ;; unrecognized options, so we must call it manually.
863 (lambda* (#:key configure-flags #:allow-other-keys)
864 (apply invoke "./configure" configure-flags)))
865 (add-before 'check 'patch-/bin/sh
867 (substitute* "Makefile"
868 (("/bin/sh") (which "sh")))
870 (add-after 'install 'install-library-extras
871 (lambda* (#:key make-flags #:allow-other-keys)
873 "make" "-C" "librhash"
874 "install-lib-headers" "install-so-link"
876 (home-page "https://sourceforge.net/projects/rhash/")
877 (synopsis "Utility for computing hash sums")
878 (description "RHash is a console utility for calculation and verification
879 of magnet links and a wide range of hash sums like CRC32, MD4, MD5, SHA1,
880 SHA256, SHA512, SHA3, AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R
881 34.11-94, RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.")
882 (license (license:non-copyleft "file://COPYING"))))
890 (uri (string-append "https://botan.randombit.net/releases/"
891 "Botan-" version ".tar.xz"))
894 "1ada3ga7b0z4m0vjmxlvfi4nsic2l8kjcy85jwss3z2i58a5y0vy"))))
895 (build-system gnu-build-system)
898 (modify-phases %standard-phases
900 (lambda* (#:key inputs outputs #:allow-other-keys)
901 (let* ((out (assoc-ref %outputs "out"))
902 (lib (string-append out "/lib")))
903 ;; Upstream tests and benchmarks with -O3.
904 (setenv "CXXFLAGS" "-O3")
905 (invoke "python" "./configure.py"
906 (string-append "--prefix=" out)
907 ;; Otherwise, the `botan` executable cannot find
909 (string-append "--ldflags=-Wl,-rpath=" lib)
911 "--with-os-feature=getentropy"
914 ;; Recommended by upstream
915 "--with-zlib" "--with-bzip2" "--with-sqlite3"))))
917 (lambda _ (invoke "./botan-test"))))))
919 `(("python" ,python-wrapper)
920 ("python-docutils" ,python-docutils)))
925 (synopsis "Cryptographic library in C++11")
926 (description "Botan is a cryptography library, written in C++11, offering
927 the tools necessary to implement a range of practical systems, such as TLS/DTLS,
928 PKIX certificate handling, PKCS#11 and TPM hardware support, password hashing,
929 and post-quantum crypto schemes. In addition to the C++, botan has a C89 API
930 specifically designed to be easy to call from other languages. A Python binding
931 using ctypes is included, and several other language bindings are available.")
932 (home-page "https://botan.randombit.net")
933 (license license:bsd-2)))
935 (define-public ccrypt
941 (uri (string-append "mirror://sourceforge/ccrypt/"
942 version "/ccrypt-" version ".tar.gz"))
945 "0kx4a5mhmp73ljknl2lcccmw9z3f5y8lqw0ghaymzvln1984g75i"))))
946 (build-system gnu-build-system)
947 (home-page "http://ccrypt.sourceforge.net")
948 (synopsis "Command-line utility for encrypting and decrypting files and streams")
949 (description "@command{ccrypt} is a utility for encrypting and decrypting
950 files and streams. It was designed as a replacement for the standard unix
951 @command{crypt} utility, which is notorious for using a very weak encryption
952 algorithm. @command{ccrypt} is based on the Rijndael block cipher, a version of
953 which is also used in the Advanced Encryption Standard (AES, see
954 @url{http://www.nist.gov/aes}). This cipher is believed to provide very strong
956 (license license:gpl2)))
958 (define-public asignify
959 (let ((commit "f58e7977a599f040797975d649ed318e25cbd2d5")
963 (version (git-version "1.1" revision commit))
967 (url "https://github.com/vstakhov/asignify")
969 (file-name (git-file-name name version))
972 "1zl68qq6js6fdahxzyhvhrpyrwlv8c2zhdplycnfxyr1ckkhq8dw"))))
973 (build-system gnu-build-system)
976 (list "--enable-openssl"
977 (string-append "--with-openssl="
978 (assoc-ref %build-inputs "openssl")))))
980 `(("autoconf" ,autoconf)
981 ("automake" ,automake)
982 ("libtool" ,libtool)))
984 `(("openssl" ,openssl)))
985 (home-page "https://github.com/vstakhov/asignify")
986 (synopsis "Cryptographic authentication and encryption tool and library")
987 (description "Asignify offers public cryptographic signatures and
988 encryption with a library or a command-line tool. The tool is heavily inspired
989 by signify as used in OpenBSD. The main goal of this project is to define a
990 high level API for signing files, validating signatures and encrypting using
991 public-key cryptography. Asignify is designed to be portable and self-contained
992 with zero external dependencies. Asignify can verify OpenBSD signatures, but it
993 cannot sign messages in OpenBSD format yet.")
994 (license license:bsd-2))))
996 (define-public enchive
1003 (url "https://github.com/skeeto/enchive")
1007 "0fdrfc5l42lj2bvmv9dmkmhmm7qiszwk7cmdvnqad3fs7652g0qa"))
1008 (file-name (git-file-name name version))))
1009 (build-system gnu-build-system)
1011 '(#:tests? #f ; no check target '
1012 #:make-flags (list "CC=gcc" "PREFIX=$(out)")
1013 #:phases (modify-phases %standard-phases
1015 (add-after 'install 'post-install
1017 (let* ((out (assoc-ref %outputs "out"))
1018 (lisp (string-append out "/share/emacs/site-lisp")))
1019 (install-file "enchive-mode.el" lisp)
1021 (synopsis "Encrypted personal archives")
1023 "Enchive is a tool to encrypt files to yourself for long-term
1024 archival. It's a focused, simple alternative to more complex solutions such as
1025 GnuPG or encrypted filesystems. Enchive has no external dependencies and is
1026 trivial to build for local use. Portability is emphasized over performance.")
1027 (home-page "https://github.com/skeeto/enchive")
1028 (license license:unlicense)))
1030 (define-public libsecp256k1
1031 (let ((commit "dbd41db16a0e91b2566820898a3ab2d7dad4fe00"))
1033 (name "libsecp256k1")
1034 (version (git-version "20200615" "1" commit))
1038 (url "https://github.com/bitcoin-core/secp256k1")
1042 "1fcpnksq5cqwqzshn5f0lq94b73p3frwbp04hgmmbnrndpqg6mpy"))
1043 (file-name (git-file-name name version))))
1044 (build-system gnu-build-system)
1046 '(#:configure-flags '("--enable-module-recovery"
1047 "--enable-experimental"
1048 "--enable-module-ecdh"
1049 "--enable-shared")))
1051 `(("autoconf" ,autoconf)
1052 ("automake" ,automake)
1053 ("libtool" ,libtool)))
1054 ;; WARNING: This package might need additional configure flags to run properly.
1055 ;; See https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libsecp256k1.
1056 (synopsis "C library for EC operations on curve secp256k1")
1058 "Optimized C library for EC operations on curve secp256k1.
1060 This library is a work in progress and is being used to research best
1061 practices. Use at your own risk.
1066 @item secp256k1 ECDSA signing/verification and key generation.
1067 @item Adding/multiplying private/public keys.
1068 @item Serialization/parsing of private keys, public keys, signatures.
1069 @item Constant time, constant memory access signing and pubkey generation.
1070 @item Derandomized DSA (via RFC6979 or with a caller provided function.)
1071 @item Very efficient implementation.
1073 (home-page "https://github.com/bitcoin-core/secp256k1")
1074 (license license:unlicense))))
1076 (define-public libsecp256k1-bitcoin-cash
1078 (name "libsecp256k1-bitcoin-cash")
1084 (url "https://github.com/Bitcoin-ABC/secp256k1")
1085 (commit (string-append "v" version))))
1086 (file-name (git-file-name name version))
1088 (base32 "1rnif3iny6pz1r3g69bagzr342mm3x0v66b60csnmm1rg44bd5v1"))))
1089 (build-system gnu-build-system)
1091 `(("autoconf" ,autoconf)
1092 ("automake" ,automake)
1093 ("libtool" ,libtool)))
1095 '(#:configure-flags '("--enable-module-recovery"
1096 "--enable-experimental"
1097 "--enable-module-ecdh"
1100 "--enable-module-schnorr"
1102 "--enable-shared")))
1103 (synopsis "Optimized C library for EC operations on curve secp256k1")
1105 "Optimized C library for cryptographic operations on curve secp256k1.
1107 This library is used for consensus critical cryptographic operations on the
1108 Bitcoin Cash network.
1113 @item secp256k1 ECDSA signing/verification and key generation.
1114 @item secp256k1 Schnorr signing/verification (Bitcoin Cash Schnorr variant).
1115 @item Additive and multiplicative tweaking of secret/public keys.
1116 @item Serialization/parsing of secret keys, public keys, signatures.
1117 @item Constant time, constant memory access signing and pubkey generation.
1118 @item Derandomized ECDSA (via RFC6979 or with a caller provided function).
1119 @item Very efficient implementation.
1120 @item Suitable for embedded systems.
1121 @item Optional module for public key recovery.
1122 @item Optional module for ECDH key exchange (experimental).
1123 @item Optional module for multiset hash (experimental).
1125 (home-page "https://github.com/Bitcoin-ABC/secp256k1")
1126 (license license:expat)))
1128 (define-public stoken
1134 (uri (string-append "mirror://sourceforge/stoken/"
1135 "stoken-" version ".tar.gz"))
1138 "0npgr6y85gzwksy8jkwa4yzvqwjprwnplx3yiw3ayk4f0ldlhaxa"))))
1139 (build-system gnu-build-system)
1141 `(("pkg-config" ,pkg-config)))
1143 `(("nettle" ,nettle)
1144 ("libxml2" ,libxml2)))
1145 (home-page "http://stoken.sf.net")
1146 (synopsis "Software Token for cryptographic authentication")
1148 "@code{stoken} is a token code generator compatible with RSA SecurID
1149 128-bit (AES) tokens. This package contains a standalone command-line program
1150 that allows for importing token seeds, generating token codes, and various
1151 utility/testing functions.")
1152 (license license:lgpl2.1+)))
1154 (define-public hpenc
1161 (url "https://github.com/vstakhov/hpenc")
1163 (file-name (git-file-name name version))
1166 "1fb5yi3d2k8kd4zm7liiqagpz610y168xrr1cvn7cbq314jm2my1"))))
1167 (build-system gnu-build-system)
1169 `(#:tests? #f ; No test suite
1171 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1172 ;; Build the program and the docs.
1175 (modify-phases %standard-phases
1176 (delete 'configure) ; No ./configure script
1177 (add-after 'unpack 'patch-path
1179 (substitute* '("src/Makefile" "doc/Makefile")
1180 (("/usr/bin/install")
1182 (add-before 'install 'make-output-directories
1183 (lambda* (#:key outputs #:allow-other-keys)
1184 (let* ((out (assoc-ref outputs "out"))
1185 (bin (string-append out "/bin"))
1186 (man1 (string-append out "/share/man/man1")))
1191 `(("libsodium" ,libsodium)
1192 ("openssl" ,openssl)))
1193 (synopsis "High-performance command-line tool for stream encryption")
1194 (description "Hpenc is a command-line tool for performing authenticated
1195 encryption (AES-GCM and ChaCha20-Poly1305) of streaming data. It does not
1196 perform an asymmetric key exchange, instead requiring the user to distribute
1197 pre-shared keys out of band. It is designed to handle large amounts of data
1198 quickly by using all your CPU cores and hardware acceleration.")
1199 (home-page "https://github.com/vstakhov/hpenc")
1200 (license license:bsd-3)))
1202 (define-public minisign
1210 (string-append "https://github.com/jedisct1/minisign/releases/download/"
1211 version "/minisign-" version ".tar.gz"))
1213 (base32 "1h9cfvvm6lqq33b2wdar1x3w4k7zyrscavllyb0l5dmcdabq60r2"))))
1214 (build-system cmake-build-system)
1219 `(("pkg-config" ,pkg-config)))
1221 `(("libsodium" ,libsodium)))
1222 (home-page "https://jedisct1.github.io/minisign")
1223 (synopsis "Tool to sign files and verify signatures")
1225 "Minisign is a dead simple tool to sign files and verify signatures. It is
1226 portable, lightweight, and uses the highly secure Ed25519 public-key signature
1227 system. Signature written by minisign can be verified using OpenBSD's
1228 signify tool: public key files and signature files are compatible. However,
1229 minisign uses a slightly different format to store secret keys. Minisign
1230 signatures include trusted comments in addition to untrusted comments.
1231 Trusted comments are signed, thus verified, before being displayed.")
1232 (license license:isc)))
1234 (define-public libolm
1241 (url "https://git.matrix.org/git/olm")
1245 "14b5cplcnbf2baq0lvz4f97m6swxpb13rvxdajxyw3s4mbvasia4"))
1246 (file-name (git-file-name name version))))
1247 (build-system cmake-build-system)
1250 (modify-phases %standard-phases
1253 (with-directory-excursion "tests"
1254 (invoke "ctest" ".")))))))
1255 (synopsis "Implementation of the olm and megolm cryptographic ratchets")
1256 (description "The libolm library implements the Double Ratchet
1257 cryptographic ratchet. It is written in C and C++11, and exposed as a C
1259 (home-page "https://matrix.org/docs/projects/other/olm/")
1260 (license license:asl2.0)))
1262 (define-public hash-extender
1263 (let ((commit "cb8aaee49f93e9c0d2f03eb3cafb429c9eed723d")
1266 (name "hash-extender")
1267 (version (git-version "0.0" revision commit))
1271 (url "https://github.com/iagox86/hash_extender")
1275 "1fj118566hr1wv03az2w0iqknazsqqkak0mvlcvwpgr6midjqi9b"))
1276 (file-name (git-file-name name version))))
1277 (build-system gnu-build-system)
1280 (modify-phases %standard-phases
1284 (invoke "./hash_extender_test")))
1286 (lambda* (#:key outputs #:allow-other-keys)
1287 (let* ((outdir (assoc-ref outputs "out"))
1288 (bindir (string-append outdir "/bin"))
1289 (docdir (string-append outdir
1290 "/share/doc/hash-extender-"
1292 (install-file "hash_extender" bindir)
1293 (install-file "README.md" docdir)
1296 `(("openssl" ,openssl)))
1297 (synopsis "Tool for hash length extension attacks")
1298 (description "@command{hash_extender} is a utility for performing hash
1299 length extension attacks supporting MD4, MD5, RIPEMD-160, SHA-0, SHA-1,
1300 SHA-256, SHA-512, and WHIRLPOOL hashes.")
1301 (home-page "https://github.com/iagox86/hash_extender")
1302 (license license:bsd-3))))
1304 (define-public mkp224o
1311 (url "https://github.com/cathugger/mkp224o")
1312 (commit (string-append "v" version))))
1315 "0b2cn96wg4l8jkkqqp8l2295xlmm2jc8nrw6rdqb5g0zkpfmrxbb"))
1316 (file-name (git-file-name name version))))
1317 (build-system gnu-build-system)
1319 `(#:tests? #f ; no test suite
1321 (modify-phases %standard-phases
1323 (lambda* (#:key outputs #:allow-other-keys)
1324 (let* ((outdir (assoc-ref outputs "out"))
1325 (bindir (string-append outdir "/bin")))
1326 (install-file "mkp224o" bindir)
1329 `(("autoconf" ,autoconf)))
1331 `(("libsodium" ,libsodium)))
1332 (synopsis "Tor hidden service v3 name generator")
1333 (description "@code{mkp224o} generates valid ed25519 (hidden service
1334 version 3) onion addresses. It allows one to produce customized vanity .onion
1335 addresses using a brute-force method.")
1336 (home-page "https://github.com/cathugger/mkp224o")
1337 (license license:cc0)))