gnu: perl-email-abstract: Update to 3.009.
[jackhill/guix/guix.git] / gnu / packages / nettle.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
0be199c9 2;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3abaca2a 3;;; Copyright © 2016, 2021 Mark H Weaver <mhw@netris.org>
3b2098d9 4;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
cf86b9af 5;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
2e659827 6;;;
233e7676 7;;; This file is part of GNU Guix.
2e659827 8;;;
233e7676 9;;; GNU Guix is free software; you can redistribute it and/or modify it
2e659827
LC
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
233e7676 14;;; GNU Guix is distributed in the hope that it will be useful, but
2e659827
LC
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
233e7676 20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
2e659827 21
1ffa7090 22(define-module (gnu packages nettle)
2891974c 23 #:use-module (guix utils)
4a44e743 24 #:use-module (guix licenses)
2e659827
LC
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
3abaca2a 28 #:use-module (gnu packages)
1ffa7090
LC
29 #:use-module (gnu packages multiprecision)
30 #:use-module (gnu packages m4))
2e659827 31
0be199c9 32(define-public nettle-2
2e659827
LC
33 (package
34 (name "nettle")
b17fd5e0 35 (version "2.7.1")
2a6c6795
LC
36 (source (origin
37 (method url-fetch)
38 (uri (string-append "mirror://gnu/nettle/nettle-"
39 version ".tar.gz"))
40 (sha256
41 (base32
b17fd5e0 42 "0h2vap31yvi1a438d36lg1r1nllfx3y19r4rfxv7slrm6kafnwdw"))))
2e659827 43 (build-system gnu-build-system)
64cc58b2
LC
44 (arguments
45 ;; 'sexp-conv' and other programs need to have their RUNPATH point to
46 ;; $libdir, which is not the case by default. Work around it.
47 '(#:configure-flags (list (string-append "LDFLAGS=-Wl,-rpath="
48 (assoc-ref %outputs "out")
b4052c96
MB
49 "/lib"))
50 #:phases (modify-phases %standard-phases
51 (add-after 'install 'move-static-libraries
52 (lambda* (#:key outputs #:allow-other-keys)
53 (let ((out (assoc-ref outputs "out"))
54 (slib (string-append (assoc-ref outputs "static")
55 "/lib")))
56 (mkdir-p slib)
57 (with-directory-excursion (string-append out "/lib")
58 (for-each (lambda (ar)
59 (rename-file ar (string-append
60 slib "/"
61 (basename ar))))
62 (find-files "." "\\.a$")))
63 #t))))))
64 (outputs '("out" "debug" "static"))
64cc58b2 65 (native-inputs `(("m4" ,m4)))
2e659827 66 (propagated-inputs `(("gmp" ,gmp)))
31bd09e5 67 (home-page "https://www.lysator.liu.se/~nisse/nettle/")
79c311b8 68 (synopsis "C library for low-level cryptographic functionality")
2e659827 69 (description
79c311b8
LC
70 "GNU Nettle is a low-level cryptographic library. It is designed to
71fit in easily in almost any context. It can be easily included in
72cryptographic toolkits for object-oriented languages or in applications
73themselves.")
4a44e743 74 (license gpl2+)))
39ed6749 75
cf86b9af 76(define-public nettle-3.5
1511e023 77 ;; This version is not API-compatible with version 2. In particular, lsh
39ed6749 78 ;; cannot use it yet. So keep it separate.
0be199c9 79 (package (inherit nettle-2)
6c6e56fe 80 (version "3.5.1")
3abaca2a 81 (replacement nettle-3.5/fixed)
39ed6749
LC
82 (source (origin
83 (method url-fetch)
84 (uri (string-append "mirror://gnu/nettle/nettle-"
85 version ".tar.gz"))
86 (sha256
87 (base32
6c6e56fe 88 "06clvkdfxhlbagn4afssylmn5vrak59dlmnvy8b2xc31hycs3k3m"))))
2891974c 89 (arguments
42395bf5
MW
90 (substitute-keyword-arguments (package-arguments nettle-2)
91 ((#:configure-flags flags)
92 ;; Build "fat" binaries where the right implementation is chosen
93 ;; at run time based on CPU features (starting from 3.1.)
94 `(cons "--enable-fat" ,flags))))))
cf86b9af 95
3abaca2a
MW
96(define nettle-3.5/fixed
97 (package-with-extra-patches
98 nettle-3.5
99 (search-patches "nettle-3.5-check-_pkcs1_sec_decrypt-msg-len.patch"
100 "nettle-3.5-CVE-2021-3580-pt1.patch"
101 "nettle-3.5-CVE-2021-3580-pt2.patch")))
102
cf86b9af
MC
103(define-public nettle-3.7
104 (package (inherit nettle-3.5)
26ac7d02 105 (version "3.7.3")
cf86b9af
MC
106 (source (origin
107 (method url-fetch)
108 (uri (string-append "mirror://gnu/nettle/nettle-"
109 version ".tar.gz"))
110 (sha256
111 (base32
26ac7d02 112 "1w5wwc3q0r97d2ifhx77cw7y8s20bm8x52is9j93p2h47yq5w7v6"))))))
cf86b9af
MC
113
114;;; Upgrading Nettle on master would cause 10000+ packages to be rebuilt.
115(define-public nettle nettle-3.5)