diff options
Diffstat (limited to 'gnu/packages/golang-crypto.scm')
-rw-r--r-- | gnu/packages/golang-crypto.scm | 393 |
1 files changed, 330 insertions, 63 deletions
diff --git a/gnu/packages/golang-crypto.scm b/gnu/packages/golang-crypto.scm index ddeb79badf..43b1356d3f 100644 --- a/gnu/packages/golang-crypto.scm +++ b/gnu/packages/golang-crypto.scm @@ -6,6 +6,7 @@ ;;; Copyright © 2020 Oleg Pykhalov <go.wigust@gmail.com> ;;; Copyright © 2020, 2022 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2021 Arun Isaac <arunisaac@systemreboot.net> +;;; Copyright © 2021 BonfaceKilz <me@bonfacemunyoki.com> ;;; Copyright © 2021 Collin J. Doering <collin@rekahsoft.ca> ;;; Copyright © 2021 LibreMiami <packaging-guix@libremiami.org> ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name> @@ -21,6 +22,7 @@ ;;; Copyright © 2023, 2024 Artyom V. Poptsov <poptsov.artyom@gmail.com> ;;; Copyright © 2024 Jesse Eisses <jesse@eisses.email> ;;; Copyright © 2024 Troy Figiel <troy@troyfigiel.com> +;;; Copyright © 2024 Jean Simard <woshilapin@tuziwo.info> ;;; ;;; This file is part of GNU Guix. ;;; @@ -45,12 +47,14 @@ #:use-module (guix packages) #:use-module (guix utils) #:use-module (gnu packages) + #:use-module (gnu packages gnupg) #:use-module (gnu packages golang) #:use-module (gnu packages golang-build) #:use-module (gnu packages golang-check) #:use-module (gnu packages golang-compression) #:use-module (gnu packages golang-web) #:use-module (gnu packages golang-xyz) + #:use-module (gnu packages password-utils) #:use-module (gnu packages specifications)) ;;; Commentary: @@ -63,10 +67,63 @@ ;;; ;;; Code: +;;; +;;; Libraries: +;;; + +(define-public go-c2sp-org-cctv-age + (package + (name "go-c2sp-org-cctv-age") + (version "0.0.0-20240306222714-3ec4d716e805") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/C2SP/CCTV") + (commit (go-version->git-ref version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "00bk05ca94lm3b029ycwj0krmg2gfjv1c3pc7dvq9gmwwzr564v5")) + (modules '((guix build utils))) + (snippet + #~(begin + ;; Sub folders containing different projects with their own + ;; licenses. + (for-each delete-file-recursively + (list "ML-KEM" "RFC6979" "ed25519" "jq255")))))) + (build-system go-build-system) + (arguments + (list + #:import-path "c2sp.org/CCTV/age" + #:unpack-path "c2sp.org/CCTV")) + (propagated-inputs + (list go-golang-org-x-crypto)) + (home-page "https://c2sp.org/CCTV/age") + (synopsis "Community Cryptography Test Vectors") + (description + "This package provides a large set of test vectors for the age file +encryption format, as well as a framework to easily generate them. + +The test suite can be applied to any age implementation, regardless of the +language it's implemented in, and the level of abstraction of its +interface. For the simplest, most universal integration, the implementation +can just attempt to decrypt the test files, check the operation only succeeds +if expect is success, and compare the decrypted payload. Test vectors +involving unimplemented features (such as passphrase encryption or armoring) +can be ignored.") + ;; age/internal/LICENSE: Redistribution and use in source and binary + ;; forms, with or without modification, are permitted provided that the + ;; following conditions are met + ;; + ;; age/README: The vectors in the testdata folder are available under the + ;; terms of the Zero-Clause BSD (reproduced below), CC0 1.0, or Unlicense + ;; license, to your choice. + (license license:cc0))) + (define-public go-filippo-io-age (package (name "go-filippo-io-age") - (version "1.1.1") + (version "1.2.0") (source (origin (method git-fetch) @@ -75,10 +132,41 @@ (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "1k1dv1jkr72qpk5g363mhrg9hnf5c9qgv4l16l13m4yh08jp271d")))) + (base32 "1dms32lxqgjipmlisng7dmy1sdw0qscj43x9lmpadyzbzc64lhrv")))) (build-system go-build-system) - (arguments `(#:import-path "filippo.io/age")) - (inputs + (arguments + (list + #:import-path "filippo.io/age" + #:phases + #~(modify-phases %standard-phases + ;; FIXME: src/c2sp.org/CCTV/age/age.go:13:12: pattern testdata: + ;; cannot embed directory testdata: contains no embeddable files + ;; + ;; This happens due to Golang can't determine the valid directory of + ;; the module which is sourced during setup environment phase, but + ;; easy resolved after coping to expected directory "vendor" within + ;; the current package, see details in Golang source: + ;; + ;; - URL: <https://github.com/golang/go/blob/> + ;; - commit: 82c14346d89ec0eeca114f9ca0e88516b2cda454 + ;; - file: src/cmd/go/internal/load/pkg.go#L2059 + (add-before 'build 'copy-input-to-vendor-directory + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (mkdir "vendor") + (copy-recursively + (string-append + #$(this-package-native-input "go-c2sp-org-cctv-age") + "/src/c2sp.org") + "vendor/c2sp.org")))) + (add-before 'install 'remove-vendor-directory + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (delete-file-recursively "vendor"))))))) + (native-inputs + (list go-c2sp-org-cctv-age + go-github-com-rogpeppe-go-internal)) + (propagated-inputs (list go-golang-org-x-sys go-golang-org-x-term go-golang-org-x-crypto @@ -92,24 +180,6 @@ It features small explicit keys, no configuration options, and Unix-style composability.") (license license:bsd-3))) -(define-public age - (package - (inherit go-filippo-io-age) - (name "age") - (arguments - `(#:import-path "filippo.io/age/cmd/age" - #:unpack-path "filippo.io/age" - #:install-source? #f)))) - -(define-public age-keygen - (package - (inherit go-filippo-io-age) - (name "age-keygen") - (arguments - `(#:import-path "filippo.io/age/cmd/age-keygen" - #:unpack-path "filippo.io/age" - #:install-source? #f)))) - (define-public go-filippo-io-edwards25519 (package (name "go-filippo-io-edwards25519") @@ -133,9 +203,9 @@ Go, exposing the necessary APIs to build a wide array of higher-level primitives.") (license license:bsd-3))) -(define-public go-github-com-99designs-go-keyring +(define-public go-github-com-99designs-keyring (package - (name "go-github-com-99designs-go-keyring") + (name "go-github-com-99designs-keyring") (version "1.2.2") (source (origin @@ -147,6 +217,30 @@ primitives.") (sha256 (base32 "0mkvy7scyq07rkqhabfmkd8imcm4h9y7zj9palj04znpihpixa5m")))) (build-system go-build-system) + (arguments + (list + #:import-path "github.com/99designs/keyring" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'disable-failing-tests + (lambda* (#:key tests? unpack-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" unpack-path) + (substitute* (find-files "." "\\_test.go$") + ;; Disable test requring running DBus. + (("TestLibSecretKeysWhenEmpty") + "OffTestLibSecretKeysWhenEmpty") + (("TestLibSecretKeysWhenNotEmpty") + "OffTestLibSecretKeysWhenNotEmpty") + (("TestLibSecretGetWhenEmpty") + "OffTestLibSecretGetWhenEmpty") + (("TestLibSecretGetWhenNotEmpty") + "OffTestLibSecretGetWhenNotEmpty") + (("TestLibSecretRemoveWhenEmpty") + "OffTestLibSecretRemoveWhenEmpty") + (("TestLibSecretRemoveWhenNotEmpty") + "OffTestLibSecretRemoveWhenNotEmpty")))))))) + (native-inputs + (list gnupg go-github-com-stretchr-testify password-store)) (propagated-inputs (list go-github-com-dvsekhvalnov-jose2go go-github-com-godbus-dbus @@ -155,9 +249,7 @@ primitives.") go-github-com-mtibben-percent go-golang-org-x-sys go-golang-org-x-term)) - (arguments - '(#:import-path "github.com/99designs/keyring" - #:tests? #f)) ;XXX: tests require Vagrant + (home-page "https://github.com/99designs/keyring") (synopsis "Go library providing a uniform interface for various secure credential stores") (description @@ -168,7 +260,6 @@ workstations. Currently Keyring supports the following backends: macOS/OSX Keychain, Windows pcredential store, Pass, Secret Service, KDE Wallet, Encrypted File.") - (home-page "https://github.com/99designs/keyring") (license license:expat))) (define-public go-github-com-aead-chacha20 @@ -291,6 +382,34 @@ the Ristretto prime-order group built from Edwards25519.") (define-public go-github-com-cespare-xxhash (package (name "go-github-com-cespare-xxhash") + (version "1.1.0") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/cespare/xxhash") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1qyzlcdcayavfazvi03izx83fvip8h36kis44zr2sg7xf6sx6l4x")))) + (build-system go-build-system) + (arguments + (list + #:import-path "github.com/cespare/xxhash")) + (propagated-inputs + (list go-github-com-spaolacci-murmur3 + go-github-com-oneofone-xxhash)) + (home-page "https://github.com/cespare/xxhash") + (synopsis "Go implementation of xxHash") + (description + "Package xxhash implements the 64-bit variant of @code{xxHash} (XXH64) as +described at @url{https://xxhash.com/}.") + (license license:expat))) + +(define-public go-github-com-cespare-xxhash-v2 + (package + (inherit go-github-com-cespare-xxhash) + (name "go-github-com-cespare-xxhash-v2") (version "2.1.2") (source (origin @@ -303,10 +422,9 @@ the Ristretto prime-order group built from Edwards25519.") (base32 "1f3wyr9msnnz94szrkmnfps9wm40s5sp9i4ak0kl92zcrkmpy29a")) (modules '((guix build utils))) (snippet '(delete-file-recursively "xxhashbench")))) - (build-system go-build-system) (arguments (list - #:import-path "github.com/cespare/xxhash" + #:import-path "github.com/cespare/xxhash/v2" #:phases #~(modify-phases %standard-phases (replace 'check @@ -315,11 +433,7 @@ the Ristretto prime-order group built from Edwards25519.") ;; The tests fail when run with gccgo. (false-if-exception (search-input-file inputs "/bin/gccgo")) (apply (assoc-ref %standard-phases 'check) args))))))) - (home-page "https://github.com/cespare/xxhash/") - (synopsis "Go implementation of xxHash") - (description "This package provides of Go implementation of the 64-bit -xxHash algorithm (XXH64).") - (license license:expat))) + (propagated-inputs '()))) (define-public go-github-com-chmduquesne-rollinghash (let ((commit "9a5199be7309f50c496efc87d29bd08788605ae7") @@ -411,10 +525,36 @@ and encrypting JSON Web Tokens (JWT). It relies only on the standard library.") (license license:expat))) +(define-public go-github-com-emersion-go-bcrypt + (package + (name "go-github-com-emersion-go-bcrypt") + (version "0.0.0-20170822072041-6e724a1baa63") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/emersion/go-bcrypt") + (commit (go-version->git-ref version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1pchrgs05w30iqbh4d6iys4wvlyajsdwchp5mkf59amgsbyjaqgm")))) + (build-system go-build-system) + (arguments + (list + #:import-path "github.com/emersion/go-bcrypt")) + (propagated-inputs + (list go-golang-org-x-crypto)) + (home-page "https://github.com/emersion/go-bcrypt") + (synopsis "Extract of bcrypt from golang.org/x/crypto/bcrypt") + (description + "This package provides an extract @code{bcrypt} from +@code{golang.org/x/crypto/bcrypt}.") + (license license:bsd-3))) + (define-public go-github-com-emersion-go-pgpmail (package (name "go-github-com-emersion-go-pgpmail") - (version "0.2.0") + (version "0.2.1") (source (origin (method git-fetch) @@ -423,17 +563,14 @@ library.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0ar26b0apw5bxn58qfn1a79cxigbmrqm1irh1rb7x57fydihc7wm")))) + (base32 "1fiqpdwxnfba2cgij7j83dfqc0zz4mq95x15wicgm5f3vjr1xg5h")))) (build-system go-build-system) (arguments - (list ;; tests don't support our version of protonmail/go-crypto; see - ;; <https://github.com/emersion/go-pgpmail/issues/12> - #:tests? #f + (list #:import-path "github.com/emersion/go-pgpmail")) (propagated-inputs (list go-github-com-emersion-go-message go-github-com-protonmail-go-crypto - go-golang-org-x-crypto go-golang-org-x-text)) (home-page "https://github.com/emersion/go-pgpmail") (synopsis "PGP mail encryption for Go") @@ -575,9 +712,50 @@ RSA, RSA-PSS, and ECDSA, though hooks are present for adding your own.") (base32 "0px12zhdmzqjj5zlcr136rcsilpmi4chiz6arxv49q372j4nhmia")))) (arguments (list - #:go go-1.18 #:import-path "github.com/golang-jwt/jwt/v5")))) +(define-public go-github-com-google-go-tpm + (package + (name "go-github-com-google-go-tpm") + (version "0.9.1") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/google/go-tpm") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1c5j5cvwl45ka93nknmv454ivd7kp9n8yql19gr6z01z0s1ph7sg")))) + (build-system go-build-system) + (arguments + (list + #:go go-1.22 + #:import-path "github.com/google/go-tpm" + #:phases + #~(modify-phases %standard-phases + ;; XXX: Break cycle: + ;; github.com/google/go-tpm/tpm2/transport/simulator/simulator.go -> + ;; github.com/google/go-tpm-tools -> github.com/google/go-tpm. + ;; Consider to add required inputs on dependent package. + (delete 'build) + (delete 'check)))) + (home-page "https://github.com/google/go-tpm") + (synopsis "Go-TPM Legacy TPM 2.0 library") + (description + "This package provides a functionality to communicate directly with a +@acronym{Trusted Platform Module, TPM} device. The libraries don't implement +the entire spec for neither 1.2 nor 2.0. + +Included submodules: +@itemize +@item @code{tpm} - TPM 1.2 client library +@item @code{tpm2} - TPM 2.0 client library. +@item @code{direct} - the prototype \"TPMDirect\" TPM 2.0 API, which is +intended to (eventually) be 1:1 with the TPM 2.0 spec +@end itemize") + (license license:asl2.0))) + ;; It's not public for purpose, as it contains a lot of golang modules which ;; may be inherited from the single source, but the package itself does not ;; have to be installed directly or linked to other packages.. @@ -931,8 +1109,7 @@ Architecture Processors\" by J. Guilford et al.") (base32 "0ydh94083888xl2r4d1grzgqf3c818mkmdpj008jkh6h7m56wc4w")))) (build-system go-build-system) (arguments - (list #:go go-1.21 - #:import-path "github.com/multiformats/go-multihash" + (list #:import-path "github.com/multiformats/go-multihash" #:phases #~(modify-phases %standard-phases (add-after 'unpack 'copy-multibase-specs @@ -962,6 +1139,37 @@ Architecture Processors\" by J. Guilford et al.") (description "Multihash implementation in Go.") (license license:expat))) +(define-public go-github-com-oneofone-xxhash + (package + (name "go-github-com-oneofone-xxhash") + (version "1.2.8") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/OneOfOne/xxhash") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0f98qk83l2fhpclvrgyxsa9b8m4pipf11fah85bnjl01wy4lvybw")))) + (build-system go-build-system) + (arguments + (list + #:import-path "github.com/OneOfOne/xxhash" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-benchmarks + (lambda* (#:key import-path #:allow-other-keys) + (delete-file-recursively + (string-append "src/" import-path "/benchmarks"))))))) + (home-page "https://github.com/OneOfOne/xxhash") + (synopsis "Go implementation of xxHash") + (description + "This is a native Go implementation of the +@url{https://github.com/Cyan4973/xxHash, xxHash} algorithm, an extremely fast +non-cryptographic hash algorithm, working at speeds close to RAM limits.") + (license license:asl2.0))) + (define-public go-github-com-operatorfoundation-ed25519 (let ((commit "b22b4bd3ddef042eec45f3ee135cd40281fde2b4") (revision "0")) @@ -1021,38 +1229,46 @@ algorithm.") (define-public go-github-com-protonmail-go-crypto (package (name "go-github-com-protonmail-go-crypto") - (version "0.0.0-20220623141421-5afb4c282135") + (version "1.0.0") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/ProtonMail/go-crypto") - (commit (go-version->git-ref version)))) + (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "05qxdbn8wdk901z5kw2r3jdrag58nxlcsy0p8xd6rq0d71sw94wy")))) + (base32 "11q94983r6zjrdvflpikms4773a9s5vb9gg4qw1rj5800yhhah0n")))) (build-system go-build-system) (arguments - (list #:import-path "github.com/ProtonMail/go-crypto" - #:tests? #f ; Source-only package. - #:phases - #~(modify-phases %standard-phases - ;; Source-only package. - (delete 'build)))) + (list + #:import-path "github.com/ProtonMail/go-crypto" + #:phases + #~(modify-phases %standard-phases + ;; XXX: Workaround for go-build-system's lack of Go modules + ;; support. + (delete 'build) + (replace 'check + (lambda* (#:key tests? import-path #:allow-other-keys) + (when tests? + (with-directory-excursion (string-append "src/" import-path) + (invoke "go" "test" "-v" "./...")))))))) (propagated-inputs - (list go-golang-org-x-crypto)) + (list go-github-com-cloudflare-circl + go-golang-org-x-crypto)) (home-page "https://github.com/ProtonMail/go-crypto") (synopsis "Fork of x/crypto with up-to-date OpenPGP implementation") - (description "This package provides cryptography for Go. This version of -the package is a fork that adds a more up-to-date OpenPGP implementation. It -is completely backwards compatible with @code{golang.org/x/crypto}, the -official package.") + (description + "This package provides cryptography for Go. This version of the package +is a fork that adds a more up-to-date OpenPGP implementation. It is +completely backwards compatible with @code{golang.org/x/crypto}, the official +package.") (license license:bsd-3))) (define-public go-github-com-quic-go-qtls-go1-20 (package (name "go-github-com-quic-go-qtls-go1-20") - (version "0.3.4") + (version "0.4.1") (source (origin (method git-fetch) @@ -1061,12 +1277,13 @@ official package.") (commit (string-append "v" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "0fl3yv1w8cygag3lav45vvzb4k9i72p92x13wcq0xn13wxirzirn")))) + (base32 "069rknxpg7d0dmxc4akq2mw7wm5bi0420nshykf2iclvmbcg9ajh")))) (build-system go-build-system) (arguments (list - #:import-path "github.com/quic-go/qtls-go1-20" - #:go go-1.20)) + ;; XXX: panic: qtls.ClientSessionState doesn't match, with Golang 1.20+. + #:go go-1.20 + #:import-path "github.com/quic-go/qtls-go1-20")) (propagated-inputs (list go-golang-org-x-crypto go-golang-org-x-sys)) @@ -1092,7 +1309,6 @@ QUIC. For Go 1.20.") (build-system go-build-system) (arguments `(#:import-path "github.com/refraction-networking/utls" - #:go ,go-1.20 #:tests? #f)) ;requires internet access (propagated-inputs (list go-github-com-andybalholm-brotli @@ -1325,6 +1541,57 @@ performance for large inputs and outputs.") (description "GoPtLib is a library for writing Tor pluggable transports in Go.") (license license:cc0))) + +;;; +;;; Executables: +;;; + +(define-public age + (package + (inherit go-filippo-io-age) + (name "age") + (arguments + (list + #:install-source? #f + #:import-path "filippo.io/age/cmd/age" + #:unpack-path "filippo.io/age" + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'remove-failing-test-data-files + ;; FIXME: testdata/output_file.txt:49: unknown command "ttyin" + ;; age: error: input and output file are the same: "inputcopy" + ;; age: error: input and output file are the same: "./inputcopy" + ;; age: error: input and output file are the same: "keycopy" + (lambda* (#:key import-path #:allow-other-keys) + (with-directory-excursion (string-append "src/" import-path) + (for-each delete-file + (list "testdata/scrypt.txt" + "testdata/output_file.txt" + "testdata/encrypted_keys.txt" + "testdata/terminal.txt")))))))))) + +(define-public age-keygen + (package + (inherit go-filippo-io-age) + (name "age-keygen") + (arguments + `(#:import-path "filippo.io/age/cmd/age-keygen" + #:unpack-path "filippo.io/age" + #:install-source? #f)))) + +(define-public go-keyring + (package + (inherit go-github-com-99designs-keyring) + (name "go-keyring") + (arguments + (list + #:install-source? #f + #:import-path "github.com/99designs/keyring/cmd/keyring" + #:unpack-path "github.com/99designs/keyring")) + (description + (string-append (package-description go-github-com-99designs-keyring) + " This package provides an command line interface (CLI) +tool.")))) ;;; ;;; Avoid adding new packages to the end of this file. To reduce the chances |