crypto.scm 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2014 David Thompson <davet@gnu.org>
  3. ;;; Copyright © 2015, 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2016, 2017, 2018, 2019 Leo Famulari <leo@famulari.name>
  5. ;;; Copyright © 2016 Lukas Gradl <lgradl@openmailbox>
  6. ;;; Copyright © 2016–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is>
  8. ;;; Copyright © 2016, 2017, 2019, 2020 Eric Bavier <bavier@posteo.net>
  9. ;;; Copyright © 2017 Pierre Langlois <pierre.langlois@gmx.com>
  10. ;;; Copyright © 2018, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  11. ;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
  12. ;;; Copyright © 2018 Nicolas Goaziou <mail@nicolasgoaziou.fr>
  13. ;;; Copyright © 2018, 2020 Nicolò Balzarotti <nicolo@nixo.xyz>
  14. ;;; Copyright © 2018 Tim Gesthuizen <tim.gesthuizen@yahoo.de>
  15. ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
  16. ;;; Copyright © 2019 Tanguy Le Carrour <tanguy@bioneland.org>
  17. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  18. ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
  19. ;;; Copyright © 2020 Brice Waegeneire <brice@waegenei.re>
  20. ;;; Copyright © 2020 Hendur Saga <hendursaga@yahoo.com>
  21. ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
  22. ;;; Copyright © 2021 Ellis Kenyő <me@elken.dev>
  23. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  24. ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
  25. ;;;
  26. ;;; This file is part of GNU Guix.
  27. ;;;
  28. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  29. ;;; under the terms of the GNU General Public License as published by
  30. ;;; the Free Software Foundation; either version 3 of the License, or (at
  31. ;;; your option) any later version.
  32. ;;;
  33. ;;; GNU Guix is distributed in the hope that it will be useful, but
  34. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  35. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  36. ;;; GNU General Public License for more details.
  37. ;;;
  38. ;;; You should have received a copy of the GNU General Public License
  39. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  40. (define-module (gnu packages crypto)
  41. #:use-module (gnu packages)
  42. #:use-module (gnu packages admin)
  43. #:use-module (gnu packages aidc)
  44. #:use-module (gnu packages attr)
  45. #:use-module (gnu packages autotools)
  46. #:use-module (gnu packages boost)
  47. #:use-module (gnu packages check)
  48. #:use-module (gnu packages compression)
  49. #:use-module (gnu packages cpp)
  50. #:use-module (gnu packages crates-io)
  51. #:use-module (gnu packages cryptsetup)
  52. #:use-module (gnu packages curl)
  53. #:use-module (gnu packages documentation)
  54. #:use-module (gnu packages gettext)
  55. #:use-module (gnu packages gnupg)
  56. #:use-module (gnu packages golang)
  57. #:use-module (gnu packages graphviz)
  58. #:use-module (gnu packages image)
  59. #:use-module (gnu packages kerberos)
  60. #:use-module (gnu packages libbsd)
  61. #:use-module (gnu packages libffi)
  62. #:use-module (gnu packages linux)
  63. #:use-module (gnu packages logging)
  64. #:use-module (gnu packages lsof)
  65. #:use-module (gnu packages man)
  66. #:use-module (gnu packages multiprecision)
  67. #:use-module (gnu packages nettle)
  68. #:use-module (gnu packages password-utils)
  69. #:use-module (gnu packages perl)
  70. #:use-module (gnu packages perl-check)
  71. #:use-module (gnu packages pkg-config)
  72. #:use-module (gnu packages python)
  73. #:use-module (gnu packages python-xyz)
  74. #:use-module (gnu packages readline)
  75. #:use-module (gnu packages search)
  76. #:use-module (gnu packages serialization)
  77. #:use-module (gnu packages shells)
  78. #:use-module (gnu packages sqlite)
  79. #:use-module (gnu packages tcl)
  80. #:use-module (gnu packages tls)
  81. #:use-module (gnu packages version-control)
  82. #:use-module (gnu packages xml)
  83. #:use-module ((guix licenses) #:prefix license:)
  84. #:use-module (guix packages)
  85. #:use-module (guix download)
  86. #:use-module (guix git-download)
  87. #:use-module (guix gexp)
  88. #:use-module (guix build-system cargo)
  89. #:use-module (guix build-system cmake)
  90. #:use-module (guix build-system copy)
  91. #:use-module (guix build-system gnu)
  92. #:use-module (guix build-system go)
  93. #:use-module (guix build-system perl)
  94. #:use-module (guix utils)
  95. #:use-module (srfi srfi-1)
  96. #:use-module (srfi srfi-26))
  97. (define-public libdecaf
  98. (package
  99. (name "libdecaf")
  100. (version "1.0.1")
  101. (source (origin
  102. (method git-fetch)
  103. (uri (git-reference
  104. (url "git://git.code.sf.net/p/ed448goldilocks/code")
  105. (commit
  106. (string-append "v" version))))
  107. (file-name
  108. (git-file-name name version))
  109. (sha256
  110. (base32 "1ajgmyvc6a4m1h2hg1g4wz7ibx10x1xys9m6ancnmmf1f2srlfly"))))
  111. (build-system cmake-build-system)
  112. (outputs '("out" "python" "doc"))
  113. (arguments
  114. `(#:configure-flags '("-DENABLE_STATIC=OFF")
  115. #:phases
  116. (modify-phases %standard-phases
  117. (add-after 'unpack 'patch-python-binding
  118. (lambda _
  119. (substitute* "python/setup.py"
  120. (("gmake")
  121. "make")
  122. (("'\\.\\.', 'build', 'lib', 'libdecaf\\.so'")
  123. "'..', '..', 'build', 'src', 'libdecaf.so'"))))
  124. (add-after 'install 'install-python-binding
  125. (lambda* (#:key outputs #:allow-other-keys)
  126. (with-directory-excursion "../source/python"
  127. (invoke "python" "setup.py" "install"
  128. (string-append "--prefix=" (assoc-ref outputs "python"))
  129. "--root=/"))))
  130. (add-after 'install-python-binding 'install-documentation
  131. (lambda* (#:key outputs #:allow-other-keys)
  132. (invoke "make" "doc")
  133. (let* ((doc (assoc-ref outputs "doc"))
  134. (dest (string-append doc "/share/doc")))
  135. (copy-recursively "doc" dest)))))))
  136. (native-inputs
  137. `(("dot" ,graphviz)
  138. ("doxygen" ,doxygen)
  139. ("python" ,python-wrapper)))
  140. (synopsis "Decaf Elliptic Curve Library")
  141. (description "The libdecaf library is an implementation of elliptic curve
  142. cryptography using the Montgomery and Edwards curves Curve25519, Ed25519,
  143. Ed448-Goldilocks and Curve448, using the Decaf encoding.")
  144. (home-page "http://ed448goldilocks.sourceforge.net/")
  145. (license (list license:expat ;library
  146. license:bsd-2)))) ;python bindings
  147. (define-public libsodium
  148. (package
  149. (name "libsodium")
  150. (version "1.0.18")
  151. (source (origin
  152. (method url-fetch)
  153. (uri (list (string-append
  154. "https://download.libsodium.org/libsodium/"
  155. "releases/libsodium-" version ".tar.gz")
  156. (string-append
  157. "https://download.libsodium.org/libsodium/"
  158. "releases/old/libsodium-" version ".tar.gz")))
  159. (sha256
  160. (base32
  161. "1h9ncvj23qbbni958knzsli8dvybcswcjbx0qjjgi922nf848l3g"))))
  162. (build-system gnu-build-system)
  163. (synopsis "Portable NaCl-based crypto library")
  164. (description
  165. "Sodium is a new easy-to-use high-speed software library for network
  166. communication, encryption, decryption, signatures, etc.")
  167. (license license:isc)
  168. (home-page "https://libsodium.org")))
  169. (define-public libmd
  170. (package
  171. (name "libmd")
  172. (version "1.0.3")
  173. (source (origin
  174. (method url-fetch)
  175. (uri
  176. (list
  177. (string-append "https://archive.hadrons.org/software/libmd/libmd-"
  178. version ".tar.xz")
  179. (string-append "https://libbsd.freedesktop.org/releases/libmd-"
  180. version ".tar.xz")))
  181. (sha256
  182. (base32
  183. "0jmga8y94h857ilra3qjaiax3wd5pd6mx1h120zhl9fcjmzhj0js"))))
  184. (build-system gnu-build-system)
  185. (synopsis "Message Digest functions from BSD systems")
  186. (description
  187. "The currently provided message digest algorithms are:
  188. @itemize
  189. @item MD2
  190. @item MD4
  191. @item MD5
  192. @item RIPEMD-160
  193. @item SHA-1
  194. @item SHA-2 (SHA-256, SHA-384 and SHA-512)
  195. @end itemize")
  196. (license (list license:bsd-3
  197. license:bsd-2
  198. license:isc
  199. license:public-domain))
  200. (home-page "https://www.hadrons.org/software/libmd/")))
  201. (define-public signify
  202. (package
  203. (name "signify")
  204. (version "30")
  205. (home-page "https://github.com/aperezdc/signify")
  206. (source (origin
  207. (method url-fetch)
  208. (uri (string-append "https://github.com/aperezdc/signify/releases"
  209. "/download/v" version "/signify-" version ".tar.xz"))
  210. (sha256
  211. (base32
  212. "11l67j04gyxnlw6zrzsygqs5cgsc1sww1rh0apl05yay131hd17n"))))
  213. (build-system gnu-build-system)
  214. ;; TODO Build with libwaive (described in README.md), to implement something
  215. ;; like OpenBSD's pledge().
  216. (arguments
  217. `(#:make-flags
  218. (list ,(string-append "CC=" (cc-for-target))
  219. (string-append "PREFIX=" (assoc-ref %outputs "out")))
  220. #:phases
  221. (modify-phases %standard-phases
  222. (delete 'configure))))
  223. (native-inputs
  224. `(("pkg-config" ,pkg-config)))
  225. (inputs
  226. `(("libbsd" ,libbsd)))
  227. (synopsis "Create and verify cryptographic signatures")
  228. (description "The signify utility creates and verifies cryptographic
  229. signatures using the elliptic curve Ed25519. This is a Linux port of the
  230. OpenBSD tool of the same name.")
  231. ;; This package includes third-party code that was originally released under
  232. ;; various non-copyleft licenses. See the source files for clarification.
  233. (license (list license:bsd-3 license:bsd-4 license:expat license:isc
  234. license:public-domain (license:non-copyleft
  235. "file://base64.c"
  236. "See base64.c in the distribution for
  237. the license from IBM.")))))
  238. (define-public rust-minisign
  239. (package
  240. (name "rust-minisign")
  241. (version "0.5.20")
  242. (source
  243. (origin
  244. (method url-fetch)
  245. (uri (crate-uri "minisign" version))
  246. (file-name
  247. (string-append name "-" version ".tar.gz"))
  248. (sha256
  249. (base32
  250. "0xmcvh2snravghaar8igc6b9r3s1snnmf9qam9l3zyhm4987767y"))))
  251. (build-system cargo-build-system)
  252. (arguments
  253. `(#:cargo-inputs
  254. (("rust-getrandom" ,rust-getrandom-0.1)
  255. ("rust-rpassword" ,rust-rpassword-4)
  256. ("rust-scrypt" ,rust-scrypt-0.3))))
  257. (home-page "https://github.com/jedisct1/rust-minisign")
  258. (synopsis "Crate to sign files and verify signatures")
  259. (description
  260. "This package provides a crate to sign files and verify signatures.")
  261. (license license:expat)))
  262. (define-public go-minisign
  263. (package
  264. (name "go-minisign")
  265. (version "0.1.0")
  266. (source
  267. (origin
  268. (method git-fetch)
  269. (uri (git-reference
  270. (url "https://github.com/jedisct1/go-minisign")
  271. (commit version)))
  272. (file-name (git-file-name name version))
  273. (sha256
  274. (base32
  275. "0wc0rk5m60yz52f0cncmbgq67yvb1rcx91gvzjg6jpc4mpw2db27"))
  276. (modules '((guix build utils)))
  277. (snippet
  278. '(begin (delete-file-recursively "vendor") #t))))
  279. (build-system go-build-system)
  280. (arguments
  281. '(#:import-path "github.com/jedisct1/go-minisign"))
  282. (propagated-inputs
  283. `(("go-golang-org-x-crypto" ,go-golang-org-x-crypto)))
  284. (home-page "https://github.com/jedisct1/go-minisign")
  285. (synopsis "Minisign verification library for Golang")
  286. (description "A Golang library to verify Minisign signatures.")
  287. (license license:expat)))
  288. (define-public encfs
  289. (package
  290. (name "encfs")
  291. (version "1.9.5")
  292. (source
  293. (origin
  294. (method url-fetch)
  295. (uri
  296. (string-append "https://github.com/vgough/encfs/releases/download/v"
  297. version "/encfs-" version ".tar.gz"))
  298. (sha256
  299. (base32
  300. "0qzxavvv20577bxvly8s7d3y7bqasqclc2mllp0ddfncjm9z02a7"))
  301. (modules '((guix build utils)))
  302. ;; Remove bundled dependencies in favour of proper inputs.
  303. (snippet '(begin
  304. (for-each delete-file-recursively
  305. '("vendor/github.com/leethomason/tinyxml2"
  306. "vendor/github.com/google/googletest"))
  307. #t))))
  308. (build-system cmake-build-system)
  309. (native-inputs
  310. `(("gettext" ,gettext-minimal)
  311. ;; Test dependencies.
  312. ("expect" ,expect)
  313. ("googletest-source" ,(package-source googletest))
  314. ("perl" ,perl)))
  315. (inputs
  316. `(("attr" ,attr)
  317. ("fuse" ,fuse)
  318. ("openssl" ,openssl)
  319. ("tinyxml2" ,tinyxml2)))
  320. (arguments
  321. `(#:configure-flags (list "-DUSE_INTERNAL_TINYXML=OFF")
  322. #:phases
  323. (modify-phases %standard-phases
  324. (add-after 'unpack 'unpack-googletest
  325. (lambda* (#:key inputs #:allow-other-keys)
  326. (mkdir-p "vendor/github.com/google/googletest")
  327. (copy-recursively (assoc-ref inputs "googletest-source")
  328. "vendor/github.com/google/googletest")
  329. #t))
  330. (add-before 'configure 'patch-CMakeLists.txt
  331. (lambda _
  332. ;; Prevent CMake from adding libc on the system include path.
  333. ;; Otherwise it will interfere with the libc used by GCC and
  334. ;; ultimately cause #include_next errors.
  335. (substitute* "CMakeLists.txt"
  336. (("include_directories \\(SYSTEM \\$\\{Intl_INCLUDE_DIRS\\}\\)")
  337. ""))
  338. #t))
  339. (add-before 'check 'make-unittests
  340. (lambda _
  341. (invoke "make" "unittests"))))))
  342. (home-page "https://vgough.github.io/encfs")
  343. (synopsis "Encrypted virtual file system")
  344. (description
  345. "EncFS creates a virtual encrypted file system in user-space. Each file
  346. created under an EncFS mount point is stored as a separate encrypted file on
  347. the underlying file system. Like most encrypted file systems, EncFS is meant
  348. to provide security against off-line attacks, such as a drive falling into
  349. the wrong hands.")
  350. (license (list license:expat ; internal/easylogging++.h
  351. license:lgpl3+ ; encfs library
  352. license:gpl3+)))) ; command-line tools
  353. (define-public keyutils
  354. (package
  355. (name "keyutils")
  356. (version "1.6.1")
  357. (source
  358. (origin
  359. (method url-fetch)
  360. (uri
  361. (string-append "https://people.redhat.com/dhowells/keyutils/keyutils-"
  362. version ".tar.bz2"))
  363. (sha256
  364. (base32 "1kk4pmyflgplkgxn2bzpc069ph9c9jdd9ikcsyd5pnaimqi5gcf8"))
  365. (modules '((guix build utils)))
  366. ;; Create relative symbolic links instead of absolute ones to /lib/*.
  367. (snippet '(begin
  368. (substitute* "Makefile" (("\\$\\(LNS\\) \\$\\(LIBDIR\\)/")
  369. "$(LNS) "))
  370. #t))))
  371. (build-system gnu-build-system)
  372. (arguments
  373. `(#:phases (modify-phases %standard-phases
  374. (delete 'configure)) ; no configure script
  375. #:make-flags (list ,(string-append "CC=" (cc-for-target))
  376. "RPATH=-Wl,-rpath,$(DESTDIR)$(LIBDIR)"
  377. (string-append "DESTDIR="
  378. (assoc-ref %outputs "out"))
  379. "INCLUDEDIR=/include"
  380. "LIBDIR=/lib"
  381. "MANDIR=/share/man"
  382. "SHAREDIR=/share/keyutils")
  383. #:test-target "test"))
  384. (inputs
  385. `(("mit-krb5" ,mit-krb5)))
  386. (home-page "https://people.redhat.com/dhowells/keyutils/")
  387. (synopsis "Linux key management utilities")
  388. (description
  389. "Keyutils is a set of utilities for managing the key retention facility in
  390. the Linux kernel, which can be used by file systems, block devices, and more to
  391. gain and retain the authorization and encryption keys required to perform
  392. secure operations. ")
  393. (license (list license:lgpl2.1+ ; the files keyutils.*
  394. license:gpl2+)))) ; the rest
  395. (define-public ssss
  396. (package
  397. (name "ssss")
  398. (version "0.5")
  399. (source (origin
  400. (method url-fetch)
  401. (uri (string-append "http://point-at-infinity.org/ssss/ssss-"
  402. version ".tar.gz"))
  403. (sha256
  404. (base32
  405. "15grn2fp1x8p92kxkwbmsx8rz16g93y9grl3hfqbh1jn21ama5jx"))))
  406. (build-system gnu-build-system)
  407. (arguments
  408. `(#:tests? #f ; No test suite
  409. #:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  410. ,(string-append "CC=" (cc-for-target)))
  411. #:phases
  412. (modify-phases %standard-phases
  413. (delete 'configure) ; no configuration to be done
  414. (replace 'install
  415. (lambda* (#:key outputs #:allow-other-keys)
  416. (let* ((outdir (assoc-ref outputs "out"))
  417. (bindir (string-append outdir "/bin"))
  418. (docdir (string-append outdir
  419. "/share/doc/ssss-"
  420. ,version)))
  421. (install-file "ssss-combine" bindir)
  422. (install-file "ssss-split" bindir)
  423. (install-file "ssss.1" docdir)
  424. (install-file "ssss.1.html" docdir)
  425. #t))))))
  426. (inputs
  427. `(("gmp" ,gmp)))
  428. (native-inputs
  429. `(("xmltoman" ,xmltoman)))
  430. (home-page "http://point-at-infinity.org/ssss/")
  431. (synopsis "Shamir's secret sharing scheme implementation")
  432. (description "@command{ssss-split} and @command{ssss-combine} are utilities that split
  433. and combine secrets securely using Shamir's secret sharing scheme. This implementation
  434. allows for a threshold scheme where the minimum number of shares can be less than the
  435. total number of shares generated.")
  436. (license license:gpl2+)))
  437. (define-public tomb
  438. (package
  439. (name "tomb")
  440. (version "2.9")
  441. (source (origin
  442. (method url-fetch)
  443. (uri (string-append "https://files.dyne.org/tomb/releases/"
  444. "Tomb-" version ".tar.gz"))
  445. (sha256
  446. (base32
  447. "136nfnpaz29hngwwnzrmc858gpnvnb977gf4ldbpapw1h1k3r8mk"))))
  448. (build-system gnu-build-system)
  449. (native-inputs `(("sudo" ,sudo))) ;presence needed for 'check' phase
  450. (inputs
  451. `(("zsh" ,zsh)
  452. ("gnupg" ,gnupg)
  453. ("cryptsetup" ,cryptsetup)
  454. ("e2fsprogs" ,e2fsprogs) ;for mkfs.ext4
  455. ("gettext" ,gettext-minimal) ;used at runtime
  456. ("lsof" ,lsof)
  457. ("mlocate" ,mlocate)
  458. ("pinentry" ,pinentry)
  459. ("qrencode" ,qrencode)
  460. ("steghide" ,steghide)
  461. ("util-linux" ,util-linux)))
  462. (arguments
  463. `(#:make-flags (list (string-append "PREFIX=" (assoc-ref %outputs "out")))
  464. ;; The "sudo" input is needed only to satisfy dependency checks in the
  465. ;; 'check' phase. The "sudo" used at runtime should come from the
  466. ;; system's setuid-programs, so ensure no reference is kept.
  467. #:disallowed-references (,sudo)
  468. ;; TODO: Build and install gtk and qt trays
  469. #:phases
  470. (modify-phases %standard-phases
  471. (delete 'configure) ;no configuration to be done
  472. (add-after 'install 'i18n
  473. (lambda* (#:key make-flags #:allow-other-keys)
  474. (apply invoke "make" "-C" "extras/translations"
  475. "install" make-flags)
  476. #t))
  477. (add-after 'install 'wrap
  478. (lambda* (#:key inputs outputs #:allow-other-keys)
  479. (let ((out (assoc-ref outputs "out")))
  480. (wrap-program (string-append out "/bin/tomb")
  481. `("PATH" ":" prefix
  482. (,(string-append (assoc-ref inputs "mlocate") "/bin")
  483. ,@(map (lambda (program)
  484. (or (and=> (which program) dirname)
  485. (error "program not found:" program)))
  486. '("seq" "mkfs.ext4" "pinentry"
  487. "gpg" "cryptsetup" "gettext" "lsof"
  488. "qrencode" "steghide" "findmnt" "getent")))))
  489. #t)))
  490. (delete 'check)
  491. (add-after 'wrap 'check
  492. (lambda* (#:key outputs #:allow-other-keys)
  493. ;; Running the full tests requires sudo/root access for
  494. ;; cryptsetup, which is not available in the build environment.
  495. ;; But we can run `tomb dig` without root, so make sure that
  496. ;; works. TODO: It Would Be Nice to check the expected "index",
  497. ;; "search", "bury", and "exhume" features are available by
  498. ;; querying `tomb -h`.
  499. (let ((tomb (string-append (assoc-ref outputs "out")
  500. "/bin/tomb")))
  501. (invoke tomb "dig" "-s" "10" "secrets.tomb")
  502. #t))))))
  503. (home-page "https://www.dyne.org/software/tomb")
  504. (synopsis "File encryption for secret data")
  505. (description
  506. "Tomb is an application to manage the creation and access of encrypted
  507. storage files: it can be operated from commandline and it can integrate with a
  508. user's graphical desktop.")
  509. (license license:gpl3+)))
  510. (define-public scrypt
  511. (package
  512. (name "scrypt")
  513. (version "1.3.1")
  514. (source
  515. (origin
  516. (method url-fetch)
  517. (uri (string-append "https://www.tarsnap.com/scrypt/scrypt-"
  518. version ".tgz"))
  519. (sha256
  520. (base32
  521. "1hnl0r6pmyxiy4dmafmqk1db7wpc0x9rqpzqcwr9d2cmghcj6byz"))))
  522. (build-system gnu-build-system)
  523. (arguments
  524. `(#:license-file-regexp "COPYRIGHT"
  525. #:phases (modify-phases %standard-phases
  526. (add-after 'unpack 'patch-$PATH-assumptions
  527. (lambda _
  528. (substitute* "configure"
  529. (("\\{POSIX_PATH\\}")
  530. "{PATH}"))
  531. (substitute* "Makefile.in"
  532. (("command -p") ""))
  533. #t))
  534. (add-after 'install 'install-docs
  535. (lambda* (#:key outputs #:allow-other-keys)
  536. (let* ((out (assoc-ref %outputs "out"))
  537. (doc (string-append out "/share/doc/" ,name "-" ,version)))
  538. (install-file "FORMAT" doc)
  539. #t))))))
  540. (inputs
  541. `(("openssl" ,openssl)))
  542. (home-page "https://www.tarsnap.com/scrypt.html")
  543. (synopsis "Memory-hard encryption tool based on scrypt")
  544. (description "This package provides a simple password-based encryption
  545. utility as a demonstration of the @code{scrypt} key derivation function.
  546. @code{Scrypt} is designed to be far more resistant against hardware brute-force
  547. attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
  548. (license license:bsd-2)))
  549. (define-public libscrypt
  550. (package
  551. (name "libscrypt")
  552. (version "1.21")
  553. (source
  554. (origin
  555. (method git-fetch)
  556. (uri (git-reference
  557. (url "https://github.com/technion/libscrypt")
  558. (commit (string-append "v" version))))
  559. (file-name (git-file-name name version))
  560. (sha256
  561. (base32
  562. "1d76ys6cp7fi4ng1w3mz2l0p9dbr7ljbk33dcywyimzjz8bahdng"))))
  563. (build-system gnu-build-system)
  564. (outputs (list "out" "static"))
  565. (arguments
  566. `(#:make-flags (list (string-append "PREFIX=" %output)
  567. ,(string-append "CC=" (cc-for-target)))
  568. #:phases
  569. (modify-phases %standard-phases
  570. (delete 'configure) ; no configure script
  571. (add-after 'install 'install:static
  572. (lambda* (#:key outputs #:allow-other-keys)
  573. (let* ((out (assoc-ref outputs "out"))
  574. (lib (string-append out "/lib")))
  575. (install-file "libscrypt.a" lib)
  576. #t))))))
  577. (home-page "https://lolware.net/libscrypt.html")
  578. (synopsis "Password hashing library")
  579. (description "@code{libscrypt} implements @code{scrypt} key derivation
  580. function. It is designed to be far more secure against hardware brute-force
  581. attacks than alternative functions such as @code{PBKDF2} or @code{bcrypt}.")
  582. (license license:bsd-3)))
  583. (define-public perl-math-random-isaac-xs
  584. (package
  585. (name "perl-math-random-isaac-xs")
  586. (version "1.004")
  587. (source
  588. (origin
  589. (method url-fetch)
  590. (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
  591. "Math-Random-ISAAC-XS-" version ".tar.gz"))
  592. (sha256
  593. (base32
  594. "0yxqqcqvj51fn7b7j5xqhz65v74arzgainn66c6k7inijbmr1xws"))))
  595. (build-system perl-build-system)
  596. (native-inputs
  597. `(("perl-module-build" ,perl-module-build)
  598. ("perl-test-nowarnings" ,perl-test-nowarnings)))
  599. (home-page "https://metacpan.org/release/Math-Random-ISAAC-XS")
  600. (synopsis "C implementation of the ISAAC PRNG algorithm")
  601. (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
  602. fast pseudo-random number generator. It is suitable for applications where a
  603. significant amount of random data needs to be produced quickly, such as
  604. solving using the Monte Carlo method or for games. The results are uniformly
  605. distributed, unbiased, and unpredictable unless you know the seed.
  606. This package implements the same interface as @code{Math::Random::ISAAC}.")
  607. (license license:public-domain)))
  608. (define-public perl-math-random-isaac
  609. (package
  610. (name "perl-math-random-isaac")
  611. (version "1.004")
  612. (source
  613. (origin
  614. (method url-fetch)
  615. (uri (string-append "mirror://cpan/authors/id/J/JA/JAWNSY/"
  616. "Math-Random-ISAAC-" version ".tar.gz"))
  617. (sha256
  618. (base32
  619. "0z1b3xbb3xz71h25fg6jgsccra7migq7s0vawx2rfzi0pwpz0wr7"))))
  620. (build-system perl-build-system)
  621. (native-inputs
  622. `(("perl-test-nowarnings" ,perl-test-nowarnings)))
  623. (propagated-inputs
  624. `(("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)))
  625. (home-page "https://metacpan.org/release/Math-Random-ISAAC")
  626. (synopsis "Perl interface to the ISAAC PRNG algorithm")
  627. (description "ISAAC (Indirection, Shift, Accumulate, Add, and Count) is a
  628. fast pseudo-random number generator. It is suitable for applications where a
  629. significant amount of random data needs to be produced quickly, such as
  630. solving using the Monte Carlo method or for games. The results are uniformly
  631. distributed, unbiased, and unpredictable unless you know the seed.
  632. This package provides a Perl interface to the ISAAC pseudo random number
  633. generator.")
  634. (license license:public-domain)))
  635. (define-public perl-crypt-random-source
  636. (package
  637. (name "perl-crypt-random-source")
  638. (version "0.14")
  639. (source
  640. (origin
  641. (method url-fetch)
  642. (uri (string-append "mirror://cpan/authors/id/E/ET/ETHER/"
  643. "Crypt-Random-Source-" version ".tar.gz"))
  644. (sha256
  645. (base32 "1rpdds3sy5l1fhngnkrsgwsmwd54wpicx3i9ds69blcskwkcwkpc"))))
  646. (build-system perl-build-system)
  647. (native-inputs
  648. `(("perl-module-build-tiny" ,perl-module-build-tiny)
  649. ("perl-test-fatal" ,perl-test-fatal)))
  650. (propagated-inputs
  651. `(("perl-capture-tiny" ,perl-capture-tiny)
  652. ("perl-module-find" ,perl-module-find)
  653. ("perl-module-runtime" ,perl-module-runtime)
  654. ("perl-moo" ,perl-moo)
  655. ("perl-namespace-clean" ,perl-namespace-clean)
  656. ("perl-sub-exporter" ,perl-sub-exporter)
  657. ("perl-type-tiny" ,perl-type-tiny)))
  658. (home-page "https://metacpan.org/release/Crypt-Random-Source")
  659. (synopsis "Get weak or strong random data from pluggable sources")
  660. (description "This module provides implementations for a number of
  661. byte-oriented sources of random data.")
  662. (license license:perl-license)))
  663. (define-public perl-math-random-secure
  664. (package
  665. (name "perl-math-random-secure")
  666. (version "0.080001")
  667. (source
  668. (origin
  669. (method url-fetch)
  670. (uri (string-append "mirror://cpan/authors/id/F/FR/FREW/"
  671. "Math-Random-Secure-" version ".tar.gz"))
  672. (sha256
  673. (base32
  674. "0dgbf4ncll4kmgkyb9fsaxn0vf2smc9dmwqzgh3259zc2zla995z"))))
  675. (build-system perl-build-system)
  676. (native-inputs
  677. `(("perl-list-moreutils" ,perl-list-moreutils)
  678. ("perl-test-leaktrace" ,perl-test-leaktrace)
  679. ("perl-test-sharedfork" ,perl-test-sharedfork)
  680. ("perl-test-warn" ,perl-test-warn)))
  681. (inputs
  682. `(("perl-crypt-random-source" ,perl-crypt-random-source)
  683. ("perl-math-random-isaac" ,perl-math-random-isaac)
  684. ("perl-math-random-isaac-xs" ,perl-math-random-isaac-xs)
  685. ("perl-moo" ,perl-moo)))
  686. (home-page "https://metacpan.org/release/Math-Random-Secure")
  687. (synopsis "Cryptographically secure replacement for rand()")
  688. (description "This module is intended to provide a
  689. cryptographically-secure replacement for Perl's built-in @code{rand} function.
  690. \"Crytographically secure\", in this case, means:
  691. @enumerate
  692. @item No matter how many numbers you see generated by the random number
  693. generator, you cannot guess the future numbers, and you cannot guess the seed.
  694. @item There are so many possible seeds that it would take decades, centuries,
  695. or millennia for an attacker to try them all.
  696. @item The seed comes from a source that generates relatively strong random
  697. data on your platform, so the seed itself will be as random as possible.
  698. @end enumerate\n")
  699. (license license:artistic2.0)))
  700. (define-public crypto++
  701. (package
  702. (name "crypto++")
  703. (version "8.5.0")
  704. (source (origin
  705. (method git-fetch)
  706. (uri
  707. (git-reference
  708. (url "https://github.com/weidai11/cryptopp")
  709. (commit
  710. (string-append "CRYPTOPP_"
  711. (string-replace-substring version "." "_")))))
  712. (file-name (git-file-name name version))
  713. (sha256
  714. (base32
  715. "0in7rlazq91vfi519g9wr7bh87hii47cimxv7fmj0f88vhjaidq3"))))
  716. (build-system gnu-build-system)
  717. (arguments
  718. `(#:make-flags
  719. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  720. ;; Override "/sbin/ldconfig" with simply "echo" since
  721. ;; we don't need ldconfig(8).
  722. "LDCONF=echo")
  723. #:phases
  724. (modify-phases %standard-phases
  725. (add-after 'unpack 'disable-native-optimisation
  726. ;; This package installs more than just headers. Ensure that the
  727. ;; cryptest.exe binary & static library aren't CPU model specific.
  728. (lambda _
  729. (substitute* "GNUmakefile"
  730. ((" -march=native") ""))
  731. #t))
  732. (delete 'configure)
  733. (replace 'build
  734. ;; By default, only the static library is built.
  735. (lambda* (#:key (make-flags '()) #:allow-other-keys)
  736. (apply invoke "make" "shared"
  737. "-j" (number->string (parallel-job-count))
  738. make-flags)))
  739. (add-after 'install 'install-shared-library-links
  740. ;; By default, only .so and .so.x.y.z are installed.
  741. ;; Create all the ‘intermediates’ expected by dependent packages.
  742. (lambda* (#:key outputs #:allow-other-keys)
  743. (let* ((out (assoc-ref outputs "out"))
  744. (lib (string-append out "/lib"))
  745. (prefix "libcryptopp.so.")
  746. (target (string-append prefix ,version)))
  747. (with-directory-excursion lib
  748. (symlink target
  749. (string-append prefix ,(version-major+minor version)))
  750. (symlink target
  751. (string-append prefix ,(version-major version)))
  752. #t))))
  753. (add-after 'install 'install-pkg-config
  754. (lambda* (#:key outputs #:allow-other-keys)
  755. (let* ((out (assoc-ref outputs "out"))
  756. (pkg-dir (string-append out "/lib/pkgconfig")))
  757. (mkdir-p pkg-dir)
  758. (with-output-to-file (string-append pkg-dir "/libcrypto++.pc")
  759. (lambda _
  760. (display
  761. (string-append
  762. "prefix=" out "\n"
  763. "libdir=" out "/lib\n"
  764. "includedir=" out "/include\n\n"
  765. "Name: libcrypto++-" ,version "\n"
  766. "Description: Class library of cryptographic schemes\n"
  767. "Version: " ,version "\n"
  768. "Libs: -L${libdir} -lcryptopp\n"
  769. "Cflags: -I${includedir}\n"))
  770. #t))))))))
  771. (native-inputs
  772. `(("unzip" ,unzip)))
  773. (home-page "https://cryptopp.com/")
  774. (synopsis "C++ class library of cryptographic schemes")
  775. (description "Crypto++ is a C++ class library of cryptographic schemes.")
  776. ;; The compilation is distributed under the Boost license; the individual
  777. ;; files in the compilation are in the public domain.
  778. (license (list license:boost1.0 license:public-domain))))
  779. (define-public libb2
  780. (package
  781. (name "libb2")
  782. (version "0.98.1")
  783. (source (origin
  784. (method url-fetch)
  785. (uri (string-append
  786. "https://github.com/BLAKE2/libb2/releases/download/v"
  787. version "/libb2-" version ".tar.gz"))
  788. (sha256
  789. (base32
  790. "0bn7yrzdixdvzm46shbhpkqbr6zyqyxiqn7a7x54ag3mrvfnyqjk"))))
  791. (build-system gnu-build-system)
  792. (arguments
  793. `(#:configure-flags
  794. (list
  795. ,@(if (any (cute string-prefix? <> (or (%current-system)
  796. (%current-target-system)))
  797. '("x86_64" "i686"))
  798. ;; fat only checks for Intel optimisations
  799. '("--enable-fat")
  800. '())
  801. "--disable-native"))) ;don't optimise at build time
  802. (home-page "https://blake2.net/")
  803. (synopsis "Library implementing the BLAKE2 family of hash functions")
  804. (description
  805. "libb2 is a portable implementation of the BLAKE2 family of cryptographic
  806. hash functions. It includes optimised implementations for IA-32 and AMD64
  807. processors, and an interface layer that automatically selects the best
  808. implementation for the processor it is run on.
  809. @dfn{BLAKE2} (RFC 7693) is a family of high-speed cryptographic hash functions
  810. that are faster than MD5, SHA-1, SHA-2, and SHA-3, yet are at least as secure
  811. as the latest standard, SHA-3. It is an improved version of the SHA-3 finalist
  812. BLAKE.")
  813. (license license:public-domain)))
  814. (define-public rhash
  815. (package
  816. (name "rhash")
  817. (version "1.4.2")
  818. (source
  819. (origin
  820. (method url-fetch)
  821. (uri (string-append "mirror://sourceforge/rhash/rhash/" version
  822. "/rhash-" version "-src.tar.gz"))
  823. (file-name (string-append "rhash-" version ".tar.gz"))
  824. (sha256
  825. (base32
  826. "0qpc1fq7gdxxl11zya1gqhl9628jjk3x60q9sna43w0yz7sh03b0"))))
  827. (build-system gnu-build-system)
  828. (arguments
  829. (list #:configure-flags
  830. #~(list (string-append "--prefix=" #$output)
  831. #$@(let ((target (%current-target-system)))
  832. (if target
  833. #~((string-append "--target=" #$target)
  834. (string-append "--cc="
  835. (assoc-ref %build-inputs "cross-gcc")
  836. "/bin/" #$target "-gcc"))
  837. #~())))
  838. #:make-flags
  839. ;; The binaries in /bin need some help finding librhash.so.0.
  840. #~(list (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
  841. #:test-target "test" ; ‘make check’ just checks the sources
  842. #:phases
  843. #~(modify-phases %standard-phases
  844. (delete 'configure)
  845. (add-before 'build 'configure
  846. ;; ./configure is not GNU autotools' and doesn't gracefully handle
  847. ;; unrecognized options, so we must call it manually.
  848. (lambda* (#:key configure-flags #:allow-other-keys)
  849. (apply invoke "./configure" configure-flags)))
  850. (add-before 'check 'patch-/bin/sh
  851. (lambda _
  852. (substitute* "Makefile"
  853. (("/bin/sh") (which "sh")))))
  854. (add-after 'install 'install-library-extras
  855. (lambda* (#:key make-flags #:allow-other-keys)
  856. (apply invoke
  857. "make" "-C" "librhash"
  858. "install-lib-headers" "install-so-link"
  859. make-flags))))))
  860. (home-page "https://sourceforge.net/projects/rhash/")
  861. (synopsis "Utility for computing hash sums")
  862. (description "RHash is a console utility for calculation and verification
  863. of magnet links and a wide range of hash sums like CRC32, MD4, MD5, SHA1,
  864. SHA256, SHA512, SHA3, AICH, ED2K, Tiger, DC++ TTH, BitTorrent BTIH, GOST R
  865. 34.11-94, RIPEMD-160, HAS-160, EDON-R, Whirlpool and Snefru.")
  866. (license (license:non-copyleft "file://COPYING"))))
  867. (define-public botan
  868. (package
  869. (name "botan")
  870. (version "2.18.1")
  871. (source (origin
  872. (method url-fetch)
  873. (uri (string-append "https://botan.randombit.net/releases/"
  874. "Botan-" version ".tar.xz"))
  875. (sha256
  876. (base32
  877. "0adf53drhk1hlpfih0175c9081bqpclw6p2afn51cmx849ib9izq"))))
  878. (build-system gnu-build-system)
  879. (arguments
  880. '(#:phases
  881. (modify-phases %standard-phases
  882. (replace 'configure
  883. (lambda* (#:key inputs outputs #:allow-other-keys)
  884. (let* ((out (assoc-ref %outputs "out"))
  885. (lib (string-append out "/lib")))
  886. ;; Upstream tests and benchmarks with -O3.
  887. (setenv "CXXFLAGS" "-O3")
  888. (invoke "python" "./configure.py"
  889. (string-append "--prefix=" out)
  890. ;; Otherwise, the `botan` executable cannot find
  891. ;; libbotan.
  892. (string-append "--ldflags=-Wl,-rpath=" lib)
  893. "--with-os-feature=getentropy"
  894. "--with-rst2man"
  895. ;; Recommended by upstream
  896. "--with-zlib" "--with-bzip2" "--with-sqlite3"))))
  897. (add-before 'check 'library-path-for-tests
  898. (lambda _ (setenv "LD_LIBRARY_PATH" (getcwd))))
  899. (replace 'check
  900. (lambda* (#:key tests? #:allow-other-keys)
  901. (if tests?
  902. (invoke "./botan-test")))))))
  903. (native-inputs
  904. `(("python" ,python-wrapper)
  905. ("python-docutils" ,python-docutils)))
  906. (inputs
  907. `(("sqlite" ,sqlite)
  908. ("bzip2" ,bzip2)
  909. ("zlib" ,zlib)))
  910. (synopsis "Cryptographic library in C++11")
  911. (description "Botan is a cryptography library, written in C++11, offering
  912. the tools necessary to implement a range of practical systems, such as TLS/DTLS,
  913. PKIX certificate handling, PKCS#11 and TPM hardware support, password hashing,
  914. and post-quantum crypto schemes. In addition to the C++, botan has a C89 API
  915. specifically designed to be easy to call from other languages. A Python binding
  916. using ctypes is included, and several other language bindings are available.")
  917. (home-page "https://botan.randombit.net")
  918. (license license:bsd-2)))
  919. (define-public ccrypt
  920. (package
  921. (name "ccrypt")
  922. (version "1.11")
  923. (source (origin
  924. (method url-fetch)
  925. (uri (string-append "mirror://sourceforge/ccrypt/"
  926. version "/ccrypt-" version ".tar.gz"))
  927. (sha256
  928. (base32
  929. "0kx4a5mhmp73ljknl2lcccmw9z3f5y8lqw0ghaymzvln1984g75i"))))
  930. (build-system gnu-build-system)
  931. (home-page "http://ccrypt.sourceforge.net")
  932. (synopsis "Command-line utility for encrypting and decrypting files and streams")
  933. (description "@command{ccrypt} is a utility for encrypting and decrypting
  934. files and streams. It was designed as a replacement for the standard unix
  935. @command{crypt} utility, which is notorious for using a very weak encryption
  936. algorithm. @command{ccrypt} is based on the Rijndael block cipher, a version of
  937. which is also used in the Advanced Encryption Standard (AES, see
  938. @url{http://www.nist.gov/aes}). This cipher is believed to provide very strong
  939. security.")
  940. (license license:gpl2)))
  941. (define-public asignify
  942. (let ((commit "f58e7977a599f040797975d649ed318e25cbd2d5")
  943. (revision "0"))
  944. (package
  945. (name "asignify")
  946. (version (git-version "1.1" revision commit))
  947. (source (origin
  948. (method git-fetch)
  949. (uri (git-reference
  950. (url "https://github.com/vstakhov/asignify")
  951. (commit commit)))
  952. (file-name (git-file-name name version))
  953. (sha256
  954. (base32
  955. "1zl68qq6js6fdahxzyhvhrpyrwlv8c2zhdplycnfxyr1ckkhq8dw"))))
  956. (build-system gnu-build-system)
  957. (arguments
  958. `(#:configure-flags
  959. (list "--enable-openssl"
  960. (string-append "--with-openssl="
  961. (assoc-ref %build-inputs "openssl")))))
  962. (native-inputs
  963. `(("autoconf" ,autoconf)
  964. ("automake" ,automake)
  965. ("libtool" ,libtool)))
  966. (inputs
  967. `(("openssl" ,openssl)))
  968. (home-page "https://github.com/vstakhov/asignify")
  969. (synopsis "Cryptographic authentication and encryption tool and library")
  970. (description "Asignify offers public cryptographic signatures and
  971. encryption with a library or a command-line tool. The tool is heavily inspired
  972. by signify as used in OpenBSD. The main goal of this project is to define a
  973. high level API for signing files, validating signatures and encrypting using
  974. public-key cryptography. Asignify is designed to be portable and self-contained
  975. with zero external dependencies. Asignify can verify OpenBSD signatures, but it
  976. cannot sign messages in OpenBSD format yet.")
  977. (license license:bsd-2))))
  978. (define-public enchive
  979. (package
  980. (name "enchive")
  981. (version "3.5")
  982. (source (origin
  983. (method git-fetch)
  984. (uri (git-reference
  985. (url "https://github.com/skeeto/enchive")
  986. (commit version)))
  987. (sha256
  988. (base32
  989. "0fdrfc5l42lj2bvmv9dmkmhmm7qiszwk7cmdvnqad3fs7652g0qa"))
  990. (file-name (git-file-name name version))))
  991. (build-system gnu-build-system)
  992. (arguments
  993. `(#:tests? #f ; no check target '
  994. #:make-flags (list ,(string-append "CC=" (cc-for-target))
  995. "PREFIX=$(out)")
  996. #:phases (modify-phases %standard-phases
  997. (delete 'configure)
  998. (add-after 'install 'post-install
  999. (lambda _
  1000. (let* ((out (assoc-ref %outputs "out"))
  1001. (lisp (string-append out "/share/emacs/site-lisp")))
  1002. (install-file "enchive-mode.el" lisp)
  1003. #t))))))
  1004. (synopsis "Encrypted personal archives")
  1005. (description
  1006. "Enchive is a tool to encrypt files to yourself for long-term
  1007. archival. It's a focused, simple alternative to more complex solutions such as
  1008. GnuPG or encrypted filesystems. Enchive has no external dependencies and is
  1009. trivial to build for local use. Portability is emphasized over performance.")
  1010. (home-page "https://github.com/skeeto/enchive")
  1011. (license license:unlicense)))
  1012. (define-public libsecp256k1
  1013. (let ((commit "dbd41db16a0e91b2566820898a3ab2d7dad4fe00"))
  1014. (package
  1015. (name "libsecp256k1")
  1016. (version (git-version "20200615" "1" commit))
  1017. (source (origin
  1018. (method git-fetch)
  1019. (uri (git-reference
  1020. (url "https://github.com/bitcoin-core/secp256k1")
  1021. (commit commit)))
  1022. (sha256
  1023. (base32
  1024. "1fcpnksq5cqwqzshn5f0lq94b73p3frwbp04hgmmbnrndpqg6mpy"))
  1025. (file-name (git-file-name name version))))
  1026. (build-system gnu-build-system)
  1027. (arguments
  1028. '(#:configure-flags '("--enable-module-recovery"
  1029. "--enable-experimental"
  1030. "--enable-module-ecdh"
  1031. "--enable-shared")))
  1032. (native-inputs
  1033. `(("autoconf" ,autoconf)
  1034. ("automake" ,automake)
  1035. ("libtool" ,libtool)))
  1036. ;; WARNING: This package might need additional configure flags to run properly.
  1037. ;; See https://github.com/archlinux/svntogit-community/blob/packages/libsecp256k1/trunk/PKGBUILD.
  1038. (synopsis "C library for EC operations on curve secp256k1")
  1039. (description
  1040. "Optimized C library for EC operations on curve secp256k1.
  1041. This library is a work in progress and is being used to research best
  1042. practices. Use at your own risk.
  1043. Features:
  1044. @itemize
  1045. @item secp256k1 ECDSA signing/verification and key generation.
  1046. @item Adding/multiplying private/public keys.
  1047. @item Serialization/parsing of private keys, public keys, signatures.
  1048. @item Constant time, constant memory access signing and pubkey generation.
  1049. @item Derandomized DSA (via RFC6979 or with a caller provided function.)
  1050. @item Very efficient implementation.
  1051. @end itemize\n")
  1052. (home-page "https://github.com/bitcoin-core/secp256k1")
  1053. (license license:unlicense))))
  1054. (define-public libsecp256k1-bitcoin-cash
  1055. (package
  1056. (name "libsecp256k1-bitcoin-cash")
  1057. (version "0.22.1")
  1058. (source
  1059. (origin
  1060. (method git-fetch)
  1061. (uri (git-reference
  1062. (url "https://github.com/Bitcoin-ABC/secp256k1")
  1063. (commit (string-append "v" version))))
  1064. (file-name (git-file-name name version))
  1065. (sha256
  1066. (base32 "1rnif3iny6pz1r3g69bagzr342mm3x0v66b60csnmm1rg44bd5v1"))))
  1067. (build-system gnu-build-system)
  1068. (native-inputs
  1069. `(("autoconf" ,autoconf)
  1070. ("automake" ,automake)
  1071. ("libtool" ,libtool)))
  1072. (arguments
  1073. '(#:configure-flags '("--enable-module-recovery"
  1074. "--enable-experimental"
  1075. "--enable-module-ecdh"
  1076. "--disable-jni"
  1077. "--with-bignum=no"
  1078. "--enable-module-schnorr"
  1079. "--disable-static"
  1080. "--enable-shared")))
  1081. (synopsis "Optimized C library for EC operations on curve secp256k1")
  1082. (description
  1083. "Optimized C library for cryptographic operations on curve secp256k1.
  1084. This library is used for consensus critical cryptographic operations on the
  1085. Bitcoin Cash network.
  1086. Features:
  1087. @itemize
  1088. @item secp256k1 ECDSA signing/verification and key generation.
  1089. @item secp256k1 Schnorr signing/verification (Bitcoin Cash Schnorr variant).
  1090. @item Additive and multiplicative tweaking of secret/public keys.
  1091. @item Serialization/parsing of secret keys, public keys, signatures.
  1092. @item Constant time, constant memory access signing and pubkey generation.
  1093. @item Derandomized ECDSA (via RFC6979 or with a caller provided function).
  1094. @item Very efficient implementation.
  1095. @item Suitable for embedded systems.
  1096. @item Optional module for public key recovery.
  1097. @item Optional module for ECDH key exchange (experimental).
  1098. @item Optional module for multiset hash (experimental).
  1099. @end itemize\n")
  1100. (home-page "https://github.com/Bitcoin-ABC/secp256k1")
  1101. (license license:expat)))
  1102. (define-public stoken
  1103. (package
  1104. (name "stoken")
  1105. (version "0.92")
  1106. (source (origin
  1107. (method url-fetch)
  1108. (uri (string-append "mirror://sourceforge/stoken/"
  1109. "stoken-" version ".tar.gz"))
  1110. (sha256
  1111. (base32
  1112. "0npgr6y85gzwksy8jkwa4yzvqwjprwnplx3yiw3ayk4f0ldlhaxa"))))
  1113. (build-system gnu-build-system)
  1114. (native-inputs
  1115. `(("pkg-config" ,pkg-config)))
  1116. (inputs
  1117. `(("nettle" ,nettle)
  1118. ("libxml2" ,libxml2)))
  1119. (home-page "http://stoken.sf.net")
  1120. (synopsis "Software Token for cryptographic authentication")
  1121. (description
  1122. "@code{stoken} is a token code generator compatible with RSA SecurID
  1123. 128-bit (AES) tokens. This package contains a standalone command-line program
  1124. that allows for importing token seeds, generating token codes, and various
  1125. utility/testing functions.")
  1126. (license license:lgpl2.1+)))
  1127. (define-public hpenc
  1128. (package
  1129. (name "hpenc")
  1130. (version "3.0")
  1131. (source (origin
  1132. (method git-fetch)
  1133. (uri (git-reference
  1134. (url "https://github.com/vstakhov/hpenc")
  1135. (commit version)))
  1136. (file-name (git-file-name name version))
  1137. (sha256
  1138. (base32
  1139. "1fb5yi3d2k8kd4zm7liiqagpz610y168xrr1cvn7cbq314jm2my1"))))
  1140. (build-system gnu-build-system)
  1141. (arguments
  1142. `(#:tests? #f ; No test suite
  1143. #:make-flags
  1144. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  1145. ;; Build the program and the docs.
  1146. "SUBDIRS=src doc")
  1147. #:phases
  1148. (modify-phases %standard-phases
  1149. (delete 'configure) ; No ./configure script
  1150. (add-after 'unpack 'patch-path
  1151. (lambda _
  1152. (substitute* '("src/Makefile" "doc/Makefile")
  1153. (("/usr/bin/install")
  1154. "install"))))
  1155. (add-before 'install 'make-output-directories
  1156. (lambda* (#:key outputs #:allow-other-keys)
  1157. (let* ((out (assoc-ref outputs "out"))
  1158. (bin (string-append out "/bin"))
  1159. (man1 (string-append out "/share/man/man1")))
  1160. (mkdir-p bin)
  1161. (mkdir-p man1)
  1162. #t))))))
  1163. (inputs
  1164. `(("libsodium" ,libsodium)
  1165. ("openssl" ,openssl)))
  1166. (synopsis "High-performance command-line tool for stream encryption")
  1167. (description "Hpenc is a command-line tool for performing authenticated
  1168. encryption (AES-GCM and ChaCha20-Poly1305) of streaming data. It does not
  1169. perform an asymmetric key exchange, instead requiring the user to distribute
  1170. pre-shared keys out of band. It is designed to handle large amounts of data
  1171. quickly by using all your CPU cores and hardware acceleration.")
  1172. (home-page "https://github.com/vstakhov/hpenc")
  1173. (license license:bsd-3)))
  1174. (define-public minisign
  1175. (package
  1176. (name "minisign")
  1177. (version "0.9")
  1178. (source
  1179. (origin
  1180. (method url-fetch)
  1181. (uri
  1182. (string-append "https://github.com/jedisct1/minisign/releases/download/"
  1183. version "/minisign-" version ".tar.gz"))
  1184. (sha256
  1185. (base32 "1h9cfvvm6lqq33b2wdar1x3w4k7zyrscavllyb0l5dmcdabq60r2"))))
  1186. (build-system cmake-build-system)
  1187. (arguments
  1188. ; No test suite
  1189. `(#:tests? #f))
  1190. (native-inputs
  1191. `(("pkg-config" ,pkg-config)))
  1192. (inputs
  1193. `(("libsodium" ,libsodium)))
  1194. (home-page "https://jedisct1.github.io/minisign")
  1195. (synopsis "Tool to sign files and verify signatures")
  1196. (description
  1197. "Minisign is a dead simple tool to sign files and verify signatures. It is
  1198. portable, lightweight, and uses the highly secure Ed25519 public-key signature
  1199. system. Signature written by minisign can be verified using OpenBSD's
  1200. signify tool: public key files and signature files are compatible. However,
  1201. minisign uses a slightly different format to store secret keys. Minisign
  1202. signatures include trusted comments in addition to untrusted comments.
  1203. Trusted comments are signed, thus verified, before being displayed.")
  1204. (license license:isc)))
  1205. (define-public libolm
  1206. (package
  1207. (name "libolm")
  1208. (version "3.2.3")
  1209. (source (origin
  1210. (method git-fetch)
  1211. (uri (git-reference
  1212. (url "https://git.matrix.org/git/olm")
  1213. (commit version)))
  1214. (sha256
  1215. (base32
  1216. "0bixly6jqpwfx3p37c1qp1j685yg6m429r1nazwh43w4n527bs3y"))
  1217. (file-name (git-file-name name version))
  1218. ;; Delete the bundled blob. It's free, but unauditable,
  1219. ;; and apparently only required for android.
  1220. (snippet '(delete-file
  1221. "android/gradle/wrapper/gradle-wrapper.jar"))))
  1222. (build-system cmake-build-system)
  1223. (arguments
  1224. `(#:phases
  1225. (modify-phases %standard-phases
  1226. (replace 'check
  1227. (lambda* (#:key tests? #:allow-other-keys)
  1228. (when tests?
  1229. (with-directory-excursion "tests"
  1230. (invoke "ctest" "."))))))))
  1231. (synopsis "Implementation of the olm and megolm cryptographic ratchets")
  1232. (description "The libolm library implements the Double Ratchet
  1233. cryptographic ratchet. It is written in C and C++11, and exposed as a C
  1234. API.")
  1235. (home-page "https://matrix.org/docs/projects/other/olm/")
  1236. (license license:asl2.0)))
  1237. (define-public hash-extender
  1238. (let ((commit "cb8aaee49f93e9c0d2f03eb3cafb429c9eed723d")
  1239. (revision "2"))
  1240. (package
  1241. (name "hash-extender")
  1242. (version (git-version "0.0" revision commit))
  1243. (source (origin
  1244. (method git-fetch)
  1245. (uri (git-reference
  1246. (url "https://github.com/iagox86/hash_extender")
  1247. (commit commit)))
  1248. (sha256
  1249. (base32
  1250. "1fj118566hr1wv03az2w0iqknazsqqkak0mvlcvwpgr6midjqi9b"))
  1251. (file-name (git-file-name name version))))
  1252. (build-system gnu-build-system)
  1253. (arguments
  1254. `(#:phases
  1255. (modify-phases %standard-phases
  1256. (delete 'configure)
  1257. (replace 'check
  1258. (lambda _
  1259. (invoke "./hash_extender_test")))
  1260. (replace 'install
  1261. (lambda* (#:key outputs #:allow-other-keys)
  1262. (let* ((outdir (assoc-ref outputs "out"))
  1263. (bindir (string-append outdir "/bin"))
  1264. (docdir (string-append outdir
  1265. "/share/doc/hash-extender-"
  1266. ,version)))
  1267. (install-file "hash_extender" bindir)
  1268. (install-file "README.md" docdir)
  1269. #t))))))
  1270. (inputs
  1271. `(("openssl" ,openssl)))
  1272. (synopsis "Tool for hash length extension attacks")
  1273. (description "@command{hash_extender} is a utility for performing hash
  1274. length extension attacks supporting MD4, MD5, RIPEMD-160, SHA-0, SHA-1,
  1275. SHA-256, SHA-512, and WHIRLPOOL hashes.")
  1276. (home-page "https://github.com/iagox86/hash_extender")
  1277. (license license:bsd-3))))
  1278. (define-public mkp224o
  1279. (package
  1280. (name "mkp224o")
  1281. (version "1.5.0")
  1282. (source (origin
  1283. (method git-fetch)
  1284. (uri (git-reference
  1285. (url "https://github.com/cathugger/mkp224o")
  1286. (commit (string-append "v" version))))
  1287. (sha256
  1288. (base32
  1289. "0b2cn96wg4l8jkkqqp8l2295xlmm2jc8nrw6rdqb5g0zkpfmrxbb"))
  1290. (file-name (git-file-name name version))))
  1291. (build-system gnu-build-system)
  1292. (arguments
  1293. `(#:tests? #f ; no test suite
  1294. #:phases
  1295. (modify-phases %standard-phases
  1296. (replace 'install
  1297. (lambda* (#:key outputs #:allow-other-keys)
  1298. (let* ((outdir (assoc-ref outputs "out"))
  1299. (bindir (string-append outdir "/bin")))
  1300. (install-file "mkp224o" bindir)
  1301. #t))))))
  1302. (native-inputs
  1303. `(("autoconf" ,autoconf)))
  1304. (inputs
  1305. `(("libsodium" ,libsodium)))
  1306. (synopsis "Tor hidden service v3 name generator")
  1307. (description "@code{mkp224o} generates valid ed25519 (hidden service
  1308. version 3) onion addresses. It allows one to produce customized vanity .onion
  1309. addresses using a brute-force method.")
  1310. (home-page "https://github.com/cathugger/mkp224o")
  1311. (license license:cc0)))
  1312. (define-public transcrypt
  1313. (package
  1314. (name "transcrypt")
  1315. (version "2.1.0")
  1316. (source
  1317. (origin
  1318. (method git-fetch)
  1319. (uri (git-reference
  1320. (url "https://github.com/elasticdog/transcrypt")
  1321. (commit (string-append "v" version))))
  1322. (sha256
  1323. (base32 "0bpz1hazbhfb6pqi68x55kq6a31bgh6vwij836slmi4jqiwvnh5a"))
  1324. (file-name (git-file-name name version))))
  1325. (inputs
  1326. `(("git" ,git)
  1327. ("openssl" ,openssl)))
  1328. (build-system copy-build-system)
  1329. (arguments
  1330. `(#:install-plan
  1331. '(("transcrypt" "bin/transcrypt")
  1332. ("man/transcrypt.1" "share/man/man1/transcrypt.1")
  1333. ("contrib/bash/transcrypt"
  1334. "share/bash-completion/completions/transcrypt")
  1335. ("contrib/zsh/_transcrypt"
  1336. "share/zsh/site-functions/_transcrypt"))))
  1337. (home-page "https://github.com/elasticdog/transcrypt")
  1338. (synopsis "Transparently encrypt files within a git repository")
  1339. (description
  1340. "Transcrypt is a script to configure transparent encryption of sensitive
  1341. files stored in a Git repository. Files that you choose will be automatically
  1342. encrypted when you commit them, and automatically decrypted when you check
  1343. them out. The process will degrade gracefully, so even people without your
  1344. encryption password can safely commit changes to the repository's
  1345. non-encrypted files.")
  1346. (license license:expat)))
  1347. (define-public cryfs
  1348. (package
  1349. (name "cryfs")
  1350. (version "0.11.0")
  1351. (source
  1352. (origin
  1353. (method url-fetch)
  1354. (uri (string-append
  1355. "https://github.com/cryfs/cryfs/releases/download/"
  1356. version "/cryfs-" version ".tar.xz"))
  1357. (sha256
  1358. (base32 "0dxphbj5sssm82rkkdb71algrcki16qlpzlvrjyvvm6b7x7zi0sm"))))
  1359. (build-system cmake-build-system)
  1360. (arguments
  1361. '(#:modules ((guix build cmake-build-system)
  1362. (guix build utils)
  1363. (srfi srfi-1))
  1364. #:configure-flags
  1365. ;; Note: This also disables checking for security issues.
  1366. `("-DCRYFS_UPDATE_CHECKS=OFF"
  1367. ;; This helps us use some dependencies from Guix instead of conan.
  1368. ;; crypto++ is still bundled: https://github.com/cryfs/cryfs/issues/369
  1369. ;; Googletest is also since I wasn't sure how to unbundle that.
  1370. ,(string-append "-DDEPENDENCY_CONFIG=" (getcwd)
  1371. "/cmake-utils/DependenciesFromLocalSystem.cmake"))
  1372. #:phases
  1373. (modify-phases %standard-phases
  1374. (add-before 'configure 'fix-configure
  1375. (lambda* (#:key tests? #:allow-other-keys)
  1376. ;; Remove junk directory that breaks the build
  1377. (chdir "..") (delete-file-recursively ".circleci")
  1378. ;; Install documentation with Guix defaults.
  1379. (substitute* "doc/CMakeLists.txt"
  1380. (("CONFIGURATIONS Release")
  1381. "CONFIGURATIONS Release RelWithDebInfo"))
  1382. (when tests?
  1383. (substitute* "CMakeLists.txt"
  1384. (("option.BUILD_TESTING .build test cases. OFF.")
  1385. "option(BUILD_TESTING \"build test cases\" ON)")))))
  1386. (replace 'check
  1387. (lambda* (#:key tests? #:allow-other-keys)
  1388. (when tests?
  1389. (let ((tests (find-files "." "-test$")))
  1390. ;; XXX: Disable failing tests. Unfortunately there are a
  1391. ;; few. Some only fail in the build environment due to
  1392. ;; FUSE not being available.
  1393. (for-each invoke
  1394. (lset-difference string-contains
  1395. tests
  1396. '("cpp-utils-test"
  1397. "cryfs-cli-test"
  1398. "blobstore-test"
  1399. "fspp-test")))))
  1400. #t)))))
  1401. (native-inputs
  1402. `(("python" ,python-wrapper)
  1403. ("pkg-config" ,pkg-config)))
  1404. (inputs
  1405. `(("boost" ,boost)
  1406. ("curl" ,curl)
  1407. ("fuse" ,fuse)
  1408. ("range-v3" ,range-v3)
  1409. ("spdlog" ,spdlog)))
  1410. (home-page "https://www.cryfs.org/")
  1411. (synopsis "Encrypted FUSE filesystem for the cloud")
  1412. (description "CryFS encrypts your files, so you can safely store them anywhere.
  1413. It works well together with cloud services like Dropbox, iCloud, OneDrive and
  1414. others. CryFS creates an encrypted userspace filesystem that can be mounted
  1415. via FUSE without root permissions. It is similar to EncFS, but provides
  1416. additional security and privacy measures such as hiding file sizes and directory
  1417. structure. However CryFS is not considered stable yet by the developers.")
  1418. (license license:lgpl3+)))