Commit | Line | Data |
---|---|---|
233e7676 | 1 | ;;; GNU Guix --- Functional package management for GNU |
3c0f7910 | 2 | ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> |
80cc3a0a | 3 | ;;; Copyright © 2014, 2015, 2016 Mark H Weaver <mhw@netris.org> |
29a7c98a | 4 | ;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net> |
cc2b77df | 5 | ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr> |
9fd0838b | 6 | ;;; Copyright © 2015 David Thompson <davet@gnu.org> |
df0625ab | 7 | ;;; Copyright © 2015, 2016, 2017 Leo Famulari <leo@famulari.name> |
2ed12d3f | 8 | ;;; Copyright © 2016, 2017 Efraim Flashner <efraim@flashner.co.il> |
88522738 | 9 | ;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net> |
375cef6c | 10 | ;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com> |
7543f865 | 11 | ;;; |
233e7676 | 12 | ;;; This file is part of GNU Guix. |
7543f865 | 13 | ;;; |
233e7676 | 14 | ;;; GNU Guix is free software; you can redistribute it and/or modify it |
7543f865 LC |
15 | ;;; under the terms of the GNU General Public License as published by |
16 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
17 | ;;; your option) any later version. | |
18 | ;;; | |
233e7676 | 19 | ;;; GNU Guix is distributed in the hope that it will be useful, but |
7543f865 LC |
20 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
21 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | ;;; GNU General Public License for more details. | |
23 | ;;; | |
24 | ;;; You should have received a copy of the GNU General Public License | |
233e7676 | 25 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
7543f865 | 26 | |
a7fd7b68 | 27 | (define-module (gnu packages tls) |
e9aa8d0c | 28 | #:use-module ((guix licenses) #:prefix license:) |
7543f865 LC |
29 | #:use-module (guix packages) |
30 | #:use-module (guix download) | |
29a7c98a | 31 | #:use-module (guix utils) |
7543f865 | 32 | #:use-module (guix build-system gnu) |
cc2b77df | 33 | #:use-module (guix build-system perl) |
7890e3ba | 34 | #:use-module (guix build-system python) |
88522738 | 35 | #:use-module (guix build-system cmake) |
f61e0e79 | 36 | #:use-module (gnu packages compression) |
013ce67b | 37 | #:use-module (gnu packages) |
1ffa7090 | 38 | #:use-module (gnu packages guile) |
0581c273 | 39 | #:use-module (gnu packages libbsd) |
27e86bed | 40 | #:use-module (gnu packages libffi) |
866f469e | 41 | #:use-module (gnu packages libidn) |
5d4c90ae | 42 | #:use-module (gnu packages linux) |
7890e3ba | 43 | #:use-module (gnu packages ncurses) |
27e86bed | 44 | #:use-module (gnu packages nettle) |
1ffa7090 | 45 | #:use-module (gnu packages perl) |
27e86bed | 46 | #:use-module (gnu packages pkg-config) |
7890e3ba | 47 | #:use-module (gnu packages python) |
a31f4d35 | 48 | #:use-module (gnu packages texinfo) |
079f013b LC |
49 | #:use-module (gnu packages base) |
50 | #:use-module (srfi srfi-1)) | |
7543f865 LC |
51 | |
52 | (define-public libtasn1 | |
53 | (package | |
54 | (name "libtasn1") | |
ff51a87c | 55 | (replacement libtasn1/fixed) |
3853bf25 | 56 | (version "4.10") |
7543f865 LC |
57 | (source |
58 | (origin | |
59 | (method url-fetch) | |
60 | (uri (string-append "mirror://gnu/libtasn1/libtasn1-" | |
61 | version ".tar.gz")) | |
62 | (sha256 | |
63 | (base32 | |
3853bf25 | 64 | "00jsix5hny0g768zv4hk78dib7w0qmk5fbizf4jj37r51nd4s6k8")))) |
7543f865 | 65 | (build-system gnu-build-system) |
3ea110b7 | 66 | (native-inputs `(("perl" ,perl))) |
6fd52309 | 67 | (home-page "https://www.gnu.org/software/libtasn1/") |
f50d2669 | 68 | (synopsis "ASN.1 library") |
7543f865 | 69 | (description |
79c311b8 LC |
70 | "GNU libtasn1 is a library implementing the ASN.1 notation. It is used |
71 | for transmitting machine-neutral encodings of data objects in computer | |
a22dc0c4 LC |
72 | networking, allowing for formal validation of data according to some |
73 | specifications.") | |
e9aa8d0c | 74 | (license license:lgpl2.0+))) |
7543f865 | 75 | |
ff51a87c LF |
76 | (define libtasn1/fixed |
77 | (package | |
78 | (inherit libtasn1) | |
79 | (source | |
80 | (origin | |
81 | (inherit (package-source libtasn1)) | |
82 | (patches | |
83 | (search-patches "libtasn1-CVE-2017-6891.patch")))))) | |
84 | ||
375cef6c HG |
85 | (define-public asn1c |
86 | (package | |
87 | (name "asn1c") | |
ff7da7e0 | 88 | (version "0.9.28") |
375cef6c HG |
89 | (source (origin |
90 | (method url-fetch) | |
91 | (uri (string-append "https://lionet.info/soft/asn1c-" | |
92 | version ".tar.gz")) | |
93 | (sha256 | |
94 | (base32 | |
ff7da7e0 | 95 | "1fc64g45ykmv73kdndr4zdm4wxhimhrir4rxnygxvwkych5l81w0")))) |
375cef6c HG |
96 | (build-system gnu-build-system) |
97 | (native-inputs | |
98 | `(("perl" ,perl))) | |
99 | (home-page "https://lionet.info/asn1c") | |
100 | (synopsis "ASN.1 to C compiler") | |
101 | (description "The ASN.1 to C compiler takes ASN.1 module | |
102 | files and generates C++ compatible C source code. That code can be | |
103 | used to serialize the native C structures into compact and unambiguous | |
104 | BER/XER/PER-based data files, and deserialize the files back. | |
105 | ||
106 | Various ASN.1 based formats are widely used in the industry, such as to encode | |
107 | the X.509 certificates employed in the HTTPS handshake, to exchange control | |
108 | data between mobile phones and cellular networks, to car-to-car communication | |
109 | in intelligent transportation networks.") | |
110 | (license license:bsd-2))) | |
111 | ||
27e86bed AE |
112 | (define-public p11-kit |
113 | (package | |
114 | (name "p11-kit") | |
2b11b9ab | 115 | (version "0.23.2") |
27e86bed AE |
116 | (source |
117 | (origin | |
118 | (method url-fetch) | |
5cc3096c | 119 | (uri (string-append "https://p11-glue.freedesktop.org/releases/p11-kit-" |
27e86bed AE |
120 | version ".tar.gz")) |
121 | (sha256 | |
122 | (base32 | |
2b11b9ab | 123 | "1w7szm190phlkg7qx05ychlj2dbvkgkhx9gw6dx4d5rw62l6wwms")) |
27e86bed AE |
124 | (modules '((guix build utils))) ; for substitute* |
125 | (snippet | |
126 | '(begin | |
127 | ;; Drop one test that fails, also when trying to compile manually. | |
128 | ;; Reported upstream at | |
129 | ;; https://bugs.freedesktop.org/show_bug.cgi?id=89027 | |
130 | (substitute* "Makefile.in" | |
131 | (("test-module\\$\\(EXEEXT\\) ") "")))))) | |
132 | (build-system gnu-build-system) | |
133 | (native-inputs | |
134 | `(("pkg-config" ,pkg-config))) | |
135 | (inputs | |
136 | `(("libffi" ,libffi) | |
137 | ("libtasn1" ,libtasn1))) | |
138 | (arguments | |
139 | `(#:configure-flags '("--without-trust-paths"))) | |
140 | (home-page "http://p11-glue.freedesktop.org/p11-kit.html") | |
141 | (synopsis "PKCS#11 library") | |
142 | (description | |
143 | "p11-kit provides a way to load and enumerate PKCS#11 modules. It | |
144 | provides a standard configuration setup for installing PKCS#11 modules | |
145 | in such a way that they are discoverable. It also solves problems with | |
146 | coordinating the use of PKCS#11 by different components or libraries | |
147 | living in the same process.") | |
e9aa8d0c | 148 | (license license:bsd-3))) |
27e86bed | 149 | |
7543f865 LC |
150 | (define-public gnutls |
151 | (package | |
152 | (name "gnutls") | |
0b866506 | 153 | (version "3.5.9") |
d7d408d5 LC |
154 | (source (origin |
155 | (method url-fetch) | |
156 | (uri | |
157 | ;; Note: Releases are no longer on ftp.gnu.org since the | |
158 | ;; schism (after version 3.1.5). | |
d93627e4 | 159 | (string-append "mirror://gnupg/gnutls/v" |
29a7c98a | 160 | (version-major+minor version) |
d93627e4 | 161 | "/gnutls-" version ".tar.xz")) |
d7d408d5 LC |
162 | (sha256 |
163 | (base32 | |
0b866506 | 164 | "0l9971841jsfdcvcyhas17sk5rsby6x5vvwcmmj4x3zi9q60zcc2")))) |
7543f865 | 165 | (build-system gnu-build-system) |
b94ae0b8 AK |
166 | (arguments |
167 | '(#:configure-flags | |
168 | (list (string-append "--with-guile-site-dir=" | |
169 | (assoc-ref %outputs "out") | |
aa7c7f21 MW |
170 | "/share/guile/site/2.0") |
171 | ;; GnuTLS doesn't consult any environment variables to specify | |
172 | ;; the location of the system-wide trust store. Instead it has a | |
173 | ;; configure-time option. Unless specified, its configure script | |
174 | ;; attempts to auto-detect the location by looking for common | |
8f65585b | 175 | ;; places in the file system, none of which are present in our |
aa7c7f21 MW |
176 | ;; chroot build environment. If not found, then no default trust |
177 | ;; store is used, so each program has to provide its own | |
178 | ;; fallback, and users have to configure each program | |
179 | ;; independently. This seems suboptimal. | |
866f469e MW |
180 | "--with-default-trust-store-dir=/etc/ssl/certs" |
181 | ||
182 | ;; FIXME: Temporarily disable p11-kit support since it is not | |
183 | ;; working on mips64el. | |
606c6380 LC |
184 | "--without-p11-kit") |
185 | ||
186 | #:phases (modify-phases %standard-phases | |
187 | (add-after | |
188 | 'install 'move-doc | |
189 | (lambda* (#:key outputs #:allow-other-keys) | |
190 | ;; Copy the 4.1 MiB of section 3 man pages to "doc". | |
191 | (let* ((out (assoc-ref outputs "out")) | |
192 | (doc (assoc-ref outputs "doc")) | |
9cdce047 | 193 | (mandir (string-append doc "/share/man/man3")) |
606c6380 LC |
194 | (oldman (string-append out "/share/man/man3"))) |
195 | (mkdir-p mandir) | |
196 | (copy-recursively oldman mandir) | |
197 | (delete-file-recursively oldman) | |
198 | #t)))))) | |
199 | (outputs '("out" ;4.4 MiB | |
200 | "debug" | |
201 | "doc")) ;4.1 MiB of man pages | |
a1db0975 | 202 | (native-inputs |
5d4c90ae LF |
203 | `(("net-tools" ,net-tools) |
204 | ("pkg-config" ,pkg-config) | |
d2fcfd3d | 205 | ("which" ,which))) |
7543f865 | 206 | (inputs |
59e0bd71 | 207 | `(("guile" ,guile-2.0))) |
7543f865 | 208 | (propagated-inputs |
d2fcfd3d | 209 | ;; These are all in the 'Requires.private' field of gnutls.pc. |
7543f865 | 210 | `(("libtasn1" ,libtasn1) |
55e61c4d | 211 | ("libidn2" ,libidn2) |
866f469e | 212 | ("nettle" ,nettle) |
f61e0e79 | 213 | ("zlib" ,zlib))) |
c19700c3 | 214 | (home-page "https://www.gnu.org/software/gnutls/") |
f50d2669 | 215 | (synopsis "Transport layer security library") |
7543f865 | 216 | (description |
a22dc0c4 | 217 | "GnuTLS is a secure communications library implementing the SSL, TLS |
79c311b8 | 218 | and DTLS protocols. It is provided in the form of a C library to support the |
a22dc0c4 LC |
219 | protocols, as well as to parse and write X.5009, PKCS 12, OpenPGP and other |
220 | required structures.") | |
63e8bb12 LC |
221 | (license license:lgpl2.1+) |
222 | (properties '((ftp-server . "ftp.gnutls.org") | |
223 | (ftp-directory . "/gcrypt/gnutls"))))) | |
cc2b77df | 224 | |
079f013b LC |
225 | (define-public gnutls/guile-2.2 |
226 | ;; GnuTLS for Guile 2.2. This is supported by GnuTLS >= 3.5.5. | |
227 | (package | |
58ea4d40 | 228 | (inherit gnutls) |
079f013b LC |
229 | (name "guile2.2-gnutls") |
230 | (arguments | |
231 | ;; Remove '--with-guile-site-dir=…/2.0'. | |
58ea4d40 | 232 | (substitute-keyword-arguments (package-arguments gnutls) |
079f013b LC |
233 | ((#:configure-flags flags) |
234 | `(cdr ,flags)))) | |
f6396d86 | 235 | (inputs `(("guile" ,guile-2.2) |
58ea4d40 | 236 | ,@(alist-delete "guile" (package-inputs gnutls)))))) |
079f013b | 237 | |
cc2b77df AE |
238 | (define-public openssl |
239 | (package | |
240 | (name "openssl") | |
4c145d21 | 241 | (version "1.0.2k") |
cc2b77df | 242 | (source (origin |
4cff124b LC |
243 | (method url-fetch) |
244 | (uri (list (string-append "ftp://ftp.openssl.org/source/" | |
245 | name "-" version ".tar.gz") | |
246 | (string-append "ftp://ftp.openssl.org/source/old/" | |
247 | (string-trim-right version char-set:letter) | |
248 | "/" name "-" version ".tar.gz"))) | |
249 | (sha256 | |
250 | (base32 | |
4c145d21 | 251 | "1h6qi35w6hv6rd73p4cdgdzg732pdrfgpp37cgwz1v9a3z37ffbb")) |
fc1adab1 | 252 | (patches (search-patches "openssl-runpath.patch" |
1d8de185 | 253 | "openssl-c-rehash-in.patch")))) |
cc2b77df | 254 | (build-system gnu-build-system) |
8c78aeb7 | 255 | (outputs '("out" |
a909b576 | 256 | "doc" ;1.5MiB of man3 pages |
8c78aeb7 | 257 | "static")) ;6MiB of .a files |
cc2b77df AE |
258 | (native-inputs `(("perl" ,perl))) |
259 | (arguments | |
d03781c3 LC |
260 | `(#:disallowed-references (,perl) |
261 | #:parallel-build? #f | |
cc2b77df AE |
262 | #:parallel-tests? #f |
263 | #:test-target "test" | |
8c9ec203 LF |
264 | |
265 | ;; Changes to OpenSSL sometimes cause Perl to "sneak in" to the closure, | |
266 | ;; so we explicitly disallow it here. | |
267 | #:disallowed-references ,(list (canonical-package perl)) | |
cc2b77df | 268 | #:phases |
b6cb1358 | 269 | (modify-phases %standard-phases |
4fb254a3 | 270 | (add-before |
86c8f1da | 271 | 'configure 'patch-Makefile.org |
4fb254a3 LC |
272 | (lambda* (#:key outputs #:allow-other-keys) |
273 | ;; The default MANDIR is some unusual place. Fix that. | |
274 | (let ((out (assoc-ref outputs "out"))) | |
86c8f1da | 275 | (patch-makefile-SHELL "Makefile.org") |
4fb254a3 LC |
276 | (substitute* "Makefile.org" |
277 | (("^MANDIR[[:blank:]]*=.*$") | |
278 | (string-append "MANDIR = " out "/share/man\n"))) | |
279 | #t))) | |
b6cb1358 LC |
280 | (replace |
281 | 'configure | |
282 | (lambda* (#:key outputs #:allow-other-keys) | |
283 | (let ((out (assoc-ref outputs "out"))) | |
284 | (zero? | |
285 | (system* "./config" | |
286 | "shared" ;build shared libraries | |
287 | "--libdir=lib" | |
4fb254a3 LC |
288 | |
289 | ;; The default for this catch-all directory is | |
290 | ;; PREFIX/ssl. Change that to something more | |
291 | ;; conventional. | |
292 | (string-append "--openssldir=" out | |
293 | "/share/openssl-" ,version) | |
294 | ||
b6cb1358 LC |
295 | (string-append "--prefix=" out) |
296 | ||
297 | ;; XXX FIXME: Work around a code generation bug in GCC | |
298 | ;; 4.9.3 on ARM when compiled with -mfpu=neon. See: | |
299 | ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66917> | |
300 | ,@(if (and (not (%current-target-system)) | |
301 | (string-prefix? "armhf" (%current-system))) | |
302 | '("-mfpu=vfpv3") | |
303 | '())))))) | |
fe8199a8 LC |
304 | (add-after |
305 | 'install 'make-libraries-writable | |
306 | (lambda* (#:key outputs #:allow-other-keys) | |
307 | ;; Make libraries writable so that 'strip' does its job. | |
308 | (let ((out (assoc-ref outputs "out"))) | |
309 | (for-each (lambda (file) | |
310 | (chmod file #o644)) | |
311 | (find-files (string-append out "/lib") | |
312 | "\\.so")) | |
313 | #t))) | |
8c78aeb7 LC |
314 | (add-after 'install 'move-static-libraries |
315 | (lambda* (#:key outputs #:allow-other-keys) | |
316 | ;; Move static libraries to the "static" output. | |
317 | (let* ((out (assoc-ref outputs "out")) | |
318 | (lib (string-append out "/lib")) | |
319 | (static (assoc-ref outputs "static")) | |
320 | (slib (string-append static "/lib"))) | |
8c78aeb7 LC |
321 | (for-each (lambda (file) |
322 | (install-file file slib) | |
323 | (delete-file file)) | |
324 | (find-files lib "\\.a$")) | |
325 | #t))) | |
a909b576 LC |
326 | (add-after 'install 'move-man3-pages |
327 | (lambda* (#:key outputs #:allow-other-keys) | |
328 | ;; Move section 3 man pages to "doc". | |
329 | (let* ((out (assoc-ref outputs "out")) | |
330 | (man3 (string-append out "/share/man/man3")) | |
331 | (doc (assoc-ref outputs "doc")) | |
332 | (target (string-append doc "/share/man/man3"))) | |
333 | (mkdir-p target) | |
334 | (for-each (lambda (file) | |
335 | (rename-file file | |
336 | (string-append target "/" | |
337 | (basename file)))) | |
338 | (find-files man3)) | |
5c838ec9 | 339 | (delete-file-recursively man3) |
a909b576 | 340 | #t))) |
b6cb1358 LC |
341 | (add-before |
342 | 'patch-source-shebangs 'patch-tests | |
343 | (lambda* (#:key inputs native-inputs #:allow-other-keys) | |
344 | (let ((bash (assoc-ref (or native-inputs inputs) "bash"))) | |
345 | (substitute* (find-files "test" ".*") | |
346 | (("/bin/sh") | |
08a78c2f | 347 | (string-append bash "/bin/sh")) |
b6cb1358 | 348 | (("/bin/rm") |
86c8f1da MW |
349 | "rm")) |
350 | #t))) | |
784d6e91 LC |
351 | (add-after |
352 | 'install 'remove-miscellany | |
353 | (lambda* (#:key outputs #:allow-other-keys) | |
354 | ;; The 'misc' directory contains random undocumented shell and Perl | |
355 | ;; scripts. Remove them to avoid retaining a reference on Perl. | |
356 | (let ((out (assoc-ref outputs "out"))) | |
357 | (delete-file-recursively (string-append out "/share/openssl-" | |
358 | ,version "/misc")) | |
359 | #t)))))) | |
cc2b77df AE |
360 | (native-search-paths |
361 | ;; FIXME: These two variables must designate a single file or directory | |
362 | ;; and are not actually "search paths." In practice it works OK in user | |
363 | ;; profiles because there's always just one item that matches the | |
364 | ;; specification. | |
365 | (list (search-path-specification | |
366 | (variable "SSL_CERT_DIR") | |
367 | (files '("etc/ssl/certs"))) | |
368 | (search-path-specification | |
369 | (variable "SSL_CERT_FILE") | |
370 | (files '("etc/ssl/certs/ca-certificates.crt"))))) | |
371 | (synopsis "SSL/TLS implementation") | |
372 | (description | |
e881752c | 373 | "OpenSSL is an implementation of SSL/TLS.") |
e9aa8d0c | 374 | (license license:openssl) |
cc2b77df AE |
375 | (home-page "http://www.openssl.org/"))) |
376 | ||
763899f0 LF |
377 | (define-public openssl-next |
378 | (package | |
379 | (inherit openssl) | |
380 | (name "openssl") | |
fc3a0416 | 381 | (version "1.1.0f") |
763899f0 LF |
382 | (source (origin |
383 | (method url-fetch) | |
384 | (uri (list (string-append "ftp://ftp.openssl.org/source/" | |
385 | name "-" version ".tar.gz") | |
386 | (string-append "ftp://ftp.openssl.org/source/old/" | |
387 | (string-trim-right version char-set:letter) | |
388 | "/" name "-" version ".tar.gz"))) | |
389 | (patches (search-patches "openssl-1.1.0-c-rehash-in.patch")) | |
390 | (sha256 | |
391 | (base32 | |
fc3a0416 | 392 | "0r97n4n552ns571diz54qsgarihrxvbn7kvyv8wjyfs9ybrldxqj")))) |
763899f0 LF |
393 | (outputs '("out" |
394 | "doc" ;1.3MiB of man3 pages | |
395 | "static")) ; 5.5MiB of .a files | |
396 | (arguments | |
397 | (substitute-keyword-arguments (package-arguments openssl) | |
398 | ((#:phases phases) | |
399 | `(modify-phases ,phases | |
400 | (delete 'patch-tests) ; These two phases are not needed by | |
401 | (delete 'patch-Makefile.org) ; OpenSSL 1.1.0. | |
402 | ||
fc184fe2 MB |
403 | ;; Override configure phase since -rpath is now a configure option. |
404 | (replace 'configure | |
763899f0 | 405 | (lambda* (#:key outputs #:allow-other-keys) |
fc184fe2 MB |
406 | (let* ((out (assoc-ref outputs "out")) |
407 | (lib (string-append out "/lib"))) | |
408 | (zero? | |
409 | (system* "./config" | |
410 | "shared" ;build shared libraries | |
411 | "--libdir=lib" | |
412 | ||
413 | ;; The default for this catch-all directory is | |
414 | ;; PREFIX/ssl. Change that to something more | |
415 | ;; conventional. | |
416 | (string-append "--openssldir=" out | |
417 | "/share/openssl-" ,version) | |
418 | ||
419 | (string-append "--prefix=" out) | |
420 | (string-append "-Wl,-rpath," lib) | |
421 | ||
422 | ;; XXX FIXME: Work around a code generation bug in GCC | |
423 | ;; 4.9.3 on ARM when compiled with -mfpu=neon. See: | |
424 | ;; <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66917> | |
425 | ,@(if (and (not (%current-target-system)) | |
426 | (string-prefix? "armhf" (%current-system))) | |
427 | '("-mfpu=vfpv3") | |
428 | '())))))) | |
429 | ||
430 | ;; XXX: Duplicate this phase to make sure 'version' evaluates | |
431 | ;; in the current scope and not the inherited one. | |
432 | (replace 'remove-miscellany | |
433 | (lambda* (#:key outputs #:allow-other-keys) | |
434 | ;; The 'misc' directory contains random undocumented shell and Perl | |
435 | ;; scripts. Remove them to avoid retaining a reference on Perl. | |
436 | (let ((out (assoc-ref outputs "out"))) | |
437 | (delete-file-recursively (string-append out "/share/openssl-" | |
438 | ,version "/misc")) | |
763899f0 LF |
439 | #t))))))))) |
440 | ||
cb6a802c AE |
441 | (define-public libressl |
442 | (package | |
443 | (name "libressl") | |
2ed12d3f | 444 | (version "2.5.4") |
cb6a802c AE |
445 | (source |
446 | (origin | |
447 | (method url-fetch) | |
448 | (uri (string-append | |
449 | "http://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-" | |
450 | version ".tar.gz")) | |
1a957c21 LF |
451 | (sha256 |
452 | (base32 | |
2ed12d3f | 453 | "1ykf6dqlbafafhbdfmcj19pjj1z6wmsq0rmyqga1i0xv5x95nyhh")))) |
cb6a802c | 454 | (build-system gnu-build-system) |
a2d64899 LC |
455 | (arguments |
456 | ;; Do as if 'getentropy' was missing since older Linux kernels lack it | |
457 | ;; and libc would return ENOSYS, which is not properly handled. | |
458 | ;; See <https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00235.html>. | |
459 | '(#:configure-flags '("ac_cv_func_getentropy=no"))) | |
cb6a802c AE |
460 | (native-search-paths |
461 | ;; FIXME: These two variables must designate a single file or directory | |
462 | ;; and are not actually "search paths." In practice it works OK in | |
463 | ;; user profiles because there's always just one item that matches the | |
464 | ;; specification. | |
465 | (list (search-path-specification | |
466 | (variable "SSL_CERT_DIR") | |
467 | (files '("etc/ssl/certs"))) | |
468 | (search-path-specification | |
469 | (variable "SSL_CERT_FILE") | |
470 | (files '("etc/ssl/certs/ca-certificates.crt"))))) | |
2ed12d3f | 471 | (home-page "https://www.libressl.org/") |
cb6a802c AE |
472 | (synopsis "SSL/TLS implementation") |
473 | (description "LibreSSL is a version of the TLS/crypto stack forked | |
474 | from OpenSSL in 2014, with the goals of modernizing the codebase, improving | |
475 | security, and applying best practice development processes.") | |
476 | ;; Files taken from OpenSSL keep their license, others are under various | |
477 | ;; non-copyleft licenses. | |
478 | (license (list license:openssl | |
479 | (license:non-copyleft | |
480 | "file://COPYING" | |
481 | "See COPYING in the distribution."))))) | |
482 | ||
6cefd53d | 483 | (define-public python-acme |
7890e3ba | 484 | (package |
6cefd53d | 485 | (name "python-acme") |
686d4259 | 486 | ;; Remember to update the hash of certbot when updating python-acme. |
61759370 | 487 | (version "0.15.0") |
7890e3ba | 488 | (source (origin |
9495cf9a | 489 | (method url-fetch) |
f349d36e | 490 | (uri (pypi-uri "acme" version)) |
7890e3ba | 491 | (sha256 |
df0625ab | 492 | (base32 |
61759370 | 493 | "11zwgj663vr575pbqw74ia10wxaw16i8rnkcivsrbsx148rxdbcz")))) |
7890e3ba LF |
494 | (build-system python-build-system) |
495 | (arguments | |
6cefd53d | 496 | `(#:phases |
9bee9d87 | 497 | (modify-phases %standard-phases |
1fc8476d MB |
498 | (add-after 'build 'build-documentation |
499 | (lambda _ | |
500 | (zero? (system* "make" "-C" "docs" "man" "info")))) | |
501 | (add-after 'install 'install-documentation | |
50a7963a LF |
502 | (lambda* (#:key outputs #:allow-other-keys) |
503 | (let* ((out (assoc-ref outputs "out")) | |
504 | (man (string-append out "/share/man/man1")) | |
505 | (info (string-append out "/info"))) | |
1fc8476d MB |
506 | (install-file "docs/_build/texinfo/acme-python.info" info) |
507 | (install-file "docs/_build/man/acme-python.1" man) | |
508 | #t)))))) | |
50a7963a | 509 | ;; TODO: Add optional inputs for testing. |
7890e3ba | 510 | (native-inputs |
6cefd53d | 511 | `(("python-mock" ,python-mock) |
50a7963a LF |
512 | ;; For documentation |
513 | ("python-sphinx" ,python-sphinx) | |
514 | ("python-sphinxcontrib-programoutput" ,python-sphinxcontrib-programoutput) | |
515 | ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme) | |
50a7963a | 516 | ("texinfo" ,texinfo))) |
7890e3ba | 517 | (propagated-inputs |
57fe07db | 518 | `(("python-six" ,python-six) |
6cefd53d LF |
519 | ("python-requests" ,python-requests) |
520 | ("python-pytz" ,python-pytz) | |
521 | ("python-pyrfc3339" ,python-pyrfc3339) | |
522 | ("python-pyasn1" ,python-pyasn1) | |
523 | ("python-cryptography" ,python-cryptography) | |
524 | ("python-pyopenssl" ,python-pyopenssl))) | |
7890e3ba LF |
525 | (home-page "https://github.com/letsencrypt/letsencrypt") |
526 | (synopsis "ACME protocol implementation in Python") | |
527 | (description "ACME protocol implementation in Python") | |
528 | (license license:asl2.0))) | |
529 | ||
6cefd53d LF |
530 | (define-public python2-acme |
531 | (package-with-python2 python-acme)) | |
532 | ||
9495cf9a | 533 | (define-public certbot |
9fd0838b | 534 | (package |
9495cf9a | 535 | (name "certbot") |
686d4259 LF |
536 | ;; Certbot and python-acme are developed in the same repository, and their |
537 | ;; versions should remain synchronized. | |
538 | (version (package-version python-acme)) | |
9fd0838b DT |
539 | (source (origin |
540 | (method url-fetch) | |
f349d36e | 541 | (uri (pypi-uri name version)) |
9fd0838b DT |
542 | (sha256 |
543 | (base32 | |
61759370 | 544 | "1srvmjxz75dbafx7xfg1w3n9h3srr9p2ljnfsih9dwwd5cxh9i5q")))) |
9fd0838b DT |
545 | (build-system python-build-system) |
546 | (arguments | |
f9263d9a | 547 | `(#:python ,python-2 |
f26d6e4e LF |
548 | ,@(substitute-keyword-arguments (package-arguments python-acme) |
549 | ((#:phases phases) | |
550 | `(modify-phases ,phases | |
1fc8476d | 551 | (replace 'install-documentation |
f26d6e4e LF |
552 | (lambda* (#:key outputs #:allow-other-keys) |
553 | (let* ((out (assoc-ref outputs "out")) | |
554 | (man1 (string-append out "/share/man/man1")) | |
555 | (man7 (string-append out "/share/man/man7")) | |
556 | (info (string-append out "/info"))) | |
1fc8476d MB |
557 | (install-file "docs/_build/texinfo/Certbot.info" info) |
558 | (install-file "docs/_build/man/certbot.1" man1) | |
559 | (install-file "docs/_build/man/certbot.7" man7) | |
560 | #t)))))))) | |
f9263d9a | 561 | ;; TODO: Add optional inputs for testing. |
9fd0838b DT |
562 | (native-inputs |
563 | `(("python2-nose" ,python2-nose) | |
f9263d9a LF |
564 | ("python2-mock" ,python2-mock) |
565 | ;; For documentation | |
566 | ("python2-sphinx" ,python2-sphinx) | |
567 | ("python2-sphinx-rtd-theme" ,python2-sphinx-rtd-theme) | |
568 | ("python2-sphinx-repoze-autointerface" ,python2-sphinx-repoze-autointerface) | |
569 | ("python2-sphinxcontrib-programoutput" ,python2-sphinxcontrib-programoutput) | |
570 | ("texinfo" ,texinfo))) | |
9fd0838b | 571 | (propagated-inputs |
6cefd53d | 572 | `(("python2-acme" ,python2-acme) |
9fd0838b | 573 | ("python2-zope-interface" ,python2-zope-interface) |
9fd0838b DT |
574 | ("python2-pyrfc3339" ,python2-pyrfc3339) |
575 | ("python2-pyopenssl" ,python2-pyopenssl) | |
576 | ("python2-configobj" ,python2-configobj) | |
577 | ("python2-configargparse" ,python2-configargparse) | |
578 | ("python2-zope-component" ,python2-zope-component) | |
579 | ("python2-parsedatetime" ,python2-parsedatetime) | |
580 | ("python2-six" ,python2-six) | |
581 | ("python2-psutil" ,python2-psutil) | |
582 | ("python2-requests" ,python2-requests) | |
583 | ("python2-pytz" ,python2-pytz))) | |
d8a1be63 | 584 | (synopsis "Let's Encrypt client by the Electronic Frontier Foundation") |
80968df0 TGR |
585 | (description "Certbot automatically receives and installs X.509 certificates |
586 | to enable Transport Layer Security (TLS) on servers. It interoperates with the | |
587 | Let’s Encrypt certificate authority (CA), which issues browser-trusted | |
588 | certificates for free.") | |
24778368 | 589 | (home-page "https://certbot.eff.org/") |
9fd0838b DT |
590 | (license license:asl2.0))) |
591 | ||
9495cf9a LF |
592 | (define-public letsencrypt |
593 | (package (inherit certbot) | |
56ab55d1 LF |
594 | (name "letsencrypt") |
595 | (properties `((superseded . ,certbot))))) | |
9495cf9a | 596 | |
cc2b77df AE |
597 | (define-public perl-net-ssleay |
598 | (package | |
599 | (name "perl-net-ssleay") | |
600 | (version "1.68") | |
601 | (source (origin | |
602 | (method url-fetch) | |
603 | (uri (string-append "mirror://cpan/authors/id/M/MI/MIKEM/" | |
604 | "Net-SSLeay-" version ".tar.gz")) | |
605 | (sha256 | |
606 | (base32 | |
1084ec08 | 607 | "1m2wwzhjwsg0drlhp9w12fl6bsgj69v8gdz72jqrqll3qr7f408p")))) |
cc2b77df | 608 | (build-system perl-build-system) |
1084ec08 MW |
609 | (native-inputs |
610 | `(("patch" ,patch) | |
611 | ("patch/disable-ede-test" | |
612 | ,(search-patch "perl-net-ssleay-disable-ede-test.patch")))) | |
cc2b77df AE |
613 | (inputs `(("openssl" ,openssl))) |
614 | (arguments | |
1084ec08 MW |
615 | `(#:phases |
616 | (modify-phases %standard-phases | |
617 | (add-after | |
618 | 'unpack 'apply-patch | |
619 | (lambda* (#:key inputs #:allow-other-keys) | |
620 | ;; XXX We apply this patch here instead of in the 'origin' because | |
621 | ;; this package's build system fails badly when the source file | |
622 | ;; times are zeroed. | |
623 | ;; XXX Try removing this patch for perl-net-ssleay > 1.68 | |
624 | (zero? (system* "patch" "--force" "-p1" "-i" | |
625 | (assoc-ref inputs "patch/disable-ede-test"))))) | |
626 | (add-before | |
627 | 'configure 'set-ssl-prefix | |
628 | (lambda* (#:key inputs #:allow-other-keys) | |
629 | (setenv "OPENSSL_PREFIX" (assoc-ref inputs "openssl")) | |
630 | #t))))) | |
cc2b77df AE |
631 | (synopsis "Perl extension for using OpenSSL") |
632 | (description | |
633 | "This module offers some high level convenience functions for accessing | |
634 | web pages on SSL servers (for symmetry, the same API is offered for accessing | |
635 | http servers, too), an sslcat() function for writing your own clients, and | |
636 | finally access to the SSL api of the SSLeay/OpenSSL package so you can write | |
637 | servers or clients for more complicated applications.") | |
2f3108ad | 638 | (license license:perl-license) |
cc2b77df | 639 | (home-page "http://search.cpan.org/~mikem/Net-SSLeay-1.66/"))) |
4532c0c0 DM |
640 | |
641 | (define-public perl-crypt-openssl-rsa | |
642 | (package | |
643 | (name "perl-crypt-openssl-rsa") | |
644 | (version "0.28") | |
645 | (source | |
646 | (origin | |
647 | (method url-fetch) | |
648 | (uri (string-append | |
649 | "mirror://cpan/authors/id/P/PE/PERLER/Crypt-OpenSSL-RSA-" | |
650 | version | |
651 | ".tar.gz")) | |
652 | (sha256 | |
653 | (base32 | |
654 | "1gnpvv09b2gpifwdzc5jnhama3d1a4c39lzj9hcaicsb8rvzjmsk")))) | |
655 | (build-system perl-build-system) | |
656 | (inputs | |
657 | `(("perl-crypt-openssl-bignum" ,perl-crypt-openssl-bignum) | |
658 | ("perl-crypt-openssl-random" ,perl-crypt-openssl-random) | |
659 | ("openssl" ,openssl))) | |
660 | (arguments perl-crypt-arguments) | |
661 | (home-page | |
662 | "http://search.cpan.org/dist/Crypt-OpenSSL-RSA") | |
663 | (synopsis | |
664 | "RSA encoding and decoding, using the openSSL libraries") | |
665 | (description "Crypt::OpenSSL::RSA does RSA encoding and decoding (using the | |
666 | OpenSSL libraries).") | |
2f3108ad | 667 | (license license:perl-license))) |
adff71ca DM |
668 | |
669 | (define perl-crypt-arguments | |
670 | `(#:phases (modify-phases %standard-phases | |
671 | (add-before 'configure 'patch-Makefile.PL | |
672 | (lambda* (#:key inputs #:allow-other-keys) | |
673 | (substitute* "Makefile.PL" | |
674 | (("'LIBS'.*=>.*") (string-append "'LIBS' => ['-L" | |
675 | (assoc-ref inputs "openssl") | |
676 | "/lib -lcrypto'],"))) | |
677 | #t))))) | |
678 | ||
679 | (define-public perl-crypt-openssl-bignum | |
680 | (package | |
681 | (name "perl-crypt-openssl-bignum") | |
682 | (version "0.06") | |
683 | (source | |
684 | (origin | |
685 | (method url-fetch) | |
686 | (uri (string-append | |
687 | "mirror://cpan/authors/id/K/KM/KMX/Crypt-OpenSSL-Bignum-" | |
688 | version | |
689 | ".tar.gz")) | |
690 | (sha256 | |
691 | (base32 | |
692 | "05yzrdglrrzp191krf77zrwfkmzrfwrsrx1vyskbj94522lszk67")))) | |
693 | (build-system perl-build-system) | |
694 | (inputs `(("openssl" ,openssl))) | |
695 | (arguments perl-crypt-arguments) | |
696 | (home-page | |
697 | "http://search.cpan.org/dist/Crypt-OpenSSL-Bignum") | |
698 | (synopsis | |
699 | "OpenSSL's multiprecision integer arithmetic in Perl") | |
700 | (description "Crypt::OpenSSL::Bignum provides multiprecision integer | |
701 | arithmetic in Perl.") | |
702 | ;; At your option either gpl1+ or the Artistic License | |
2f3108ad | 703 | (license license:perl-license))) |
cccb4d26 DM |
704 | |
705 | (define-public perl-crypt-openssl-random | |
706 | (package | |
707 | (name "perl-crypt-openssl-random") | |
708 | (version "0.11") | |
709 | (source | |
710 | (origin | |
711 | (method url-fetch) | |
712 | (uri (string-append | |
713 | "mirror://cpan/authors/id/R/RU/RURBAN/Crypt-OpenSSL-Random-" | |
714 | version | |
715 | ".tar.gz")) | |
716 | (sha256 | |
717 | (base32 | |
718 | "0yjcabkibrkafywvdkmd1xpi6br48skyk3l15ni176wvlg38335v")))) | |
719 | (build-system perl-build-system) | |
720 | (inputs `(("openssl" ,openssl))) | |
721 | (arguments perl-crypt-arguments) | |
722 | (home-page | |
723 | "http://search.cpan.org/dist/Crypt-OpenSSL-Random") | |
724 | (synopsis | |
725 | "OpenSSL/LibreSSL pseudo-random number generator access") | |
726 | (description "Crypt::OpenSSL::Random is a OpenSSL/LibreSSL pseudo-random | |
727 | number generator") | |
2f3108ad | 728 | (license license:perl-license))) |
0581c273 LF |
729 | |
730 | (define-public acme-client | |
731 | (package | |
732 | (name "acme-client") | |
4a6b2a21 | 733 | (version "0.1.16") |
0581c273 LF |
734 | (source (origin |
735 | (method url-fetch) | |
736 | (uri (string-append "https://kristaps.bsd.lv/" name "/" | |
737 | "snapshots/" name "-portable-" | |
738 | version ".tgz")) | |
739 | (sha256 | |
740 | (base32 | |
4a6b2a21 | 741 | "00q05b3b1dfnfp7sr1nbd212n0mqrycl3cr9lbs51m7ncaihbrz9")))) |
0581c273 LF |
742 | (build-system gnu-build-system) |
743 | (arguments | |
744 | '(#:tests? #f ; no test suite | |
745 | #:make-flags | |
746 | (list "CC=gcc" | |
747 | (string-append "PREFIX=" (assoc-ref %outputs "out"))) | |
748 | #:phases | |
749 | (modify-phases %standard-phases | |
7c1a7bf4 LF |
750 | (add-after 'unpack 'patch-paths |
751 | (lambda* (#:key inputs #:allow-other-keys) | |
752 | (let ((pem (string-append (assoc-ref inputs "libressl") | |
753 | "/etc/ssl/cert.pem"))) | |
754 | (substitute* "http.c" | |
755 | (("/etc/ssl/cert.pem") pem)) | |
756 | #t))) | |
0581c273 | 757 | (delete 'configure)))) ; no './configure' script |
4b569a4f LF |
758 | (native-inputs |
759 | `(("pkg-config" ,pkg-config))) | |
0581c273 LF |
760 | (inputs |
761 | `(("libbsd" ,libbsd) | |
762 | ("libressl" ,libressl))) | |
763 | (synopsis "Let's Encrypt client by the OpenBSD project") | |
764 | (description "acme-client is a Let's Encrypt client implemented in C. It | |
765 | uses a modular design, and attempts to secure itself by dropping privileges and | |
766 | operating in a chroot where possible. acme-client is developed on OpenBSD and | |
767 | then ported to the GNU / Linux environment.") | |
768 | (home-page "https://kristaps.bsd.lv/acme-client/") | |
769 | ;; acme-client is distributed under the ISC license, but the files 'jsmn.h' | |
770 | ;; and 'jsmn.c' are distributed under the Expat license. | |
771 | (license (list license:isc license:expat)))) | |
88522738 | 772 | |
773 | ;; The "-apache" variant is the upstreamed prefered variant. A "-gpl" | |
774 | ;; variant exists in addition to the "-apache" one. | |
775 | (define-public mbedtls-apache | |
776 | (package | |
777 | (name "mbedtls-apache") | |
16ab9824 | 778 | (version "2.4.2") |
88522738 | 779 | (source |
780 | (origin | |
781 | (method url-fetch) | |
782 | ;; XXX: The download links on the website are script redirection links | |
783 | ;; which effectively lead to the format listed in the uri here. | |
784 | (uri (string-append "https://tls.mbed.org/download/mbedtls-" | |
785 | version "-apache.tgz")) | |
786 | (sha256 | |
787 | (base32 | |
16ab9824 | 788 | "065hn5zibzflivabdh9p41dknda7wicl2zhc936dmakqfjprip8p")))) |
88522738 | 789 | (build-system cmake-build-system) |
790 | (native-inputs | |
791 | `(("perl" ,perl))) | |
792 | (synopsis "Small TLS library") | |
793 | (description | |
794 | "@code{mbed TLS}, formerly known as PolarSSL, makes it trivially easy | |
795 | for developers to include cryptographic and SSL/TLS capabilities in their | |
796 | (embedded) products, facilitating this functionality with a minimal | |
797 | coding footprint.") | |
798 | (home-page "https://tls.mbed.org") | |
799 | (license license:asl2.0))) |