tls.scm 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014, 2015, 2016, 2017, 2018, 2021 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
  5. ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr>
  6. ;;; Copyright © 2015 David Thompson <davet@gnu.org>
  7. ;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020, 2021 Leo Famulari <leo@famulari.name>
  8. ;;; Copyright © 2016, 2017, 2019, 2021 Efraim Flashner <efraim@flashner.co.il>
  9. ;;; Copyright © 2016, 2017, 2018 Nikita <nikita@n0.is>
  10. ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
  11. ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
  12. ;;; Copyright © 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
  13. ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  14. ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
  15. ;;; Copyright © 2018 Clément Lassieur <clement@lassieur.org>
  16. ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  17. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  18. ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  19. ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
  20. ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
  21. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  22. ;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
  23. ;;;
  24. ;;; This file is part of GNU Guix.
  25. ;;;
  26. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  27. ;;; under the terms of the GNU General Public License as published by
  28. ;;; the Free Software Foundation; either version 3 of the License, or (at
  29. ;;; your option) any later version.
  30. ;;;
  31. ;;; GNU Guix is distributed in the hope that it will be useful, but
  32. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  33. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. ;;; GNU General Public License for more details.
  35. ;;;
  36. ;;; You should have received a copy of the GNU General Public License
  37. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  38. (define-module (gnu packages tls)
  39. #:use-module ((guix licenses) #:prefix license:)
  40. #:use-module (guix packages)
  41. #:use-module (guix download)
  42. #:use-module (guix git-download)
  43. #:use-module (guix utils)
  44. #:use-module (guix gexp)
  45. #:use-module (guix build-system gnu)
  46. #:use-module (guix build-system go)
  47. #:use-module (guix build-system perl)
  48. #:use-module (guix build-system python)
  49. #:use-module (guix build-system cmake)
  50. #:use-module (guix build-system trivial)
  51. #:use-module (gnu packages compression)
  52. #:use-module (gnu packages)
  53. #:use-module (gnu packages autotools)
  54. #:use-module (gnu packages bash)
  55. #:use-module (gnu packages check)
  56. #:use-module (gnu packages curl)
  57. #:use-module (gnu packages dns)
  58. #:use-module (gnu packages gawk)
  59. #:use-module (gnu packages gettext)
  60. #:use-module (gnu packages guile)
  61. #:use-module (gnu packages hurd)
  62. #:use-module (gnu packages libbsd)
  63. #:use-module (gnu packages libffi)
  64. #:use-module (gnu packages libidn)
  65. #:use-module (gnu packages linux)
  66. #:use-module (gnu packages ncurses)
  67. #:use-module (gnu packages nettle)
  68. #:use-module (gnu packages networking)
  69. #:use-module (gnu packages perl)
  70. #:use-module (gnu packages pkg-config)
  71. #:use-module (gnu packages python)
  72. #:use-module (gnu packages python-crypto)
  73. #:use-module (gnu packages python-web)
  74. #:use-module (gnu packages python-xyz)
  75. #:use-module (gnu packages sphinx)
  76. #:use-module (gnu packages texinfo)
  77. #:use-module (gnu packages time)
  78. #:use-module (gnu packages base)
  79. #:use-module (srfi srfi-1))
  80. (define-public libtasn1
  81. (package
  82. (name "libtasn1")
  83. (version "4.17.0")
  84. (source
  85. (origin
  86. (method url-fetch)
  87. (uri (string-append "mirror://gnu/libtasn1/libtasn1-"
  88. version ".tar.gz"))
  89. (sha256
  90. (base32
  91. "19a53i1ajs4dd8nnlr2i6gbzvla84ay71g3y1phvh8krx8f5brzc"))))
  92. (build-system gnu-build-system)
  93. (arguments
  94. `(#:configure-flags '("--disable-static")))
  95. (native-inputs `(("perl" ,perl)))
  96. (home-page "https://www.gnu.org/software/libtasn1/")
  97. (synopsis "ASN.1 library")
  98. (description
  99. "GNU libtasn1 is a library implementing the ASN.1 notation. It is used
  100. for transmitting machine-neutral encodings of data objects in computer
  101. networking, allowing for formal validation of data according to some
  102. specifications.")
  103. (license license:lgpl2.0+)))
  104. (define-public asn1c
  105. (package
  106. (name "asn1c")
  107. (version "0.9.28")
  108. (source (origin
  109. (method url-fetch)
  110. (uri (string-append "https://lionet.info/soft/asn1c-"
  111. version ".tar.gz"))
  112. (sha256
  113. (base32
  114. "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0"))))
  115. (build-system gnu-build-system)
  116. (native-inputs
  117. `(("perl" ,perl)))
  118. (home-page "https://lionet.info/asn1c")
  119. (synopsis "ASN.1 to C compiler")
  120. (description "The ASN.1 to C compiler takes ASN.1 module
  121. files and generates C++ compatible C source code. That code can be
  122. used to serialize the native C structures into compact and unambiguous
  123. BER/XER/PER-based data files, and deserialize the files back.
  124. Various ASN.1 based formats are widely used in the industry, such as to encode
  125. the X.509 certificates employed in the HTTPS handshake, to exchange control
  126. data between mobile phones and cellular networks, to car-to-car communication
  127. in intelligent transportation networks.")
  128. (license license:bsd-2)))
  129. (define-public p11-kit
  130. (package
  131. (name "p11-kit")
  132. (version "0.23.22")
  133. (source
  134. (origin
  135. (method url-fetch)
  136. (uri (string-append "https://github.com/p11-glue/p11-kit/releases/"
  137. "download/" version "/p11-kit-" version ".tar.xz"))
  138. (sha256
  139. (base32 "1dn6br4v033d3gp2max9lsr3y4q0nj6iyr1yq3kzi8ym7lal13wa"))))
  140. (build-system gnu-build-system)
  141. (native-inputs
  142. `(,@(if (hurd-target?)
  143. `(("autoconf" ,autoconf)
  144. ("automake" ,automake)
  145. ("gettext" ,gettext-minimal) ;for autopoint
  146. ("libtool" ,libtool))
  147. '())
  148. ("pkg-config" ,pkg-config)))
  149. (inputs
  150. `(("libffi" ,libffi)
  151. ,@(if (hurd-target?)
  152. `(("libbsd" ,libbsd)
  153. ("hurd-patch" ,(search-patch "p11-kit-hurd.patch")))
  154. '())
  155. ("libtasn1" ,libtasn1)))
  156. (arguments
  157. `(#:configure-flags '("--without-trust-paths")
  158. #:phases (modify-phases %standard-phases
  159. ,@(if (hurd-target?)
  160. '((add-after 'unpack 'apply-hurd-patch
  161. (lambda* (#:key inputs #:allow-other-keys)
  162. (let ((patch (assoc-ref inputs "hurd-patch")))
  163. (invoke "patch" "-p1" "--batch" "-i"
  164. patch))))
  165. (replace 'bootstrap
  166. (lambda _
  167. (invoke "autoreconf" "-fiv"))))
  168. '())
  169. (add-before 'check 'prepare-tests
  170. (lambda _
  171. ;; "test-runtime" expects XDG_RUNTIME_DIR to be set up
  172. ;; and looks for .cache and other directories (only).
  173. ;; For simplicity just drop it since it is irrelevant
  174. ;; in the build container.
  175. (substitute* "Makefile"
  176. (("test-runtime\\$\\(EXEEXT\\)") ""))
  177. #t)))))
  178. (home-page "https://p11-glue.freedesktop.org/p11-kit.html")
  179. (synopsis "PKCS#11 library")
  180. (description
  181. "p11-kit provides a way to load and enumerate PKCS#11 modules. It
  182. provides a standard configuration setup for installing PKCS#11 modules
  183. in such a way that they are discoverable. It also solves problems with
  184. coordinating the use of PKCS#11 by different components or libraries
  185. living in the same process.")
  186. (license license:bsd-3)))
  187. (define-public gnutls
  188. (package
  189. (name "gnutls")
  190. (version "3.7.2")
  191. (source (origin
  192. (method url-fetch)
  193. ;; Note: Releases are no longer on ftp.gnu.org since the
  194. ;; schism (after version 3.1.5).
  195. (uri (string-append "mirror://gnupg/gnutls/v"
  196. (version-major+minor version)
  197. "/gnutls-" version ".tar.xz"))
  198. (patches (search-patches "gnutls-skip-trust-store-test.patch"
  199. "gnutls-cross.patch"
  200. "gnutls-guile-eintr-eagain.patch"))
  201. (sha256
  202. (base32
  203. "0li7mwjnm64mbxhacz0rpf6i9qd83f53fvbrx96alpqqk9d6qvk4"))))
  204. (build-system gnu-build-system)
  205. (arguments
  206. `(#:tests? ,(not (or (%current-target-system)
  207. (hurd-target?)))
  208. ;; Ensure we don't keep a reference to the tools used for testing.
  209. #:disallowed-references ,(if (hurd-target?)
  210. '()
  211. (list net-tools iproute socat))
  212. #:configure-flags
  213. (cons*
  214. ;; GnuTLS doesn't consult any environment variables to specify
  215. ;; the location of the system-wide trust store. Instead it has a
  216. ;; configure-time option. Unless specified, its configure script
  217. ;; attempts to auto-detect the location by looking for common
  218. ;; places in the file system, none of which are present in our
  219. ;; chroot build environment. If not found, then no default trust
  220. ;; store is used, so each program has to provide its own
  221. ;; fallback, and users have to configure each program
  222. ;; independently. This seems suboptimal.
  223. "--with-default-trust-store-dir=/etc/ssl/certs"
  224. ;; Tell the build system that we want Guile bindings installed to
  225. ;; the output instead of Guiles own module directory.
  226. (string-append "--with-guile-site-dir="
  227. "$(datarootdir)/guile/site/$(GUILE_EFFECTIVE_VERSION)")
  228. (string-append "--with-guile-site-ccache-dir="
  229. "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/site-ccache")
  230. (string-append "--with-guile-extension-dir="
  231. "$(libdir)/guile/$(GUILE_EFFECTIVE_VERSION)/extensions")
  232. (let ((system ,(or (%current-target-system)
  233. (%current-system))))
  234. (if (string-prefix? "mips64el" system)
  235. (list
  236. ;; FIXME: Temporarily disable p11-kit support since it is
  237. ;; not working on mips64el.
  238. "--without-p11-kit")
  239. '())))
  240. #:phases (modify-phases %standard-phases
  241. ;; fastopen.sh fails to connect to the server in the builder
  242. ;; environment (see:
  243. ;; https://gitlab.com/gnutls/gnutls/-/issues/1095).
  244. (add-after 'unpack 'disable-failing-tests
  245. (lambda _
  246. (substitute* "tests/fastopen.sh"
  247. (("^unset RETCODE")
  248. "exit 77\n")))) ;skip
  249. (add-after 'install 'move-doc
  250. (lambda* (#:key outputs #:allow-other-keys)
  251. ;; Copy the 4.1 MiB of section 3 man pages to "doc".
  252. (let* ((out (assoc-ref outputs "out"))
  253. (doc (assoc-ref outputs "doc"))
  254. (mandir (string-append doc "/share/man/man3"))
  255. (oldman (string-append out "/share/man/man3")))
  256. (mkdir-p mandir)
  257. (copy-recursively oldman mandir)
  258. (delete-file-recursively oldman)))))))
  259. (outputs '("out" ;4.4 MiB
  260. "debug"
  261. "doc")) ;4.1 MiB of man pages
  262. (native-inputs
  263. `(,@(if (%current-target-system) ;for cross-build
  264. `(("guile" ,guile-3.0)) ;to create .go files
  265. '())
  266. ,@(if (hurd-target?)
  267. '()
  268. `(("net-tools" ,net-tools)
  269. ("iproute" ,iproute) ;for 'ss'
  270. ("socat" ,socat))) ;several tests rely on it
  271. ("pkg-config" ,pkg-config)
  272. ("texinfo" ,texinfo)
  273. ("which" ,which)
  274. ,@(if (hurd-target?)
  275. '()
  276. `(("datefudge" ,datefudge))) ;tests rely on 'datefudge'
  277. ("util-linux" ,util-linux))) ;one test needs 'setsid'
  278. (inputs
  279. `(("guile" ,guile-3.0)))
  280. (propagated-inputs
  281. ;; These are all in the 'Requires.private' field of gnutls.pc.
  282. `(("libtasn1" ,libtasn1)
  283. ("libidn2" ,libidn2)
  284. ("nettle" ,nettle)
  285. ("zlib" ,zlib)
  286. ,@(let ((system (or (%current-target-system)
  287. (%current-system))))
  288. (if (string-prefix? "mips64el" system)
  289. '()
  290. `(("p11-kit" ,p11-kit))))))
  291. (home-page "https://www.gnu.org/software/gnutls/")
  292. (synopsis "Transport layer security library")
  293. (description
  294. "GnuTLS is a secure communications library implementing the SSL, TLS
  295. and DTLS protocols. It is provided in the form of a C library to support the
  296. protocols, as well as to parse and write X.509, PKCS #12, OpenPGP and other
  297. required structures.")
  298. (license license:lgpl2.1+)
  299. (properties '((ftp-server . "ftp.gnutls.org")
  300. (ftp-directory . "/gcrypt/gnutls")))))
  301. (define-public gnutls/guile-2.0
  302. ;; GnuTLS for Guile 2.0.
  303. (package/inherit gnutls
  304. (name "guile2.0-gnutls")
  305. (inputs `(("guile" ,guile-2.0)
  306. ,@(alist-delete "guile" (package-inputs gnutls))))))
  307. (define-public gnutls/dane
  308. ;; GnuTLS with build libgnutls-dane, implementing DNS-based
  309. ;; Authentication of Named Entities. This is required for GNS functionality
  310. ;; by GNUnet and gnURL. This is done in an extra package definition
  311. ;; to have the choice between GnuTLS with Dane and without Dane.
  312. (package/inherit gnutls
  313. (name "gnutls-dane")
  314. (inputs `(("unbound" ,unbound)
  315. ,@(package-inputs gnutls)))))
  316. (define-public guile2.2-gnutls
  317. (package/inherit gnutls
  318. (name "guile2.2-gnutls")
  319. (inputs `(("guile" ,guile-2.2)
  320. ,@(alist-delete "guile"
  321. (package-inputs gnutls))))))
  322. (define-public guile3.0-gnutls
  323. (deprecated-package "guile3.0-gnutls" gnutls))
  324. (define (target->openssl-target target)
  325. "Return the value to set CONFIGURE_TARGET_ARCH to when cross-compiling
  326. OpenSSL for TARGET."
  327. ;; Keep this code outside the build code,
  328. ;; such that new targets can be added
  329. ;; without causing rebuilds for other targets.
  330. (cond ((string-prefix? "i586" target)
  331. "hurd-x86")
  332. ((string-prefix? "i686" target)
  333. "linux-x86")
  334. ((string-prefix? "x86_64" target)
  335. "linux-x86_64")
  336. ((string-prefix? "mips64el" target)
  337. "linux-mips64")
  338. ((string-prefix? "arm" target)
  339. "linux-armv4")
  340. ((string-prefix? "aarch64" target)
  341. "linux-aarch64")
  342. ((string-prefix? "powerpc64le" target)
  343. "linux-ppc64le")
  344. ((string-prefix? "powerpc64" target)
  345. "linux-ppc64")
  346. ((string-prefix? "powerpc" target)
  347. "linux-ppc")
  348. ((string-prefix? "riscv64" target)
  349. ;; linux64-riscv64 isn't recognized until 3.0.0.
  350. "linux-generic64")))
  351. (define-public openssl
  352. (package
  353. (name "openssl")
  354. (version "1.1.1k")
  355. (replacement openssl-1.1.1l)
  356. (source (origin
  357. (method url-fetch)
  358. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  359. version ".tar.gz")
  360. (string-append "ftp://ftp.openssl.org/source/"
  361. "openssl-" version ".tar.gz")
  362. (string-append "ftp://ftp.openssl.org/source/old/"
  363. (string-trim-right version char-set:letter)
  364. "/openssl-" version ".tar.gz")))
  365. (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
  366. (sha256
  367. (base32
  368. "1rdfzcrxy9y38wqdw5942vmdax9hjhgrprzxm42csal7p5shhal9"))))
  369. (build-system gnu-build-system)
  370. (outputs '("out"
  371. "doc" ;6.8 MiB of man3 pages and full HTML documentation
  372. "static")) ;6.4 MiB of .a files
  373. (native-inputs `(("perl" ,perl)))
  374. (arguments
  375. `(#:parallel-tests? #f
  376. #:test-target "test"
  377. ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure,
  378. ;; so we explicitly disallow it here.
  379. #:disallowed-references ,(list (canonical-package perl))
  380. #:phases
  381. ,#~
  382. (modify-phases %standard-phases
  383. #$@(if (%current-target-system)
  384. #~((add-before
  385. 'configure 'set-cross-compile
  386. (lambda* (#:key target #:allow-other-keys)
  387. (setenv "CROSS_COMPILE" (string-append target "-"))
  388. (setenv "CONFIGURE_TARGET_ARCH"
  389. #$(target->openssl-target
  390. (%current-target-system))))))
  391. #~())
  392. ;; This test seems to be dependant on kernel features.
  393. ;; https://github.com/openssl/openssl/issues/12242
  394. #$@(if (or (target-arm?)
  395. (target-riscv64?))
  396. #~((replace 'check
  397. (lambda* (#:key tests? test-target #:allow-other-keys)
  398. (when tests?
  399. (invoke "make" "TESTS=-test_afalg" test-target)))))
  400. #~())
  401. (replace 'configure
  402. (lambda* (#:key configure-flags #:allow-other-keys)
  403. (let* ((out #$output)
  404. (lib (string-append out "/lib")))
  405. ;; It's not a shebang so patch-source-shebangs misses it.
  406. (substitute* "config"
  407. (("/usr/bin/env")
  408. (string-append (assoc-ref %build-inputs "coreutils")
  409. "/bin/env")))
  410. (apply
  411. invoke #$@(if (%current-target-system)
  412. #~("./Configure")
  413. #~("./config"))
  414. "shared" ;build shared libraries
  415. "--libdir=lib"
  416. ;; The default for this catch-all directory is
  417. ;; PREFIX/ssl. Change that to something more
  418. ;; conventional.
  419. (string-append "--openssldir=" out
  420. "/share/openssl-"
  421. #$(package-version this-package))
  422. (string-append "--prefix=" out)
  423. (string-append "-Wl,-rpath," lib)
  424. #$@(if (%current-target-system)
  425. #~((getenv "CONFIGURE_TARGET_ARCH"))
  426. #~())
  427. configure-flags)
  428. ;; Output the configure variables.
  429. (invoke "perl" "configdata.pm" "--dump"))))
  430. (add-after 'install 'move-static-libraries
  431. (lambda _
  432. ;; Move static libraries to the "static" output.
  433. (let* ((out #$output)
  434. (lib (string-append out "/lib"))
  435. (static #$output:static)
  436. (slib (string-append static "/lib")))
  437. (for-each (lambda (file)
  438. (install-file file slib)
  439. (delete-file file))
  440. (find-files lib "\\.a$")))))
  441. (add-after 'install 'move-extra-documentation
  442. (lambda _
  443. ;; Move man pages and full HTML documentation to "doc".
  444. (let* ((out #$output)
  445. (man (string-append out "/share/man"))
  446. (html (string-append out "/share/doc/openssl"))
  447. (doc #$output:doc)
  448. (man-target (string-append doc "/share/man"))
  449. (html-target (string-append doc "/share/doc/openssl")))
  450. (mkdir-p (dirname man-target))
  451. (mkdir-p (dirname html-target))
  452. (rename-file man man-target)
  453. (rename-file html html-target))))
  454. (add-after
  455. 'install 'remove-miscellany
  456. (lambda _
  457. ;; The 'misc' directory contains random undocumented shell and Perl
  458. ;; scripts. Remove them to avoid retaining a reference on Perl.
  459. (delete-file-recursively (string-append #$output "/share/openssl-"
  460. #$(package-version this-package)
  461. "/misc")))))))
  462. (native-search-paths
  463. (list (search-path-specification
  464. (variable "SSL_CERT_DIR")
  465. (separator #f) ;single entry
  466. (files '("etc/ssl/certs")))
  467. (search-path-specification
  468. (variable "SSL_CERT_FILE")
  469. (file-type 'regular)
  470. (separator #f) ;single entry
  471. (files '("etc/ssl/certs/ca-certificates.crt")))))
  472. (synopsis "SSL/TLS implementation")
  473. (description
  474. "OpenSSL is an implementation of SSL/TLS.")
  475. (license license:openssl)
  476. (home-page "https://www.openssl.org/")))
  477. ;; Replacement package to fix multiple CVEs.
  478. (define openssl-1.1.1l
  479. (package
  480. (inherit openssl)
  481. (version "1.1.1l")
  482. (source (origin
  483. (method url-fetch)
  484. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  485. version ".tar.gz")
  486. (string-append "ftp://ftp.openssl.org/source/"
  487. "openssl-" version ".tar.gz")
  488. (string-append "ftp://ftp.openssl.org/source/old/"
  489. (string-trim-right version char-set:letter)
  490. "/openssl-" version ".tar.gz")))
  491. (patches (search-patches "openssl-1.1-c-rehash-in.patch"))
  492. (sha256
  493. (base32
  494. "1lbblxps2fhmz7bqh058iywh5wxfignbfx1s1kz2fj63b5g3wyhb"))))))
  495. ;; We will not add any new uses of this package. If you add new code that uses
  496. ;; this package, your change will be reverted!
  497. ;;
  498. ;; The only acceptable use for this package is to bootstrap Rust, in
  499. ;; ((gnu packages rust) rust-1.19).
  500. ;;
  501. ;; OpenSSL 1.0 is no longer suppported upstream [0] and has several security
  502. ;; vulnerabilities that will not be fixed [1].
  503. ;;
  504. ;; For more information from the Guix point of view, see
  505. ;; <https://bugs.gnu.org/46602>.
  506. ;;
  507. ;; [0] https://www.openssl.org/policies/releasestrat.html
  508. ;; [1] https://www.openssl.org/news/vulnerabilities.html
  509. (define-public openssl-1.0
  510. (hidden-package
  511. (package
  512. (inherit openssl)
  513. (name "openssl")
  514. (version "1.0.2u")
  515. (source (origin
  516. (method url-fetch)
  517. (uri (list (string-append "https://www.openssl.org/source/openssl-"
  518. version ".tar.gz")
  519. (string-append "ftp://ftp.openssl.org/source/"
  520. "openssl-" version ".tar.gz")
  521. (string-append "ftp://ftp.openssl.org/source/old/"
  522. (string-trim-right version char-set:letter)
  523. "/openssl-" version ".tar.gz")))
  524. (sha256
  525. (base32
  526. "05lxcs4hzyfqd5jn0d9p0fvqna62v2s4pc9qgmq0dpcknkzwdl7c"))
  527. (patches (search-patches "openssl-runpath.patch"
  528. "openssl-c-rehash-in.patch"))))
  529. (outputs '("out"
  530. "doc" ;1.5MiB of man3 pages
  531. "static")) ;6MiB of .a files
  532. (arguments
  533. (substitute-keyword-arguments (package-arguments openssl)
  534. ;; Parallel build is not supported in 1.0.x.
  535. ((#:parallel-build? _ #f) #f)
  536. ((#:phases phases)
  537. #~(modify-phases #$phases
  538. (add-before 'patch-source-shebangs 'patch-tests
  539. (lambda* (#:key inputs native-inputs #:allow-other-keys)
  540. (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
  541. (substitute* (find-files "test" ".*")
  542. (("/bin/sh")
  543. (string-append bash "/bin/sh"))
  544. (("/bin/rm")
  545. "rm"))
  546. #t)))
  547. (add-before 'configure 'patch-Makefile.org
  548. (lambda* (#:key outputs #:allow-other-keys)
  549. ;; The default MANDIR is some unusual place. Fix that.
  550. (let ((out (assoc-ref outputs "out")))
  551. (patch-makefile-SHELL "Makefile.org")
  552. (substitute* "Makefile.org"
  553. (("^MANDIR[[:blank:]]*=.*$")
  554. (string-append "MANDIR = " out "/share/man\n")))
  555. #t)))
  556. (replace 'configure
  557. ;; Override this phase because OpenSSL 1.0 does not understand -rpath.
  558. (lambda* (#:key outputs #:allow-other-keys)
  559. (let ((out (assoc-ref outputs "out")))
  560. (invoke #$@(if (%current-target-system)
  561. #~("./Configure")
  562. #~("./config"))
  563. "shared" ;build shared libraries
  564. "--libdir=lib"
  565. ;; The default for this catch-all directory is
  566. ;; PREFIX/ssl. Change that to something more
  567. ;; conventional.
  568. (string-append "--openssldir=" out
  569. "/share/openssl-" #$version)
  570. (string-append "--prefix=" out)
  571. #$@(if (%current-target-system)
  572. '((getenv "CONFIGURE_TARGET_ARCH"))
  573. '())))))
  574. (delete 'move-extra-documentation)
  575. (add-after 'install 'move-man3-pages
  576. (lambda* (#:key outputs #:allow-other-keys)
  577. ;; Move section 3 man pages to "doc".
  578. (let* ((out (assoc-ref outputs "out"))
  579. (man3 (string-append out "/share/man/man3"))
  580. (doc (assoc-ref outputs "doc"))
  581. (target (string-append doc "/share/man/man3")))
  582. (mkdir-p target)
  583. (for-each (lambda (file)
  584. (rename-file file
  585. (string-append target "/"
  586. (basename file))))
  587. (find-files man3))
  588. (delete-file-recursively man3)
  589. #t)))
  590. ;; XXX: Duplicate this phase to make sure 'version' evaluates
  591. ;; in the current scope and not the inherited one.
  592. (replace 'remove-miscellany
  593. (lambda* (#:key outputs #:allow-other-keys)
  594. ;; The 'misc' directory contains random undocumented shell and Perl
  595. ;; scripts. Remove them to avoid retaining a reference on Perl.
  596. (let ((out (assoc-ref outputs "out")))
  597. (delete-file-recursively (string-append out "/share/openssl-"
  598. #$version "/misc"))
  599. #t))))))))))
  600. (define-public libressl
  601. (package
  602. (name "libressl")
  603. (version "3.3.3")
  604. (source (origin
  605. (method url-fetch)
  606. (uri (string-append "mirror://openbsd/LibreSSL/"
  607. "libressl-" version ".tar.gz"))
  608. (sha256
  609. (base32
  610. "0rihprcgxsydsbcqgd1952k2cfn4jmp7rlyp1c6sglfc6rdmcwd4"))))
  611. (build-system gnu-build-system)
  612. (arguments
  613. `(#:configure-flags
  614. (list
  615. ;; Do as if 'getentropy' were missing: Linux kernels before 3.17 lack its
  616. ;; underlying 'getrandom' system call and ENOSYS isn't properly handled.
  617. ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>.
  618. "ac_cv_func_getentropy=no"
  619. ;; FIXME It's using it's own bundled certificate, instead it should
  620. ;; behave like OpenSSL by using environment variables.
  621. (string-append "--with-openssldir=" %output
  622. "/share/libressl-"
  623. ,(package-version this-package))
  624. ;; Provide a TLS-enabled netcat.
  625. "--enable-nc")))
  626. (home-page "https://www.libressl.org/")
  627. (synopsis "SSL/TLS implementation")
  628. (description "LibreSSL is a version of the TLS/crypto stack, forked from
  629. OpenSSL in 2014 with the goals of modernizing the codebase, improving security,
  630. and applying best practice development processes. This package also includes a
  631. netcat implementation that supports TLS.")
  632. ;; Files taken from OpenSSL keep their license, others are under various
  633. ;; non-copyleft licenses.
  634. (license (list license:openssl
  635. (license:non-copyleft
  636. "file://COPYING"
  637. "See COPYING in the distribution.")))))
  638. (define-public python-acme
  639. (package
  640. (name "python-acme")
  641. ;; Remember to update the hash of certbot when updating python-acme.
  642. (version "1.17.0")
  643. (source (origin
  644. (method url-fetch)
  645. (uri (pypi-uri "acme" version))
  646. (sha256
  647. (base32
  648. "03ij1wp7jwvppv70qbjkgdg7w824yh6j4gfb68jj20wicx08xx1a"))))
  649. (build-system python-build-system)
  650. (arguments
  651. `(#:phases
  652. (modify-phases %standard-phases
  653. (add-after 'build 'build-documentation
  654. (lambda _
  655. (invoke "make" "-C" "docs" "man" "info")))
  656. (add-after 'install 'install-documentation
  657. (lambda* (#:key outputs #:allow-other-keys)
  658. (let* ((out (assoc-ref outputs "out"))
  659. (man (string-append out "/share/man/man1"))
  660. (info (string-append out "/info")))
  661. (install-file "docs/_build/texinfo/acme-python.info" info)
  662. (install-file "docs/_build/man/acme-python.1" man)
  663. #t))))))
  664. (native-inputs
  665. `(("python-pytest" ,python-pytest)
  666. ;; For documentation
  667. ("python-sphinx" ,python-sphinx)
  668. ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
  669. ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
  670. ("texinfo" ,texinfo)))
  671. (propagated-inputs
  672. `(("python-josepy" ,python-josepy)
  673. ("python-requests" ,python-requests)
  674. ("python-requests-toolbelt" ,python-requests-toolbelt)
  675. ("python-pytz" ,python-pytz)
  676. ("python-pyrfc3339" ,python-pyrfc3339)
  677. ("python-pyasn1" ,python-pyasn1)
  678. ("python-cryptography" ,python-cryptography)
  679. ("python-pyopenssl" ,python-pyopenssl)))
  680. (home-page "https://github.com/certbot/certbot")
  681. (synopsis "ACME protocol implementation in Python")
  682. (description "ACME protocol implementation in Python")
  683. (license license:asl2.0)))
  684. (define-public certbot
  685. (package
  686. (name "certbot")
  687. ;; Certbot and python-acme are developed in the same repository, and their
  688. ;; versions should remain synchronized.
  689. (version (package-version python-acme))
  690. (source (origin
  691. (method url-fetch)
  692. (uri (pypi-uri "certbot" version))
  693. (sha256
  694. (base32
  695. "0wyipx6q78fmvngf1i6g50s01qpjqh07qlk1b5vyxwgl3080lhgg"))))
  696. (build-system python-build-system)
  697. (arguments
  698. `(,@(substitute-keyword-arguments (package-arguments python-acme)
  699. ((#:phases phases)
  700. `(modify-phases ,phases
  701. (replace 'install-documentation
  702. (lambda* (#:key outputs #:allow-other-keys)
  703. (let* ((out (assoc-ref outputs "out"))
  704. (man1 (string-append out "/share/man/man1"))
  705. (man7 (string-append out "/share/man/man7"))
  706. (info (string-append out "/info")))
  707. (install-file "docs/_build/texinfo/Certbot.info" info)
  708. (install-file "docs/_build/man/certbot.1" man1)
  709. (install-file "docs/_build/man/certbot.7" man7)
  710. #t))))))))
  711. (native-inputs
  712. `(("python-mock" ,python-mock)
  713. ("python-pytest" ,python-pytest)
  714. ;; For documentation
  715. ("python-sphinx" ,python-sphinx)
  716. ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
  717. ("python-sphinx-repoze-autointerface" ,python-sphinx-repoze-autointerface)
  718. ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput)
  719. ("texinfo" ,texinfo)))
  720. (propagated-inputs
  721. `(("python-acme" ,python-acme)
  722. ("python-cryptography" ,python-cryptography)
  723. ("python-zope-interface" ,python-zope-interface)
  724. ("python-pyrfc3339" ,python-pyrfc3339)
  725. ("python-pyopenssl" ,python-pyopenssl)
  726. ("python-configobj" ,python-configobj)
  727. ("python-configargparse" ,python-configargparse)
  728. ("python-distro" ,python-distro)
  729. ("python-zope-component" ,python-zope-component)
  730. ("python-parsedatetime" ,python-parsedatetime)
  731. ("python-psutil" ,python-psutil)
  732. ("python-requests" ,python-requests)
  733. ("python-pytz" ,python-pytz)))
  734. (synopsis "Let's Encrypt client by the Electronic Frontier Foundation")
  735. (description "Certbot automatically receives and installs X.509 certificates
  736. to enable Transport Layer Security (TLS) on servers. It interoperates with the
  737. Let’s Encrypt certificate authority (CA), which issues browser-trusted
  738. certificates for free.")
  739. (home-page "https://certbot.eff.org/")
  740. (license license:asl2.0)))
  741. (define-public letsencrypt
  742. (package (inherit certbot)
  743. (name "letsencrypt")
  744. (properties `((superseded . ,certbot)))))
  745. (define-public perl-net-ssleay
  746. (package
  747. (name "perl-net-ssleay")
  748. (version "1.88")
  749. (source (origin
  750. (method url-fetch)
  751. (uri (string-append "mirror://cpan/authors/id/C/CH/CHRISN/"
  752. "Net-SSLeay-" version ".tar.gz"))
  753. (sha256
  754. (base32
  755. "1pfgh4h3szcpvqlcimc60pjbk9zwls99x5863sva0wc47i4dl010"))))
  756. (build-system perl-build-system)
  757. (inputs `(("openssl" ,openssl)))
  758. (arguments
  759. `(#:phases
  760. (modify-phases %standard-phases
  761. (add-before
  762. 'configure 'set-ssl-prefix
  763. (lambda* (#:key inputs #:allow-other-keys)
  764. (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl"))
  765. #t)))))
  766. (synopsis "Perl extension for using OpenSSL")
  767. (description
  768. "This module offers some high level convenience functions for accessing
  769. web pages on SSL servers (for symmetry, the same API is offered for accessing
  770. http servers, too), an sslcat() function for writing your own clients, and
  771. finally access to the SSL api of the SSLeay/OpenSSL package so you can write
  772. servers or clients for more complicated applications.")
  773. (license license:perl-license)
  774. (home-page "https://metacpan.org/release/Net-SSLeay")))
  775. (define-public perl-crypt-openssl-rsa
  776. (package
  777. (name "perl-crypt-openssl-rsa")
  778. (version "0.31")
  779. (source
  780. (origin
  781. (method url-fetch)
  782. (uri (string-append
  783. "mirror://cpan/authors/id/T/TO/TODDR/Crypt-OpenSSL-RSA-"
  784. version
  785. ".tar.gz"))
  786. (sha256
  787. (base32
  788. "0djl5i6kibl7862b6ih29q8dhg5zpwzq77q9j8hp6xngshx40ws1"))))
  789. (build-system perl-build-system)
  790. (native-inputs
  791. `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
  792. (inputs
  793. `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum)
  794. ("perl-crypt-openssl-random" ,perl-crypt-openssl-random)
  795. ("openssl" ,openssl)))
  796. (arguments perl-crypt-arguments)
  797. (home-page
  798. "https://metacpan.org/release/Crypt-OpenSSL-RSA")
  799. (synopsis
  800. "RSA encoding and decoding, using the openSSL libraries")
  801. (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the
  802. OpenSSL libraries).")
  803. (license license:perl-license)))
  804. (define perl-crypt-arguments
  805. `(#:phases (modify-phases %standard-phases
  806. (add-before 'configure 'patch-Makefile.PL
  807. (lambda* (#:key inputs #:allow-other-keys)
  808. (substitute* "Makefile.PL"
  809. (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L"
  810. (assoc-ref inputs "openssl")
  811. "/lib -lcrypto'],")))
  812. #t)))))
  813. (define-public perl-crypt-openssl-bignum
  814. (package
  815. (name "perl-crypt-openssl-bignum")
  816. (version "0.09")
  817. (source
  818. (origin
  819. (method url-fetch)
  820. (uri (string-append
  821. "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-"
  822. version
  823. ".tar.gz"))
  824. (sha256
  825. (base32
  826. "1p22znbajq91lbk2k3yg12ig7hy5b4vy8igxwqkmbm4nhgxp4ki3"))))
  827. (build-system perl-build-system)
  828. (inputs `(("openssl" ,openssl)))
  829. (arguments perl-crypt-arguments)
  830. (home-page
  831. "https://metacpan.org/release/Crypt-OpenSSL-Bignum")
  832. (synopsis
  833. "OpenSSL's multiprecision integer arithmetic in Perl")
  834. (description "Crypt::OpenSSL::Bignum provides multiprecision integer
  835. arithmetic in Perl.")
  836. ;; At your option either gpl1+ or the Artistic License
  837. (license license:perl-license)))
  838. (define-public perl-crypt-openssl-guess
  839. (package
  840. (name "perl-crypt-openssl-guess")
  841. (version "0.11")
  842. (source
  843. (origin
  844. (method url-fetch)
  845. (uri (string-append
  846. "mirror://cpan/authors/id/A/AK/AKIYM/Crypt-OpenSSL-Guess-"
  847. version ".tar.gz"))
  848. (sha256
  849. (base32
  850. "0rvi9l4ljcbhwwvspq019nfq2h2v746dk355h2nwnlmqikiihsxa"))))
  851. (build-system perl-build-system)
  852. (home-page "https://metacpan.org/release/Crypt-OpenSSL-Guess")
  853. (synopsis "Guess the OpenSSL include path")
  854. (description
  855. "The Crypt::OpenSSL::Guess Perl module provides helpers to guess the
  856. correct OpenSSL include path. It is intended for use in your
  857. @file{Makefile.PL}.")
  858. (license license:perl-license)))
  859. (define-public perl-crypt-openssl-random
  860. (package
  861. (name "perl-crypt-openssl-random")
  862. (version "0.15")
  863. (source
  864. (origin
  865. (method url-fetch)
  866. (uri (string-append
  867. "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-"
  868. version
  869. ".tar.gz"))
  870. (sha256
  871. (base32 "1x6ffps8q7mnawmcfq740llzy7i10g3319vap0wiw4d33fm6z1zh"))))
  872. (build-system perl-build-system)
  873. (native-inputs
  874. `(("perl-crypt-openssl-guess" ,perl-crypt-openssl-guess)))
  875. (inputs
  876. `(("openssl" ,openssl)))
  877. (arguments perl-crypt-arguments)
  878. (home-page
  879. "https://metacpan.org/release/Crypt-OpenSSL-Random")
  880. (synopsis
  881. "OpenSSL/LibreSSL pseudo-random number generator access")
  882. (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random
  883. number generator")
  884. (license license:perl-license)))
  885. (define-public acme-client
  886. (package
  887. (name "acme-client")
  888. (version "0.1.16")
  889. (source (origin
  890. (method url-fetch)
  891. (uri (string-append "https://kristaps.bsd.lv/" name "/"
  892. "snapshots/" name "-portable-"
  893. version ".tgz"))
  894. (sha256
  895. (base32
  896. "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9"))))
  897. (build-system gnu-build-system)
  898. (arguments
  899. '(#:tests? #f ; no test suite
  900. #:make-flags
  901. (list "CC=gcc"
  902. (string-append "PREFIX=" (assoc-ref %outputs "out")))
  903. #:phases
  904. (modify-phases %standard-phases
  905. (add-after 'unpack 'patch-paths
  906. (lambda* (#:key inputs #:allow-other-keys)
  907. (let ((pem (search-input-file inputs "/etc/ssl/cert.pem")))
  908. (substitute* "http.c"
  909. (("/etc/ssl/cert.pem") pem))
  910. #t)))
  911. (delete 'configure)))) ; no './configure' script
  912. (native-inputs
  913. `(("pkg-config" ,pkg-config)))
  914. (inputs
  915. `(("libbsd" ,libbsd)
  916. ("libressl" ,libressl)))
  917. (synopsis "Let's Encrypt client by the OpenBSD project")
  918. (description "acme-client is a Let's Encrypt client implemented in C. It
  919. uses a modular design, and attempts to secure itself by dropping privileges and
  920. operating in a chroot where possible. acme-client is developed on OpenBSD and
  921. then ported to the GNU / Linux environment.")
  922. (home-page "https://kristaps.bsd.lv/acme-client/")
  923. ;; acme-client is distributed under the ISC license, but the files 'jsmn.h'
  924. ;; and 'jsmn.c' are distributed under the Expat license.
  925. (license (list license:isc license:expat))))
  926. ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl"
  927. ;; variant exists in addition to the "-apache" one.
  928. (define-public mbedtls-apache
  929. (package
  930. (name "mbedtls-apache")
  931. ;; XXX Check whether ‘-Wformat-signedness’ still breaks mbedtls-for-hiawatha
  932. ;; when updating.
  933. (version "2.26.0")
  934. (source
  935. (origin
  936. (method git-fetch)
  937. (uri (git-reference
  938. (url "https://github.com/ARMmbed/mbedtls")
  939. (commit (string-append "mbedtls-" version))))
  940. (sha256
  941. (base32 "0scwpmrgvg6q7rvqkc352d2fqlsx0aylcbyibcp1f1rsn8iiif2m"))
  942. (file-name (git-file-name name version))
  943. (modules '((guix build utils)))
  944. (snippet
  945. '(begin
  946. ;; Can be removed with the next version.
  947. ;; Reduce level of format truncation warnings due to false positives.
  948. ;; https://github.com/ARMmbed/mbedtls/commit/2065a8d8af27c6cb1e40c9462b5933336dca7434
  949. (substitute* "CMakeLists.txt"
  950. (("Wformat-truncation=2") "Wformat-truncation"))
  951. #t))))
  952. (build-system cmake-build-system)
  953. (arguments
  954. `(#:configure-flags
  955. (list "-DUSE_SHARED_MBEDTLS_LIBRARY=ON"
  956. "-DUSE_STATIC_MBEDTLS_LIBRARY=OFF")
  957. #:phases
  958. (modify-phases %standard-phases
  959. (add-after 'unpack 'make-source-writable
  960. (lambda _
  961. (for-each make-file-writable (find-files "."))
  962. #t)))))
  963. (native-inputs
  964. `(("perl" ,perl)
  965. ("python" ,python)))
  966. (synopsis "Small TLS library")
  967. (description
  968. "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy
  969. for developers to include cryptographic and SSL/TLS capabilities in their
  970. (embedded) products, facilitating this functionality with a minimal
  971. coding footprint.")
  972. (home-page "https://www.trustedfirmware.org/projects/mbed-tls/")
  973. (license license:asl2.0)))
  974. ;; The Hiawatha Web server requires some specific features to be enabled.
  975. (define-public mbedtls-for-hiawatha
  976. (hidden-package
  977. (package
  978. (inherit mbedtls-apache)
  979. (arguments
  980. (substitute-keyword-arguments (package-arguments mbedtls-apache)
  981. ((#:phases phases)
  982. `(modify-phases ,phases
  983. (add-before 'configure 'configure-extra-features
  984. (lambda _
  985. (for-each (lambda (feature)
  986. (invoke "scripts/config.pl" "set" feature))
  987. (list "MBEDTLS_THREADING_C"
  988. "MBEDTLS_THREADING_PTHREAD"))
  989. ;; XXX The above enables code that breaks with -Werror…
  990. (substitute* "CMakeLists.txt"
  991. ((" -Wformat-signedness") ""))
  992. #t)))))))))
  993. (define-public dehydrated
  994. (package
  995. (name "dehydrated")
  996. (version "0.7.0")
  997. (source (origin
  998. (method url-fetch)
  999. (uri (string-append
  1000. "https://github.com/dehydrated-io/dehydrated/releases/download/"
  1001. "v" version "/dehydrated-" version ".tar.gz"))
  1002. (sha256
  1003. (base32
  1004. "1yf4kldyd5y13r6qxrkcbbk74ykngq7jzy0351vb2r3ywp114pqw"))))
  1005. (build-system trivial-build-system)
  1006. (arguments
  1007. `(#:modules ((guix build utils)
  1008. (srfi srfi-26))
  1009. #:builder
  1010. (begin
  1011. (use-modules (guix build utils)
  1012. (srfi srfi-26))
  1013. (let* ((source (assoc-ref %build-inputs "source"))
  1014. (tar (assoc-ref %build-inputs "tar"))
  1015. (gz (assoc-ref %build-inputs "gzip"))
  1016. (out (assoc-ref %outputs "out"))
  1017. (bin (string-append out "/bin"))
  1018. (doc (string-append out "/share/doc/" ,name "-" ,version))
  1019. (man (string-append out "/share/man"))
  1020. (bash (in-vicinity (assoc-ref %build-inputs "bash") "bin")))
  1021. (setenv "PATH" (string-append gz "/bin"))
  1022. (invoke (string-append tar "/bin/tar") "xvf" source)
  1023. (chdir (string-append ,name "-" ,version))
  1024. (copy-recursively "docs" doc)
  1025. (install-file "LICENSE" doc)
  1026. (mkdir-p man)
  1027. (rename-file (string-append doc "/man")
  1028. (string-append man "/man1"))
  1029. (for-each (cut invoke "gzip" "-9" <>)
  1030. (find-files man ".*"))
  1031. (install-file "dehydrated" bin)
  1032. (with-directory-excursion bin
  1033. (patch-shebang "dehydrated" (list bash))
  1034. ;; Do not try to write to the store.
  1035. (substitute* "dehydrated"
  1036. (("SCRIPTDIR=\"\\$.*\"") "SCRIPTDIR=~/.dehydrated"))
  1037. (setenv "PATH" bash)
  1038. (wrap-program "dehydrated"
  1039. `("PATH" ":" prefix
  1040. ,(map (lambda (dir)
  1041. (string-append dir "/bin"))
  1042. (map (lambda (input)
  1043. (assoc-ref %build-inputs input))
  1044. '("coreutils"
  1045. "curl"
  1046. "diffutils"
  1047. "gawk"
  1048. "grep"
  1049. "openssl"
  1050. "sed"))))))
  1051. #t))))
  1052. (inputs
  1053. `(("bash" ,bash)
  1054. ("coreutils" ,coreutils)
  1055. ("curl" ,curl)
  1056. ("diffutils" ,diffutils)
  1057. ("gawk" ,gawk)
  1058. ("grep" ,grep)
  1059. ("openssl" ,openssl)
  1060. ("sed" ,sed)))
  1061. (native-inputs
  1062. `(("gzip" ,gzip)
  1063. ("tar" ,tar)))
  1064. ;; The following definition is copied from the cURL package to prevent a
  1065. ;; cycle between the curl and tls modules.
  1066. (native-search-paths
  1067. (list (search-path-specification
  1068. (variable "CURL_CA_BUNDLE")
  1069. (file-type 'regular)
  1070. (separator #f)
  1071. (files '("etc/ssl/certs/ca-certificates.crt")))))
  1072. (home-page "https://dehydrated.io/")
  1073. (synopsis "ACME client implemented as a shell script")
  1074. (description "Dehydrated is a client for obtaining certificates from an
  1075. ACME server (such as Let's Encrypt) implemented as a relatively simple Bash
  1076. script.")
  1077. (license license:expat)))
  1078. (define-public go-github-com-certifi-gocertifi
  1079. (let ((commit "a5e0173ced670013bfb649c7e806bc9529c986ec")
  1080. (revision "1"))
  1081. (package
  1082. (name "go-github-com-certifi-gocertifi")
  1083. (version (git-version "2018.01.18" revision commit))
  1084. (source (origin
  1085. (method git-fetch)
  1086. (uri (git-reference
  1087. (url "https://github.com/certifi/gocertifi")
  1088. (commit commit)))
  1089. (file-name (git-file-name name version))
  1090. (sha256
  1091. (base32
  1092. "1n9drccl3q1rr8wg3nf60slkf1lgsmz5ahifrglbdrc6har3rryj"))))
  1093. (build-system go-build-system)
  1094. (arguments
  1095. '(#:import-path "github.com/certifi/gocertifi"))
  1096. (synopsis "X.509 TLS root certificate bundle for Go")
  1097. (description "This package is a Go language X.509 TLS root certificate bundle,
  1098. derived from Mozilla's collection.")
  1099. (home-page "https://certifi.io")
  1100. (license license:mpl2.0))))
  1101. (define-public s2n
  1102. (let* ((commit "7f43b102def1d52422f6c3e48d5cb3e6dd26c646")
  1103. (revision "1"))
  1104. (package
  1105. (name "s2n")
  1106. (version (git-version "1.0.10" revision commit))
  1107. (source (origin
  1108. (method git-fetch)
  1109. (uri (git-reference
  1110. (url "https://github.com/aws/s2n-tls")
  1111. (commit commit)))
  1112. (file-name (git-file-name name version))
  1113. (sha256
  1114. (base32
  1115. "06rqg0vcispi63cmcza9j7ix80l0w6wmbw81qlg4fq8l1lg9nyvl"))))
  1116. (build-system cmake-build-system)
  1117. (arguments
  1118. '(#:configure-flags
  1119. '("-DBUILD_SHARED_LIBS=ON")))
  1120. (propagated-inputs
  1121. `(("openssl" ,openssl)
  1122. ("openssl:static" ,openssl "static")))
  1123. (synopsis "SSL/TLS implementation in C99")
  1124. (description
  1125. "This library provides a C99 implementation of SSL/TLS. It is designed
  1126. to be familiar to users of the widely-used POSIX I/O APIs. It supports
  1127. blocking, non-blocking, and full-duplex I/O. There are no locks or mutexes.
  1128. As it can be difficult to keep track of which encryption algorithms and
  1129. protocols are best to use, s2n-tls features a simple API to use the latest
  1130. default set of preferences. Remaining on a specific version for backwards
  1131. compatibility is also supported.")
  1132. (home-page "https://github.com/aws/s2n-tls")
  1133. (license license:asl2.0))))
  1134. (define-public wolfssl
  1135. (package
  1136. (name "wolfssl")
  1137. (version "4.8.1")
  1138. (source (origin
  1139. (method git-fetch)
  1140. (uri (git-reference
  1141. (url "https://github.com/wolfSSL/wolfssl")
  1142. (commit (string-append "v" version "-stable"))))
  1143. (file-name (git-file-name name version))
  1144. (sha256
  1145. (base32
  1146. "0w5pd40j6h4j2f0b7c2n1n979y9qk8aln3ss2gb0jfsid1hrmx5k"))))
  1147. (build-system gnu-build-system)
  1148. (arguments
  1149. '(#:configure-flags
  1150. '("--enable-reproducible-build")))
  1151. (native-inputs
  1152. `(("autoconf" ,autoconf)
  1153. ("automake" ,automake)
  1154. ("libtool" ,libtool)))
  1155. (synopsis "SSL/TLS implementation")
  1156. (description "The wolfSSL embedded SSL library (formerly CyaSSL) is an
  1157. SSL/TLS library written in ANSI C and targeted for embedded, RTOS, and
  1158. resource-constrained environments - primarily because of its small size, speed,
  1159. and feature set. wolfSSL supports industry standards up to the current TLS 1.3
  1160. and DTLS 1.2, is up to 20 times smaller than OpenSSL, and offers progressive
  1161. ciphers such as ChaCha20, Curve25519, NTRU, and Blake2b.")
  1162. (home-page "https://www.wolfssl.com/")
  1163. (license license:gpl2+))) ; Audit
  1164. (define-public aws-lc
  1165. (let ((commit "d0a5455417d80e68581e197d95720c3fb25e3926")
  1166. (revision "0"))
  1167. (package
  1168. (name "aws-lc")
  1169. (version (git-version "0.0.0" revision commit))
  1170. (source (origin
  1171. (method git-fetch)
  1172. (uri (git-reference
  1173. (url (string-append "https://github.com/awslabs/" name))
  1174. (commit commit)))
  1175. (file-name (git-file-name name version))
  1176. (sha256
  1177. (base32
  1178. "1ysj3x1f2lcdvwzyb9x3waykz1j7r21viv5z5vgc0ja9xv7znm9g"))))
  1179. (build-system cmake-build-system)
  1180. (arguments
  1181. '(#:tests? #f ; re-enable but with go and perl dependencies
  1182. #:configure-flags
  1183. '("-DBUILD_SHARED_LIBS=ON")))
  1184. (synopsis "General purpose cryptographic library")
  1185. (description "AWS libcrypto (aws-lc) contains portable C implementations
  1186. of algorithms needed for TLS and common applications, and includes optimized
  1187. assembly versions for x86 and ARM.")
  1188. (home-page "https://github.com/awslabs/aws-lc")
  1189. (license license:asl2.0))))