crypto.scm 38 KB

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