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>
22 ;;; Copyright © 2021 Ellis Kenyő <me@elken.dev>
24 ;;; This file is part of GNU Guix.
26 ;;; GNU Guix is free software; you can redistribute it and/or modify it
27 ;;; under the terms of the GNU General Public License as published by
28 ;;; the Free Software Foundation; either version 3 of the License, or (at
29 ;;; your option) any later version.
31 ;;; GNU Guix is distributed in the hope that it will be useful, but
32 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
33 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 ;;; GNU General Public License for more details.
36 ;;; You should have received a copy of the GNU General Public License
37 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
39 (define-module (gnu packages crypto)
40 #:use-module (gnu packages)
41 #:use-module (gnu packages admin)
42 #:use-module (gnu packages aidc)
43 #:use-module (gnu packages attr)
44 #:use-module (gnu packages autotools)
45 #:use-module (gnu packages boost)
46 #:use-module (gnu packages check)
47 #:use-module (gnu packages compression)
48 #:use-module (gnu packages crates-io)
49 #:use-module (gnu packages cryptsetup)
50 #:use-module (gnu packages gettext)
51 #:use-module (gnu packages gnupg)
52 #:use-module (gnu packages golang)
53 #:use-module (gnu packages image)
54 #:use-module (gnu packages kerberos)
55 #:use-module (gnu packages libbsd)
56 #:use-module (gnu packages libffi)
57 #:use-module (gnu packages linux)
58 #:use-module (gnu packages lsof)
59 #:use-module (gnu packages man)
60 #:use-module (gnu packages multiprecision)
61 #:use-module (gnu packages nettle)
62 #:use-module (gnu packages password-utils)
63 #:use-module (gnu packages perl)
64 #:use-module (gnu packages perl-check)
65 #:use-module (gnu packages pkg-config)
66 #:use-module (gnu packages python)
67 #:use-module (gnu packages python-xyz)
68 #:use-module (gnu packages readline)
69 #:use-module (gnu packages search)
70 #:use-module (gnu packages serialization)
71 #:use-module (gnu packages shells)
72 #:use-module (gnu packages sqlite)
73 #:use-module (gnu packages tcl)
74 #:use-module (gnu packages tls)
75 #:use-module (gnu packages version-control)
76 #:use-module (gnu packages xml)
77 #:use-module ((guix licenses) #:prefix license:)
78 #:use-module (guix packages)
79 #:use-module (guix download)
80 #:use-module (guix git-download)
81 #:use-module (guix build-system cargo)
82 #:use-module (guix build-system cmake)
83 #:use-module (guix build-system copy)
84 #:use-module (guix build-system gnu)
85 #:use-module (guix build-system go)
86 #:use-module (guix build-system perl)
87 #:use-module (guix utils)
88 #:use-module (srfi srfi-1)
89 #:use-module (srfi srfi-26))
91 (define-public libsodium
97 (uri (list (string-append
98 "https://download.libsodium.org/libsodium/"
99 "releases/libsodium-" version ".tar.gz")
101 "https://download.libsodium.org/libsodium/"
102 "releases/old/libsodium-" version ".tar.gz")))
105 "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g"))))
106 (build-system gnu-build-system)
107 (synopsis "Portable NaCl-based crypto library")
109 "Sodium is a new easy-to-use high-speed software library for network
110 communication, encryption, decryption, signatures, etc.")
111 (license license:isc)
112 (home-page "https://libsodium.org")))
122 (string-append "https://archive.hadrons.org/software/libmd/libmd-"
124 (string-append "https://libbsd.freedesktop.org/releases/libmd-"
128 "0jmga8y94h857ilra3qjaiax3wd5pd6mx1h120zhl9fcjmzhj0js"))))
129 (build-system gnu-build-system)
130 (synopsis "Message Digest functions from BSD systems")
132 "The currently provided message digest algorithms are:
139 @item SHA-2 (SHA-256, SHA-384 and SHA-512)
141 (license (list license:bsd-3
144 license:public-domain))
145 (home-page "https://www.hadrons.org/software/libmd/")))
147 (define-public signify
151 (home-page "https://github.com/aperezdc/signify")
154 (uri (string-append "https://github.com/aperezdc/signify/releases"
155 "/download/v" version "/signify-" version ".tar.xz"))
158 "11l67j04gyxnlw6zrzsygqs5cgsc1sww1rh0apl05yay131hd17n"))))
159 (build-system gnu-build-system)
160 ;; TODO Build with libwaive (described in README.md), to implement something
161 ;; like OpenBSD's pledge().
165 (string-append "PREFIX=" (assoc-ref %outputs "out")))
167 (modify-phases %standard-phases
168 (delete 'configure))))
170 `(("pkg-config" ,pkg-config)))
172 `(("libbsd" ,libbsd)))
173 (synopsis "Create and verify cryptographic signatures")
174 (description "The signify utility creates and verifies cryptographic
175 signatures using the elliptic curve Ed25519. This is a Linux port of the
176 OpenBSD tool of the same name.")
177 ;; This package includes third-party code that was originally released under
178 ;; various non-copyleft licenses. See the source files for clarification.
179 (license (list license:bsd-3 license:bsd-4 license:expat license:isc
180 license:public-domain (license:non-copyleft
182 "See base64.c in the distribution for
183 the license from IBM.")))))
185 (define-public rust-minisign
187 (name "rust-minisign")
192 (uri (crate-uri "minisign" version))
194 (string-append name "-" version ".tar.gz"))
197 "0xmcvh2snravghaar8igc6b9r3s1snnmf9qam9l3zyhm4987767y"))))
198 (build-system cargo-build-system)
201 (("rust-getrandom" ,rust-getrandom-0.1)
202 ("rust-rpassword" ,rust-rpassword-4)
203 ("rust-scrypt" ,rust-scrypt-0.3))))
204 (home-page "https://github.com/jedisct1/rust-minisign")
205 (synopsis "Crate to sign files and verify signatures")
207 "This package provides a crate to sign files and verify signatures.")
208 (license license:expat)))
210 (define-public go-minisign
218 (url "https://github.com/jedisct1/go-minisign")
220 (file-name (git-file-name name version))
223 "0wc0rk5m60yz52f0cncmbgq67yvb1rcx91gvzjg6jpc4mpw2db27"))
224 (modules '((guix build utils)))
226 '(begin (delete-file-recursively "vendor") #t))))
227 (build-system go-build-system)
229 '(#:import-path "github.com/jedisct1/go-minisign"))
231 `(("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))
232 (home-page "https://github.com/jedisct1/go-minisign")
233 (synopsis "Minisign verification library for Golang")
234 (description "A Golang library to verify Minisign signatures.")
235 (license license:expat)))
245 (string-append "https://github.com/vgough/encfs/releases/download/v"
246 version "/encfs-" version ".tar.gz"))
249 "0qzxavvv20577bxvly8s7d3y7bqasqclc2mllp0ddfncjm9z02a7"))
250 (modules '((guix build utils)))
251 ;; Remove bundled dependencies in favour of proper inputs.
253 (for-each delete-file-recursively
254 '("vendor/github.com/leethomason/tinyxml2"
255 "vendor/github.com/google/googletest"))
257 (build-system cmake-build-system)
259 `(("gettext" ,gettext-minimal)
261 ;; Test dependencies.
263 ("googletest-source" ,(package-source googletest))
269 ("tinyxml2" ,tinyxml2)))
271 `(#:configure-flags (list "-DUSE_INTERNAL_TINYXML=OFF")
273 (modify-phases %standard-phases
274 (add-after 'unpack 'unpack-googletest
275 (lambda* (#:key inputs #:allow-other-keys)
276 (mkdir-p "vendor/github.com/google/googletest")
277 (copy-recursively (assoc-ref inputs "googletest-source")
278 "vendor/github.com/google/googletest")
280 (add-before 'configure 'patch-CMakeLists.txt
282 ;; Prevent CMake from adding libc on the system include path.
283 ;; Otherwise it will interfere with the libc used by GCC and
284 ;; ultimately cause #include_next errors.
285 (substitute* "CMakeLists.txt"
286 (("include_directories \\(SYSTEM \\$\\{Intl_INCLUDE_DIRS\\}\\)")
289 (add-before 'check 'make-unittests
291 (invoke "make" "unittests"))))))
292 (home-page "https://vgough.github.io/encfs")
293 (synopsis "Encrypted virtual file system")
295 "EncFS creates a virtual encrypted file system in user-space. Each file
296 created under an EncFS mount point is stored as a separate encrypted file on
297 the underlying file system. Like most encrypted file systems, EncFS is meant
298 to provide security against off-line attacks, such as a drive falling into
300 (license (list license:expat ; internal/easylogging++.h
301 license:lgpl3+ ; encfs library
302 license:gpl3+)))) ; command-line tools
304 (define-public keyutils
312 (string-append "https://people.redhat.com/dhowells/keyutils/keyutils-"
315 (base32 "1kk4pmyflgplkgxn2bzpc069ph9c9jdd9ikcsyd5pnaimqi5gcf8"))
316 (modules '((guix build utils)))
317 ;; Create relative symbolic links instead of absolute ones to /lib/*.
319 (substitute* "Makefile" (("\\$\\(LNS\\) \\$\\(LIBDIR\\)/")
322 (build-system gnu-build-system)
324 `(#:phases (modify-phases %standard-phases
325 (delete 'configure)) ; no configure script
326 #:make-flags (list "CC=gcc"
327 "RPATH=-Wl,-rpath,$(DESTDIR)$(LIBDIR)"
328 (string-append "DESTDIR="
329 (assoc-ref %outputs "out"))
330 "INCLUDEDIR=/include"
333 "SHAREDIR=/share/keyutils")
334 #:test-target "test"))
336 `(("mit-krb5" ,mit-krb5)))
337 (home-page "https://people.redhat.com/dhowells/keyutils/")
338 (synopsis "Linux key management utilities")
340 "Keyutils is a set of utilities for managing the key retention facility in
341 the Linux kernel, which can be used by file systems, block devices, and more to
342 gain and retain the authorization and encryption keys required to perform
343 secure operations. ")
344 (license (list license:lgpl2.1+ ; the files keyutils.*
345 license:gpl2+)))) ; the rest
347 ;; There is no release candidate but commits point out a version number,
348 ;; furthermore no tarball exists.
349 (define-public eschalot
350 (let ((commit "0bf31d88a11898c19b1ed25ddd2aff7b35dbac44")
354 (version (string-append "1.2.0-" revision "." (string-take commit 7)))
359 (url "https://github.com/schnabear/eschalot")
361 (file-name (string-append name "-" version))
364 "0lj38ldh8vzi11wp4ghw4k0fkwp0s04zv8k8d473p1snmbh7mx98"))))
366 `(("openssl" ,openssl-1.0))) ; for openssl/{bn,pem,rsa,sha}.h
367 (build-system gnu-build-system)
369 `(#:make-flags (list (string-append "CC=" ,(cc-for-target))
370 (string-append "PREFIX=" (assoc-ref %outputs "out"))
371 (string-append "INSTALL=" "install"))
372 ;; XXX: make test would run a !VERY! long hashing of names with the use
373 ;; of a wordlist, the amount of computing time this would waste on build
374 ;; servers is in no relation to the size or importance of this small
375 ;; application, therefore we run our own tests on eschalot and worgen.
377 (modify-phases %standard-phases
381 (invoke "./worgen" "8-12" "top1000.txt" "3-10" "top400nouns.txt"
382 "3-6" "top150adjectives.txt" "3-6")
383 (invoke "./eschalot" "-r" "^guix|^guixsd")
384 (invoke "./eschalot" "-r" "^gnu|^free")
385 (invoke "./eschalot" "-r" "^cyber|^hack")
386 (invoke "./eschalot" "-r" "^troll")))
387 ;; Make install can not create the bin dir, create it.
388 (add-before 'install 'create-bin-dir
389 (lambda* (#:key outputs #:allow-other-keys)
390 (let* ((out (assoc-ref outputs "out"))
391 (bin (string-append out "/bin")))
394 (home-page "https://github.com/schnabear/eschalot")
395 (synopsis "Tor hidden service name generator")
397 "Eschalot is a tor hidden service name generator, it allows one to
398 produce customized vanity .onion addresses using a brute-force method. Searches
399 for valid names can be run with regular expressions and wordlists. For the
400 generation of wordlists the included tool @code{worgen} can be used. There is
401 no man page, refer to the home page for usage details.")
402 (license (list license:isc license:expat)))))
410 (uri (string-append "http://point-at-infinity.org/ssss/ssss-"
414 "15grn2fp1x8p92kxkwbmsx8rz16g93y9grl3hfqbh1jn21ama5jx"))))
415 (build-system gnu-build-system)
417 `(#:tests? #f ; No test suite
418 #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
421 (modify-phases %standard-phases
422 (delete 'configure) ; no configuration to be done
424 (lambda* (#:key outputs #:allow-other-keys)
425 (let* ((outdir (assoc-ref outputs "out"))
426 (bindir (string-append outdir "/bin"))
427 (docdir (string-append outdir
430 (install-file "ssss-combine" bindir)
431 (install-file "ssss-split" bindir)
432 (install-file "ssss.1" docdir)
433 (install-file "ssss.1.html" docdir)
438 `(("xmltoman" ,xmltoman)))
439 (home-page "http://point-at-infinity.org/ssss/")
440 (synopsis "Shamir's secret sharing scheme implementation")
441 (description "@command{ssss-split} and @command{ssss-combine} are utilities that split
442 and combine secrets securely using Shamir's secret sharing scheme. This implementation
443 allows for a threshold scheme where the minimum number of shares can be less than the
444 total number of shares generated.")
445 (license license:gpl2+)))
453 (uri (string-append "https://files.dyne.org/tomb/releases/"
454 "Tomb-" version ".tar.gz"))
457 "136nfnpaz29hngwwnzrmc858gpnvnb977gf4ldbpapw1h1k3r8mk"))))
458 (build-system gnu-build-system)
459 (native-inputs `(("sudo" ,sudo))) ;presence needed for 'check' phase
463 ("cryptsetup" ,cryptsetup)
464 ("e2fsprogs" ,e2fsprogs) ;for mkfs.ext4
465 ("gettext" ,gettext-minimal) ;used at runtime
468 ("pinentry" ,pinentry)
469 ("qrencode" ,qrencode)
470 ("steghide" ,steghide)
471 ("util-linux" ,util-linux)))
473 `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
474 ;; The "sudo" input is needed only to satisfy dependency checks in the
475 ;; 'check' phase. The "sudo" used at runtime should come from the
476 ;; system's setuid-programs, so ensure no reference is kept.
477 #:disallowed-references (,sudo)
478 ;; TODO: Build and install gtk and qt trays
480 (modify-phases %standard-phases
481 (delete 'configure) ;no configuration to be done
482 (add-after 'install 'i18n
483 (lambda* (#:key make-flags #:allow-other-keys)
484 (apply invoke "make" "-C" "extras/translations"
485 "install" make-flags)
487 (add-after 'install 'wrap
488 (lambda* (#:key inputs outputs #:allow-other-keys)
489 (let ((out (assoc-ref outputs "out")))
490 (wrap-program (string-append out "/bin/tomb")
492 (,(string-append (assoc-ref inputs "mlocate") "/bin")
493 ,@(map (lambda (program)
494 (or (and=> (which program) dirname)
495 (error "program not found:" program)))
496 '("seq" "mkfs.ext4" "pinentry"
497 "gpg" "cryptsetup" "gettext" "lsof"
498 "qrencode" "steghide" "findmnt" "getent")))))
501 (add-after 'wrap 'check
502 (lambda* (#:key outputs #:allow-other-keys)
503 ;; Running the full tests requires sudo/root access for
504 ;; cryptsetup, which is not available in the build environment.
505 ;; But we can run `tomb dig` without root, so make sure that
506 ;; works. TODO: It Would Be Nice to check the expected "index",
507 ;; "search", "bury", and "exhume" features are available by
508 ;; querying `tomb -h`.
509 (let ((tomb (string-append (assoc-ref outputs "out")
511 (invoke tomb "dig" "-s" "10" "secrets.tomb")
513 (home-page "https://www.dyne.org/software/tomb")
514 (synopsis "File encryption for secret data")
516 "Tomb is an application to manage the creation and access of encrypted
517 storage files: it can be operated from commandline and it can integrate with a
518 user's graphical desktop.")
519 (license license:gpl3+)))
521 (define-public scrypt
528 (uri (string-append "https://www.tarsnap.com/scrypt/scrypt-"
532 "1hnl0r6pmyxiy4dmafmqk1db7wpc0x9rqpzqcwr9d2cmghcj6byz"))))
533 (build-system gnu-build-system)
535 `(#:license-file-regexp "COPYRIGHT"
536 #:phases (modify-phases %standard-phases
537 (add-after 'unpack 'patch-$PATH-assumptions
539 (substitute* "configure"
540 (("\\{POSIX_PATH\\}")
542 (substitute* "Makefile.in"
545 (add-after 'install 'install-docs
546 (lambda* (#:key outputs #:allow-other-keys)
547 (let* ((out (assoc-ref %outputs "out"))
548 (doc (string-append out "/share/doc/" ,name "-" ,version)))
549 (install-file "FORMAT" doc)
552 `(("openssl" ,openssl)))
553 (home-page "https://www.tarsnap.com/scrypt.html")
554 (synopsis "Memory-hard encryption tool based on scrypt")
555 (description "This package provides a simple password-based encryption
556 utility as a demonstration of the @code{scrypt} key derivation function.
557 @code{Scrypt} is designed to be far more resistant against hardware brute-force
558 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
559 (license license:bsd-2)))
561 (define-public libscrypt
569 (url "https://github.com/technion/libscrypt")
570 (commit (string-append "v" version))))
571 (file-name (git-file-name name version))
574 "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng"))))
575 (build-system gnu-build-system)
576 (outputs (list "out" "static"))
578 `(#:make-flags (list (string-append "PREFIX=" %output)
581 (modify-phases %standard-phases
582 (delete 'configure) ; no configure script
583 (add-after 'install 'install:static
584 (lambda* (#:key outputs #:allow-other-keys)
585 (let* ((out (assoc-ref outputs "out"))
586 (lib (string-append out "/lib")))
587 (install-file "libscrypt.a" lib)
589 (home-page "https://lolware.net/libscrypt.html")
590 (synopsis "Password hashing library")
591 (description "@code{libscrypt} implements @code{scrypt} key derivation
592 function. It is designed to be far more secure against hardware brute-force
593 attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
594 (license license:bsd-3)))
596 (define-public perl-math-random-isaac-xs
598 (name "perl-math-random-isaac-xs")
603 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
604 "Math-Random-ISAAC-XS-" version ".tar.gz"))
607 "0yxqqcqvj51fn7b7j5xqhz65v74arzgainn66c6k7inijbmr1xws"))))
608 (build-system perl-build-system)
610 `(("perl-module-build" ,perl-module-build)
611 ("perl-test-nowarnings" ,perl-test-nowarnings)))
612 (home-page "https://metacpan.org/release/Math-Random-ISAAC-XS")
613 (synopsis "C implementation of the ISAAC PRNG algorithm")
614 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
615 fast pseudo-random number generator. It is suitable for applications where a
616 significant amount of random data needs to be produced quickly, such as
617 solving using the Monte Carlo method or for games. The results are uniformly
618 distributed, unbiased, and unpredictable unless you know the seed.
620 This package implements the same interface as @code{Math::Random::ISAAC}.")
621 (license license:public-domain)))
623 (define-public perl-math-random-isaac
625 (name "perl-math-random-isaac")
630 (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
631 "Math-Random-ISAAC-" version ".tar.gz"))
634 "0z1b3xbb3xz71h25fg6jgsccra7migq7s0vawx2rfzi0pwpz0wr7"))))
635 (build-system perl-build-system)
637 `(("perl-test-nowarnings" ,perl-test-nowarnings)))
639 `(("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)))
640 (home-page "https://metacpan.org/release/Math-Random-ISAAC")
641 (synopsis "Perl interface to the ISAAC PRNG algorithm")
642 (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
643 fast pseudo-random number generator. It is suitable for applications where a
644 significant amount of random data needs to be produced quickly, such as
645 solving using the Monte Carlo method or for games. The results are uniformly
646 distributed, unbiased, and unpredictable unless you know the seed.
648 This package provides a Perl interface to the ISAAC pseudo random number
650 (license license:public-domain)))
652 (define-public perl-crypt-random-source
654 (name "perl-crypt-random-source")
659 (uri (string-append "mirror://cpan/authors/id/E/ET/ETHER/"
660 "Crypt-Random-Source-" version ".tar.gz"))
662 (base32 "1rpdds3sy5l1fhngnkrsgwsmwd54wpicx3i9ds69blcskwkcwkpc"))))
663 (build-system perl-build-system)
665 `(("perl-module-build-tiny" ,perl-module-build-tiny)
666 ("perl-test-fatal" ,perl-test-fatal)))
668 `(("perl-capture-tiny" ,perl-capture-tiny)
669 ("perl-module-find" ,perl-module-find)
670 ("perl-module-runtime" ,perl-module-runtime)
671 ("perl-moo" ,perl-moo)
672 ("perl-namespace-clean" ,perl-namespace-clean)
673 ("perl-sub-exporter" ,perl-sub-exporter)
674 ("perl-type-tiny" ,perl-type-tiny)))
675 (home-page "https://metacpan.org/release/Crypt-Random-Source")
676 (synopsis "Get weak or strong random data from pluggable sources")
677 (description "This module provides implementations for a number of
678 byte-oriented sources of random data.")
679 (license license:perl-license)))
681 (define-public perl-math-random-secure
683 (name "perl-math-random-secure")
688 (uri (string-append "mirror://cpan/authors/id/F/FR/FREW/"
689 "Math-Random-Secure-" version ".tar.gz"))
692 "0dgbf4ncll4kmgkyb9fsaxn0vf2smc9dmwqzgh3259zc2zla995z"))))
693 (build-system perl-build-system)
695 `(("perl-list-moreutils" ,perl-list-moreutils)
696 ("perl-test-leaktrace" ,perl-test-leaktrace)
697 ("perl-test-sharedfork" ,perl-test-sharedfork)
698 ("perl-test-warn" ,perl-test-warn)))
700 `(("perl-crypt-random-source" ,perl-crypt-random-source)
701 ("perl-math-random-isaac" ,perl-math-random-isaac)
702 ("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)
703 ("perl-moo" ,perl-moo)))
704 (home-page "https://metacpan.org/release/Math-Random-Secure")
705 (synopsis "Cryptographically secure replacement for rand()")
706 (description "This module is intended to provide a
707 cryptographically-secure replacement for Perl's built-in @code{rand} function.
708 \"Crytographically secure\", in this case, means:
711 @item No matter how many numbers you see generated by the random number
712 generator, you cannot guess the future numbers, and you cannot guess the seed.
713 @item There are so many possible seeds that it would take decades, centuries,
714 or millennia for an attacker to try them all.
715 @item The seed comes from a source that generates relatively strong random
716 data on your platform, so the seed itself will be as random as possible.
718 (license license:artistic2.0)))
720 (define-public crypto++
725 (method url-fetch/zipbomb)
726 (uri (string-append "https://cryptopp.com/cryptopp"
727 (string-join (string-split version #\.) "")
731 "16kvfm11xv7j9a3yykzysjgw38a9b7lnc5n5x5h82g395k6ybxf0"))))
732 (build-system gnu-build-system)
735 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
736 ;; Override "/sbin/ldconfig" with simply "echo" since
737 ;; we don't need ldconfig(8).
740 (modify-phases %standard-phases
741 (add-after 'unpack 'disable-native-optimisation
742 ;; This package installs more than just headers. Ensure that the
743 ;; cryptest.exe binary & static library aren't CPU model specific.
745 (substitute* "GNUmakefile"
746 ((" -march=native") ""))
750 ;; By default, only the static library is built.
751 (lambda* (#:key (make-flags '()) #:allow-other-keys)
752 (apply invoke "make" "shared"
753 "-j" (number->string (parallel-job-count))
755 (add-after 'install 'install-shared-library-links
756 ;; By default, only .so and .so.x.y.z are installed.
757 ;; Create all the ‘intermediates’ expected by dependent packages.
758 (lambda* (#:key outputs #:allow-other-keys)
759 (let* ((out (assoc-ref outputs "out"))
760 (lib (string-append out "/lib"))
761 (prefix "libcryptopp.so.")
762 (target (string-append prefix ,version)))
763 (with-directory-excursion lib
765 (string-append prefix ,(version-major+minor version)))
767 (string-append prefix ,(version-major version)))
769 (add-after 'install 'install-pkg-config
770 (lambda* (#:key outputs #:allow-other-keys)
771 (let* ((out (assoc-ref outputs "out"))
772 (pkg-dir (string-append out "/lib/pkgconfig")))
774 (with-output-to-file (string-append pkg-dir "/libcrypto++.pc")
779 "libdir=" out "/lib\n"
780 "includedir=" out "/include\n\n"
781 "Name: libcrypto++-" ,version "\n"
782 "Description: Class library of cryptographic schemes\n"
783 "Version: " ,version "\n"
784 "Libs: -L${libdir} -lcryptopp\n"
785 "Cflags: -I${includedir}\n"))
789 (home-page "https://cryptopp.com/")
790 (synopsis "C++ class library of cryptographic schemes")
791 (description "Crypto++ is a C++ class library of cryptographic schemes.")
792 ;; The compilation is distributed under the Boost license; the individual
793 ;; files in the compilation are in the public domain.
794 (license (list license:boost1.0 license:public-domain))))
803 "https://github.com/BLAKE2/libb2/releases/download/v"
804 version "/libb2-" version ".tar.gz"))
807 "0bn7yrzdixdvzm46shbhpkqbr6zyqyxiqn7a7x54ag3mrvfnyqjk"))))
808 (build-system gnu-build-system)
812 ,@(if (any (cute string-prefix? <> (or (%current-system)
813 (%current-target-system)))
815 ;; fat only checks for Intel optimisations
818 "--disable-native"))) ;don't optimise at build time
819 (home-page "https://blake2.net/")
820 (synopsis "Library implementing the BLAKE2 family of hash functions")
822 "libb2 is a portable implementation of the BLAKE2 family of cryptographic
823 hash functions. It includes optimised implementations for IA-32 and AMD64
824 processors, and an interface layer that automatically selects the best
825 implementation for the processor it is run on.
827 @dfn{BLAKE2} (RFC 7693) is a family of high-speed cryptographic hash functions
828 that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
829 as the latest standard, SHA-3. It is an improved version of the SHA-3 finalist
831 (license license:public-domain)))
840 (uri (string-append "mirror://sourceforge/rhash/rhash/" version
841 "/rhash-" version "-src.tar.gz"))
842 (file-name (string-append "rhash-" version ".tar.gz"))
845 "1xn9fqa6rlnhsbgami45g82dlw9i1skg2sri3ydiinwak5ph1ca2"))))
846 (build-system gnu-build-system)
849 (list (string-append "--prefix=" (assoc-ref %outputs "out"))
850 ,@(let ((target (%current-target-system)))
852 `((string-append "--target=" ,target)
853 (string-append "--cc="
854 (assoc-ref %build-inputs "cross-gcc")
855 "/bin/" ,target "-gcc"))
858 ;; The binaries in /bin need some help finding librhash.so.0.
859 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib"))
860 #:test-target "test" ; ‘make check’ just checks the sources
862 (modify-phases %standard-phases
864 ;; ./configure is not GNU autotools' and doesn't gracefully handle
865 ;; unrecognized options, so we must call it manually.
866 (lambda* (#:key configure-flags #:allow-other-keys)
867 (apply invoke "./configure" configure-flags)))
868 (add-before 'check 'patch-/bin/sh
870 (substitute* "Makefile"
871 (("/bin/sh") (which "sh")))
873 (add-after 'install 'install-library-extras
874 (lambda* (#:key make-flags #:allow-other-keys)
876 "make" "-C" "librhash"
877 "install-lib-headers" "install-so-link"
879 (home-page "https://sourceforge.net/projects/rhash/")
880 (synopsis "Utility for computing hash sums")
881 (description "RHash is a console utility for calculation and verification
882 of magnet links and a wide range of hash sums like CRC32, MD4, MD5, SHA1,
883 SHA256, SHA512, SHA3, AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R
884 34.11-94, RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.")
885 (license (license:non-copyleft "file://COPYING"))))
893 (uri (string-append "https://botan.randombit.net/releases/"
894 "Botan-" version ".tar.xz"))
897 "1ada3ga7b0z4m0vjmxlvfi4nsic2l8kjcy85jwss3z2i58a5y0vy"))))
898 (build-system gnu-build-system)
901 (modify-phases %standard-phases
903 (lambda* (#:key inputs outputs #:allow-other-keys)
904 (let* ((out (assoc-ref %outputs "out"))
905 (lib (string-append out "/lib")))
906 ;; Upstream tests and benchmarks with -O3.
907 (setenv "CXXFLAGS" "-O3")
908 (invoke "python" "./configure.py"
909 (string-append "--prefix=" out)
910 ;; Otherwise, the `botan` executable cannot find
912 (string-append "--ldflags=-Wl,-rpath=" lib)
914 "--with-os-feature=getentropy"
917 ;; Recommended by upstream
918 "--with-zlib" "--with-bzip2" "--with-sqlite3"))))
920 (lambda _ (invoke "./botan-test"))))))
922 `(("python" ,python-wrapper)
923 ("python-docutils" ,python-docutils)))
928 (synopsis "Cryptographic library in C++11")
929 (description "Botan is a cryptography library, written in C++11, offering
930 the tools necessary to implement a range of practical systems, such as TLS/DTLS,
931 PKIX certificate handling, PKCS#11 and TPM hardware support, password hashing,
932 and post-quantum crypto schemes. In addition to the C++, botan has a C89 API
933 specifically designed to be easy to call from other languages. A Python binding
934 using ctypes is included, and several other language bindings are available.")
935 (home-page "https://botan.randombit.net")
936 (license license:bsd-2)))
938 (define-public ccrypt
944 (uri (string-append "mirror://sourceforge/ccrypt/"
945 version "/ccrypt-" version ".tar.gz"))
948 "0kx4a5mhmp73ljknl2lcccmw9z3f5y8lqw0ghaymzvln1984g75i"))))
949 (build-system gnu-build-system)
950 (home-page "http://ccrypt.sourceforge.net")
951 (synopsis "Command-line utility for encrypting and decrypting files and streams")
952 (description "@command{ccrypt} is a utility for encrypting and decrypting
953 files and streams. It was designed as a replacement for the standard unix
954 @command{crypt} utility, which is notorious for using a very weak encryption
955 algorithm. @command{ccrypt} is based on the Rijndael block cipher, a version of
956 which is also used in the Advanced Encryption Standard (AES, see
957 @url{http://www.nist.gov/aes}). This cipher is believed to provide very strong
959 (license license:gpl2)))
961 (define-public asignify
962 (let ((commit "f58e7977a599f040797975d649ed318e25cbd2d5")
966 (version (git-version "1.1" revision commit))
970 (url "https://github.com/vstakhov/asignify")
972 (file-name (git-file-name name version))
975 "1zl68qq6js6fdahxzyhvhrpyrwlv8c2zhdplycnfxyr1ckkhq8dw"))))
976 (build-system gnu-build-system)
979 (list "--enable-openssl"
980 (string-append "--with-openssl="
981 (assoc-ref %build-inputs "openssl")))))
983 `(("autoconf" ,autoconf)
984 ("automake" ,automake)
985 ("libtool" ,libtool)))
987 `(("openssl" ,openssl)))
988 (home-page "https://github.com/vstakhov/asignify")
989 (synopsis "Cryptographic authentication and encryption tool and library")
990 (description "Asignify offers public cryptographic signatures and
991 encryption with a library or a command-line tool. The tool is heavily inspired
992 by signify as used in OpenBSD. The main goal of this project is to define a
993 high level API for signing files, validating signatures and encrypting using
994 public-key cryptography. Asignify is designed to be portable and self-contained
995 with zero external dependencies. Asignify can verify OpenBSD signatures, but it
996 cannot sign messages in OpenBSD format yet.")
997 (license license:bsd-2))))
999 (define-public enchive
1006 (url "https://github.com/skeeto/enchive")
1010 "0fdrfc5l42lj2bvmv9dmkmhmm7qiszwk7cmdvnqad3fs7652g0qa"))
1011 (file-name (git-file-name name version))))
1012 (build-system gnu-build-system)
1014 '(#:tests? #f ; no check target '
1015 #:make-flags (list "CC=gcc" "PREFIX=$(out)")
1016 #:phases (modify-phases %standard-phases
1018 (add-after 'install 'post-install
1020 (let* ((out (assoc-ref %outputs "out"))
1021 (lisp (string-append out "/share/emacs/site-lisp")))
1022 (install-file "enchive-mode.el" lisp)
1024 (synopsis "Encrypted personal archives")
1026 "Enchive is a tool to encrypt files to yourself for long-term
1027 archival. It's a focused, simple alternative to more complex solutions such as
1028 GnuPG or encrypted filesystems. Enchive has no external dependencies and is
1029 trivial to build for local use. Portability is emphasized over performance.")
1030 (home-page "https://github.com/skeeto/enchive")
1031 (license license:unlicense)))
1033 (define-public libsecp256k1
1034 (let ((commit "dbd41db16a0e91b2566820898a3ab2d7dad4fe00"))
1036 (name "libsecp256k1")
1037 (version (git-version "20200615" "1" commit))
1041 (url "https://github.com/bitcoin-core/secp256k1")
1045 "1fcpnksq5cqwqzshn5f0lq94b73p3frwbp04hgmmbnrndpqg6mpy"))
1046 (file-name (git-file-name name version))))
1047 (build-system gnu-build-system)
1049 '(#:configure-flags '("--enable-module-recovery"
1050 "--enable-experimental"
1051 "--enable-module-ecdh"
1052 "--enable-shared")))
1054 `(("autoconf" ,autoconf)
1055 ("automake" ,automake)
1056 ("libtool" ,libtool)))
1057 ;; WARNING: This package might need additional configure flags to run properly.
1058 ;; See https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/libsecp256k1.
1059 (synopsis "C library for EC operations on curve secp256k1")
1061 "Optimized C library for EC operations on curve secp256k1.
1063 This library is a work in progress and is being used to research best
1064 practices. Use at your own risk.
1069 @item secp256k1 ECDSA signing/verification and key generation.
1070 @item Adding/multiplying private/public keys.
1071 @item Serialization/parsing of private keys, public keys, signatures.
1072 @item Constant time, constant memory access signing and pubkey generation.
1073 @item Derandomized DSA (via RFC6979 or with a caller provided function.)
1074 @item Very efficient implementation.
1076 (home-page "https://github.com/bitcoin-core/secp256k1")
1077 (license license:unlicense))))
1079 (define-public libsecp256k1-bitcoin-cash
1081 (name "libsecp256k1-bitcoin-cash")
1087 (url "https://github.com/Bitcoin-ABC/secp256k1")
1088 (commit (string-append "v" version))))
1089 (file-name (git-file-name name version))
1091 (base32 "1rnif3iny6pz1r3g69bagzr342mm3x0v66b60csnmm1rg44bd5v1"))))
1092 (build-system gnu-build-system)
1094 `(("autoconf" ,autoconf)
1095 ("automake" ,automake)
1096 ("libtool" ,libtool)))
1098 '(#:configure-flags '("--enable-module-recovery"
1099 "--enable-experimental"
1100 "--enable-module-ecdh"
1103 "--enable-module-schnorr"
1105 "--enable-shared")))
1106 (synopsis "Optimized C library for EC operations on curve secp256k1")
1108 "Optimized C library for cryptographic operations on curve secp256k1.
1110 This library is used for consensus critical cryptographic operations on the
1111 Bitcoin Cash network.
1116 @item secp256k1 ECDSA signing/verification and key generation.
1117 @item secp256k1 Schnorr signing/verification (Bitcoin Cash Schnorr variant).
1118 @item Additive and multiplicative tweaking of secret/public keys.
1119 @item Serialization/parsing of secret keys, public keys, signatures.
1120 @item Constant time, constant memory access signing and pubkey generation.
1121 @item Derandomized ECDSA (via RFC6979 or with a caller provided function).
1122 @item Very efficient implementation.
1123 @item Suitable for embedded systems.
1124 @item Optional module for public key recovery.
1125 @item Optional module for ECDH key exchange (experimental).
1126 @item Optional module for multiset hash (experimental).
1128 (home-page "https://github.com/Bitcoin-ABC/secp256k1")
1129 (license license:expat)))
1131 (define-public stoken
1137 (uri (string-append "mirror://sourceforge/stoken/"
1138 "stoken-" version ".tar.gz"))
1141 "0npgr6y85gzwksy8jkwa4yzvqwjprwnplx3yiw3ayk4f0ldlhaxa"))))
1142 (build-system gnu-build-system)
1144 `(("pkg-config" ,pkg-config)))
1146 `(("nettle" ,nettle)
1147 ("libxml2" ,libxml2)))
1148 (home-page "http://stoken.sf.net")
1149 (synopsis "Software Token for cryptographic authentication")
1151 "@code{stoken} is a token code generator compatible with RSA SecurID
1152 128-bit (AES) tokens. This package contains a standalone command-line program
1153 that allows for importing token seeds, generating token codes, and various
1154 utility/testing functions.")
1155 (license license:lgpl2.1+)))
1157 (define-public hpenc
1164 (url "https://github.com/vstakhov/hpenc")
1166 (file-name (git-file-name name version))
1169 "1fb5yi3d2k8kd4zm7liiqagpz610y168xrr1cvn7cbq314jm2my1"))))
1170 (build-system gnu-build-system)
1172 `(#:tests? #f ; No test suite
1174 (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
1175 ;; Build the program and the docs.
1178 (modify-phases %standard-phases
1179 (delete 'configure) ; No ./configure script
1180 (add-after 'unpack 'patch-path
1182 (substitute* '("src/Makefile" "doc/Makefile")
1183 (("/usr/bin/install")
1185 (add-before 'install 'make-output-directories
1186 (lambda* (#:key outputs #:allow-other-keys)
1187 (let* ((out (assoc-ref outputs "out"))
1188 (bin (string-append out "/bin"))
1189 (man1 (string-append out "/share/man/man1")))
1194 `(("libsodium" ,libsodium)
1195 ("openssl" ,openssl)))
1196 (synopsis "High-performance command-line tool for stream encryption")
1197 (description "Hpenc is a command-line tool for performing authenticated
1198 encryption (AES-GCM and ChaCha20-Poly1305) of streaming data. It does not
1199 perform an asymmetric key exchange, instead requiring the user to distribute
1200 pre-shared keys out of band. It is designed to handle large amounts of data
1201 quickly by using all your CPU cores and hardware acceleration.")
1202 (home-page "https://github.com/vstakhov/hpenc")
1203 (license license:bsd-3)))
1205 (define-public minisign
1213 (string-append "https://github.com/jedisct1/minisign/releases/download/"
1214 version "/minisign-" version ".tar.gz"))
1216 (base32 "1h9cfvvm6lqq33b2wdar1x3w4k7zyrscavllyb0l5dmcdabq60r2"))))
1217 (build-system cmake-build-system)
1222 `(("pkg-config" ,pkg-config)))
1224 `(("libsodium" ,libsodium)))
1225 (home-page "https://jedisct1.github.io/minisign")
1226 (synopsis "Tool to sign files and verify signatures")
1228 "Minisign is a dead simple tool to sign files and verify signatures. It is
1229 portable, lightweight, and uses the highly secure Ed25519 public-key signature
1230 system. Signature written by minisign can be verified using OpenBSD's
1231 signify tool: public key files and signature files are compatible. However,
1232 minisign uses a slightly different format to store secret keys. Minisign
1233 signatures include trusted comments in addition to untrusted comments.
1234 Trusted comments are signed, thus verified, before being displayed.")
1235 (license license:isc)))
1237 (define-public libolm
1244 (url "https://git.matrix.org/git/olm")
1248 "0qji25wiwmkxyfpraxj96c54hyayqmjkvwh0gsy5gb5pz5bp4mcy"))
1249 (file-name (git-file-name name version))))
1250 (build-system cmake-build-system)
1253 (modify-phases %standard-phases
1256 (with-directory-excursion "tests"
1257 (invoke "ctest" ".")))))))
1258 (synopsis "Implementation of the olm and megolm cryptographic ratchets")
1259 (description "The libolm library implements the Double Ratchet
1260 cryptographic ratchet. It is written in C and C++11, and exposed as a C
1262 (home-page "https://matrix.org/docs/projects/other/olm/")
1263 (license license:asl2.0)))
1265 (define-public hash-extender
1266 (let ((commit "cb8aaee49f93e9c0d2f03eb3cafb429c9eed723d")
1269 (name "hash-extender")
1270 (version (git-version "0.0" revision commit))
1274 (url "https://github.com/iagox86/hash_extender")
1278 "1fj118566hr1wv03az2w0iqknazsqqkak0mvlcvwpgr6midjqi9b"))
1279 (file-name (git-file-name name version))))
1280 (build-system gnu-build-system)
1283 (modify-phases %standard-phases
1287 (invoke "./hash_extender_test")))
1289 (lambda* (#:key outputs #:allow-other-keys)
1290 (let* ((outdir (assoc-ref outputs "out"))
1291 (bindir (string-append outdir "/bin"))
1292 (docdir (string-append outdir
1293 "/share/doc/hash-extender-"
1295 (install-file "hash_extender" bindir)
1296 (install-file "README.md" docdir)
1299 `(("openssl" ,openssl)))
1300 (synopsis "Tool for hash length extension attacks")
1301 (description "@command{hash_extender} is a utility for performing hash
1302 length extension attacks supporting MD4, MD5, RIPEMD-160, SHA-0, SHA-1,
1303 SHA-256, SHA-512, and WHIRLPOOL hashes.")
1304 (home-page "https://github.com/iagox86/hash_extender")
1305 (license license:bsd-3))))
1307 (define-public mkp224o
1314 (url "https://github.com/cathugger/mkp224o")
1315 (commit (string-append "v" version))))
1318 "0b2cn96wg4l8jkkqqp8l2295xlmm2jc8nrw6rdqb5g0zkpfmrxbb"))
1319 (file-name (git-file-name name version))))
1320 (build-system gnu-build-system)
1322 `(#:tests? #f ; no test suite
1324 (modify-phases %standard-phases
1326 (lambda* (#:key outputs #:allow-other-keys)
1327 (let* ((outdir (assoc-ref outputs "out"))
1328 (bindir (string-append outdir "/bin")))
1329 (install-file "mkp224o" bindir)
1332 `(("autoconf" ,autoconf)))
1334 `(("libsodium" ,libsodium)))
1335 (synopsis "Tor hidden service v3 name generator")
1336 (description "@code{mkp224o} generates valid ed25519 (hidden service
1337 version 3) onion addresses. It allows one to produce customized vanity .onion
1338 addresses using a brute-force method.")
1339 (home-page "https://github.com/cathugger/mkp224o")
1340 (license license:cc0)))
1342 (define-public transcrypt
1350 (url "https://github.com/elasticdog/transcrypt")
1351 (commit (string-append "v" version))))
1353 (base32 "0bpz1hazbhfb6pqi68x55kq6a31bgh6vwij836slmi4jqiwvnh5a"))
1354 (file-name (git-file-name name version))))
1357 ("openssl" ,openssl)))
1358 (build-system copy-build-system)
1361 '(("transcrypt" "bin/transcrypt")
1362 ("man/transcrypt.1" "share/man/man1/transcrypt.1")
1363 ("contrib/bash/transcrypt"
1364 "share/bash-completion/completions/transcrypt")
1365 ("contrib/zsh/_transcrypt"
1366 "share/zsh/site-functions/_transcrypt"))))
1367 (home-page "https://github.com/elasticdog/transcrypt")
1368 (synopsis "Transparently encrypt files within a git repository")
1370 "Transcrypt is a script to configure transparent encryption of sensitive
1371 files stored in a Git repository. Files that you choose will be automatically
1372 encrypted when you commit them, and automatically decrypted when you check
1373 them out. The process will degrade gracefully, so even people without your
1374 encryption password can safely commit changes to the repository's
1375 non-encrypted files.")
1376 (license license:expat)))