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