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