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