From d804107382bd9b03074dcb4fa6a7050c67d27e8a Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Tue, 18 Oct 2022 20:51:08 +0100 Subject: [PATCH 01/13] use net.LookupPort to resolve port numbers --- ssh/tcpip.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 80d35f5ec1..71383d1adc 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -343,11 +343,11 @@ func (c *Client) Dial(n, addr string) (net.Conn, error) { if err != nil { return nil, err } - port, err := strconv.ParseUint(portString, 10, 16) + port, err := net.LookupPort(portString) if err != nil { return nil, err } - ch, err = c.dial(net.IPv4zero.String(), 0, host, int(port)) + ch, err = c.dial(net.IPv4zero.String(), 0, host, port) if err != nil { return nil, err } From 4ad08cccd29ed468e18dc555d930226f76405f7a Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Fri, 6 Oct 2023 11:59:54 +0200 Subject: [PATCH 02/13] add tests --- ssh/tcpip.go | 2 +- ssh/tcpip_test.go | 58 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 71383d1adc..af6f1e6648 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -343,7 +343,7 @@ func (c *Client) Dial(n, addr string) (net.Conn, error) { if err != nil { return nil, err } - port, err := net.LookupPort(portString) + port, err := net.LookupPort(n, portString) if err != nil { return nil, err } diff --git a/ssh/tcpip_test.go b/ssh/tcpip_test.go index f1265cb496..6b8ca42504 100644 --- a/ssh/tcpip_test.go +++ b/ssh/tcpip_test.go @@ -5,6 +5,7 @@ package ssh import ( + "fmt" "testing" ) @@ -18,3 +19,60 @@ func TestAutoPortListenBroken(t *testing.T) { t.Errorf("version %q marked as broken", works) } } + +func TestDialNamedPort(t *testing.T) { + // Test that sshClient.Dial supports named ports. + + srvConn, clientConn, err := netPipe() + if err != nil { + t.Fatalf("netPipe: %v", err) + } + + serverConf := &ServerConfig{ + NoClientAuth: true, + } + serverConf.AddHostKey(testSigners["rsa"]) + srvErr := make(chan error, 1) + go func() { + defer close(srvErr) + _, chans, req, err := NewServerConn(srvConn, serverConf) + if err != nil { + srvErr <- fmt.Errorf("NewServerConn: %w", err) + return + } + go DiscardRequests(req) + for newChan := range chans { + ch, reqs, err := newChan.Accept() + if err != nil { + srvErr <- fmt.Errorf("Accept: %w", err) + } + go DiscardRequests(reqs) + ch.Close() + } + }() + + clientConf := &ClientConfig{ + User: "testuser", + HostKeyCallback: InsecureIgnoreHostKey(), + } + + sshClientConn, newChans, reqs, err := NewClientConn(clientConn, "", clientConf) + if err != nil { + t.Fatal(err) + } + sshClient := NewClient(sshClientConn, newChans, reqs) + + // port being a named port `ssh` is the main point of the test. + tcpipconn, err := sshClient.Dial("tcp", "localhost:ssh") + if err != nil { + t.Fatal(err) + } + tcpipconn.Close() + + srvConn.Close() + clientConn.Close() + + for err := range srvErr { + t.Errorf("ssh server: %s", err) + } +} From e37048c910ca6292edb5c192396ee993a1121537 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Wed, 11 Oct 2023 14:58:43 +0200 Subject: [PATCH 03/13] use explicit timeout with context --- ssh/tcpip.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index af6f1e6648..217bbd5361 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -5,6 +5,7 @@ package ssh import ( + "context" "errors" "fmt" "io" @@ -335,6 +336,9 @@ func (l *tcpListener) Addr() net.Addr { // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). func (c *Client) Dial(n, addr string) (net.Conn, error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + var ch Channel switch n { case "tcp", "tcp4", "tcp6": @@ -343,7 +347,7 @@ func (c *Client) Dial(n, addr string) (net.Conn, error) { if err != nil { return nil, err } - port, err := net.LookupPort(n, portString) + port, err := net.DefaultResolver.LookupPort(ctx, n, portString) if err != nil { return nil, err } From 3cddb69af10bb3d9faef335ea9927f98ae55bf36 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Wed, 11 Oct 2023 16:22:08 +0200 Subject: [PATCH 04/13] revert the introduction of context --- ssh/tcpip.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 217bbd5361..af6f1e6648 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -5,7 +5,6 @@ package ssh import ( - "context" "errors" "fmt" "io" @@ -336,9 +335,6 @@ func (l *tcpListener) Addr() net.Addr { // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). func (c *Client) Dial(n, addr string) (net.Conn, error) { - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - var ch Channel switch n { case "tcp", "tcp4", "tcp6": @@ -347,7 +343,7 @@ func (c *Client) Dial(n, addr string) (net.Conn, error) { if err != nil { return nil, err } - port, err := net.DefaultResolver.LookupPort(ctx, n, portString) + port, err := net.LookupPort(n, portString) if err != nil { return nil, err } From 41a84b0133cd8f39691362dd79da2a3f7815fdf9 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Wed, 11 Oct 2023 16:31:56 +0200 Subject: [PATCH 05/13] add channel type and port checks to the test --- ssh/tcpip_test.go | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/ssh/tcpip_test.go b/ssh/tcpip_test.go index 6b8ca42504..56d0ad7170 100644 --- a/ssh/tcpip_test.go +++ b/ssh/tcpip_test.go @@ -20,6 +20,13 @@ func TestAutoPortListenBroken(t *testing.T) { } } +type directTCPIPPayload struct { + Addr string + Port uint32 + OriginAddr string + OriginPort uint32 +} + func TestDialNamedPort(t *testing.T) { // Test that sshClient.Dial supports named ports. @@ -32,7 +39,7 @@ func TestDialNamedPort(t *testing.T) { NoClientAuth: true, } serverConf.AddHostKey(testSigners["rsa"]) - srvErr := make(chan error, 1) + srvErr := make(chan error, 10) go func() { defer close(srvErr) _, chans, req, err := NewServerConn(srvConn, serverConf) @@ -42,6 +49,17 @@ func TestDialNamedPort(t *testing.T) { } go DiscardRequests(req) for newChan := range chans { + if newChan.ChannelType() != "direct-tcpip" { + srvErr <- fmt.Errorf("expected direct-tcpip channel, got=%s", newChan.ChannelType()) + } + data := directTCPIPPayload{} + if err := Unmarshal(newChan.ExtraData(), &data); err != nil { + srvErr <- err + } + // Below we dial for service `ssh` which should be translated to 22. + if data.Port != 22 { + srvErr <- fmt.Errorf("expected port 22 got=%d", data.Port) + } ch, reqs, err := newChan.Accept() if err != nil { srvErr <- fmt.Errorf("Accept: %w", err) From d219d02c0daef943bd8c5a34d07fd4b02bcf14f6 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Tue, 10 Oct 2023 17:49:56 -0400 Subject: [PATCH 06/13] all: update go directive to 1.18 Done with: go get go@1.18 go mod tidy go fix ./... Using go1.21.3. Also update avo to v0.5.0 in the curve25519/internal/field/_asm module. It's newer and produces no diff in the generated code. For golang/go#60268. Change-Id: I9bd771ee8561595d7f68aaca76df6e3e33d35013 Reviewed-on: https://go-review.googlesource.com/c/crypto/+/534141 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Auto-Submit: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov --- acme/version_go112.go | 1 - argon2/blamka_amd64.go | 1 - argon2/blamka_amd64.s | 1 - argon2/blamka_ref.go | 1 - blake2b/blake2bAVX2_amd64.go | 1 - blake2b/blake2bAVX2_amd64.s | 1 - blake2b/blake2b_amd64.go | 1 - blake2b/blake2b_amd64.s | 1 - blake2b/blake2b_ref.go | 1 - blake2b/register.go | 1 - blake2s/blake2s_386.go | 1 - blake2s/blake2s_386.s | 1 - blake2s/blake2s_amd64.go | 1 - blake2s/blake2s_amd64.s | 1 - blake2s/blake2s_ref.go | 1 - blake2s/register.go | 1 - chacha20/chacha_arm64.go | 1 - chacha20/chacha_arm64.s | 1 - chacha20/chacha_noasm.go | 1 - chacha20/chacha_ppc64le.go | 1 - chacha20/chacha_ppc64le.s | 1 - chacha20/chacha_s390x.go | 1 - chacha20/chacha_s390x.s | 1 - chacha20poly1305/chacha20poly1305_amd64.go | 1 - chacha20poly1305/chacha20poly1305_amd64.s | 1 - chacha20poly1305/chacha20poly1305_noasm.go | 1 - curve25519/internal/field/_asm/go.mod | 14 +++-- curve25519/internal/field/_asm/go.sum | 61 +++++++++++++-------- curve25519/internal/field/fe_amd64.go | 1 - curve25519/internal/field/fe_amd64.s | 1 - curve25519/internal/field/fe_amd64_noasm.go | 1 - curve25519/internal/field/fe_arm64.go | 1 - curve25519/internal/field/fe_arm64.s | 1 - curve25519/internal/field/fe_arm64_noasm.go | 1 - go.mod | 2 +- go.sum | 33 ----------- internal/alias/alias.go | 1 - internal/alias/alias_purego.go | 1 - internal/poly1305/bits_compat.go | 1 - internal/poly1305/bits_go1.13.go | 1 - internal/poly1305/mac_noasm.go | 1 - internal/poly1305/sum_amd64.go | 1 - internal/poly1305/sum_amd64.s | 1 - internal/poly1305/sum_ppc64le.go | 1 - internal/poly1305/sum_ppc64le.s | 1 - internal/poly1305/sum_s390x.go | 1 - internal/poly1305/sum_s390x.s | 1 - internal/wycheproof/eddsa_test.go | 1 - ocsp/ocsp_test.go | 1 - otr/libotr_test_helper.c | 2 +- salsa20/salsa/salsa20_amd64.go | 1 - salsa20/salsa/salsa20_amd64.s | 1 - salsa20/salsa/salsa20_amd64_test.go | 1 - salsa20/salsa/salsa20_noasm.go | 1 - sha3/hashes_generic.go | 1 - sha3/keccakf.go | 1 - sha3/keccakf_amd64.go | 1 - sha3/keccakf_amd64.s | 1 - sha3/register.go | 1 - sha3/sha3_s390x.go | 1 - sha3/sha3_s390x.s | 1 - sha3/shake_generic.go | 1 - sha3/xor.go | 1 - sha3/xor_unaligned.go | 2 - ssh/test/agent_unix_test.go | 1 - ssh/test/banner_test.go | 1 - ssh/test/cert_test.go | 1 - ssh/test/dial_unix_test.go | 1 - ssh/test/forward_unix_test.go | 1 - ssh/test/multi_auth_test.go | 1 - ssh/test/session_test.go | 1 - ssh/test/sshd_test_pw.c | 2 +- ssh/test/test_unix_test.go | 1 - x509roots/gen_fallback_bundle.go | 1 - 74 files changed, 52 insertions(+), 131 deletions(-) diff --git a/acme/version_go112.go b/acme/version_go112.go index b9efdb59e5..cc5fab604b 100644 --- a/acme/version_go112.go +++ b/acme/version_go112.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.12 -// +build go1.12 package acme diff --git a/argon2/blamka_amd64.go b/argon2/blamka_amd64.go index a014ac92aa..063e7784f8 100644 --- a/argon2/blamka_amd64.go +++ b/argon2/blamka_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego package argon2 diff --git a/argon2/blamka_amd64.s b/argon2/blamka_amd64.s index b2cc051504..f3b653a12f 100644 --- a/argon2/blamka_amd64.s +++ b/argon2/blamka_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/argon2/blamka_ref.go b/argon2/blamka_ref.go index 167c59d2d5..16d58c650e 100644 --- a/argon2/blamka_ref.go +++ b/argon2/blamka_ref.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc -// +build !amd64 purego !gc package argon2 diff --git a/blake2b/blake2bAVX2_amd64.go b/blake2b/blake2bAVX2_amd64.go index 56bfaaa17d..4f506f8791 100644 --- a/blake2b/blake2bAVX2_amd64.go +++ b/blake2b/blake2bAVX2_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.7 && amd64 && gc && !purego -// +build go1.7,amd64,gc,!purego package blake2b diff --git a/blake2b/blake2bAVX2_amd64.s b/blake2b/blake2bAVX2_amd64.s index 4b9daa18d9..353bb7cac5 100644 --- a/blake2b/blake2bAVX2_amd64.s +++ b/blake2b/blake2bAVX2_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.7 && amd64 && gc && !purego -// +build go1.7,amd64,gc,!purego #include "textflag.h" diff --git a/blake2b/blake2b_amd64.go b/blake2b/blake2b_amd64.go index 5fa1b32841..1d0770abba 100644 --- a/blake2b/blake2b_amd64.go +++ b/blake2b/blake2b_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.7 && amd64 && gc && !purego -// +build !go1.7,amd64,gc,!purego package blake2b diff --git a/blake2b/blake2b_amd64.s b/blake2b/blake2b_amd64.s index ae75eb9afc..adfac00c15 100644 --- a/blake2b/blake2b_amd64.s +++ b/blake2b/blake2b_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/blake2b/blake2b_ref.go b/blake2b/blake2b_ref.go index b0137cdf02..6e28668cd1 100644 --- a/blake2b/blake2b_ref.go +++ b/blake2b/blake2b_ref.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc -// +build !amd64 purego !gc package blake2b diff --git a/blake2b/register.go b/blake2b/register.go index 9d8633963c..d9fcac3a4d 100644 --- a/blake2b/register.go +++ b/blake2b/register.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.9 -// +build go1.9 package blake2b diff --git a/blake2s/blake2s_386.go b/blake2s/blake2s_386.go index b4463fb4dc..97f629617e 100644 --- a/blake2s/blake2s_386.go +++ b/blake2s/blake2s_386.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && gc && !purego -// +build 386,gc,!purego package blake2s diff --git a/blake2s/blake2s_386.s b/blake2s/blake2s_386.s index 603d00ca32..919c026541 100644 --- a/blake2s/blake2s_386.s +++ b/blake2s/blake2s_386.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build 386 && gc && !purego -// +build 386,gc,!purego #include "textflag.h" diff --git a/blake2s/blake2s_amd64.go b/blake2s/blake2s_amd64.go index becdaa120f..8a7310254e 100644 --- a/blake2s/blake2s_amd64.go +++ b/blake2s/blake2s_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego package blake2s diff --git a/blake2s/blake2s_amd64.s b/blake2s/blake2s_amd64.s index e9df7a7c21..fe4b818a33 100644 --- a/blake2s/blake2s_amd64.s +++ b/blake2s/blake2s_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/blake2s/blake2s_ref.go b/blake2s/blake2s_ref.go index 799dba0c41..38ce8e283f 100644 --- a/blake2s/blake2s_ref.go +++ b/blake2s/blake2s_ref.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!amd64 && !386) || !gc || purego -// +build !amd64,!386 !gc purego package blake2s diff --git a/blake2s/register.go b/blake2s/register.go index ef79ff3c67..3156148a42 100644 --- a/blake2s/register.go +++ b/blake2s/register.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.9 -// +build go1.9 package blake2s diff --git a/chacha20/chacha_arm64.go b/chacha20/chacha_arm64.go index 5dfacbb983..661ea132e0 100644 --- a/chacha20/chacha_arm64.go +++ b/chacha20/chacha_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/chacha20/chacha_arm64.s b/chacha20/chacha_arm64.s index f1f66230d1..7dd2638e88 100644 --- a/chacha20/chacha_arm64.s +++ b/chacha20/chacha_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/chacha20/chacha_noasm.go b/chacha20/chacha_noasm.go index 02ff3d05e9..db42e6676a 100644 --- a/chacha20/chacha_noasm.go +++ b/chacha20/chacha_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!arm64 && !s390x && !ppc64le) || !gc || purego -// +build !arm64,!s390x,!ppc64le !gc purego package chacha20 diff --git a/chacha20/chacha_ppc64le.go b/chacha20/chacha_ppc64le.go index da420b2e97..3a4287f990 100644 --- a/chacha20/chacha_ppc64le.go +++ b/chacha20/chacha_ppc64le.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/chacha20/chacha_ppc64le.s b/chacha20/chacha_ppc64le.s index 5c0fed26f8..66aebae258 100644 --- a/chacha20/chacha_ppc64le.s +++ b/chacha20/chacha_ppc64le.s @@ -20,7 +20,6 @@ // due to the calling conventions and initialization of constants. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/chacha20/chacha_s390x.go b/chacha20/chacha_s390x.go index 4652247b8a..683ccfd1c3 100644 --- a/chacha20/chacha_s390x.go +++ b/chacha20/chacha_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20 diff --git a/chacha20/chacha_s390x.s b/chacha20/chacha_s390x.s index f3ef5a019d..1eda91a3d4 100644 --- a/chacha20/chacha_s390x.s +++ b/chacha20/chacha_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "go_asm.h" #include "textflag.h" diff --git a/chacha20poly1305/chacha20poly1305_amd64.go b/chacha20poly1305/chacha20poly1305_amd64.go index 0c408c5709..50695a14f6 100644 --- a/chacha20poly1305/chacha20poly1305_amd64.go +++ b/chacha20poly1305/chacha20poly1305_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package chacha20poly1305 diff --git a/chacha20poly1305/chacha20poly1305_amd64.s b/chacha20poly1305/chacha20poly1305_amd64.s index 867c181a14..541d696b67 100644 --- a/chacha20poly1305/chacha20poly1305_amd64.s +++ b/chacha20poly1305/chacha20poly1305_amd64.s @@ -5,7 +5,6 @@ // This file was originally from https://golang.org/cl/24717 by Vlad Krasnov of CloudFlare. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" // General register allocation diff --git a/chacha20poly1305/chacha20poly1305_noasm.go b/chacha20poly1305/chacha20poly1305_noasm.go index f832b33d45..34e6ab1df8 100644 --- a/chacha20poly1305/chacha20poly1305_noasm.go +++ b/chacha20poly1305/chacha20poly1305_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || !gc || purego -// +build !amd64 !gc purego package chacha20poly1305 diff --git a/curve25519/internal/field/_asm/go.mod b/curve25519/internal/field/_asm/go.mod index 5b3dba315e..bf6dbc73cd 100644 --- a/curve25519/internal/field/_asm/go.mod +++ b/curve25519/internal/field/_asm/go.mod @@ -1,10 +1,16 @@ module asm -go 1.16 +go 1.18 require ( - github.com/mmcloughlin/avo v0.4.0 - golang.org/x/crypto v0.0.0 + github.com/mmcloughlin/avo v0.5.0 + golang.org/x/crypto v0.1.0 ) -replace golang.org/x/crypto v0.0.0 => ../../../.. +require ( + golang.org/x/mod v0.8.0 // indirect + golang.org/x/sys v0.13.0 // indirect + golang.org/x/tools v0.6.0 // indirect +) + +replace golang.org/x/crypto v0.1.0 => ../../../.. diff --git a/curve25519/internal/field/_asm/go.sum b/curve25519/internal/field/_asm/go.sum index 4c9bbf675b..3f57ad913c 100644 --- a/curve25519/internal/field/_asm/go.sum +++ b/curve25519/internal/field/_asm/go.sum @@ -1,34 +1,51 @@ -github.com/mmcloughlin/avo v0.4.0 h1:jeHDRktVD+578ULxWpQHkilor6pkdLF7u7EiTzDbfcU= -github.com/mmcloughlin/avo v0.4.0/go.mod h1:RW9BfYA3TgO9uCdNrKU2h6J8cPD8ZLznvfgHAeszb1s= -github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= +github.com/mmcloughlin/avo v0.5.0 h1:nAco9/aI9Lg2kiuROBY6BhCI/z0t5jEvJfjWbL8qXLU= +github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/arch v0.1.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo= -golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211030160813-b3129d9d1021 h1:giLT+HuUP/gXYrG2Plg9WTjj4qhfgaW424ZIFog3rlk= -golang.org/x/sys v0.0.0-20211030160813-b3129d9d1021/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= +golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= +golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.7 h1:6j8CgantCy3yc8JGBqkDLMKWqZ0RDU2g1HVgacojGWQ= -golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/curve25519/internal/field/fe_amd64.go b/curve25519/internal/field/fe_amd64.go index edcf163c4e..70c541692c 100644 --- a/curve25519/internal/field/fe_amd64.go +++ b/curve25519/internal/field/fe_amd64.go @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego package field diff --git a/curve25519/internal/field/fe_amd64.s b/curve25519/internal/field/fe_amd64.s index 293f013c94..60817acc41 100644 --- a/curve25519/internal/field/fe_amd64.s +++ b/curve25519/internal/field/fe_amd64.s @@ -1,7 +1,6 @@ // Code generated by command: go run fe_amd64_asm.go -out ../fe_amd64.s -stubs ../fe_amd64.go -pkg field. DO NOT EDIT. //go:build amd64 && gc && !purego -// +build amd64,gc,!purego #include "textflag.h" diff --git a/curve25519/internal/field/fe_amd64_noasm.go b/curve25519/internal/field/fe_amd64_noasm.go index ddb6c9b8f7..9da280d1d8 100644 --- a/curve25519/internal/field/fe_amd64_noasm.go +++ b/curve25519/internal/field/fe_amd64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || !gc || purego -// +build !amd64 !gc purego package field diff --git a/curve25519/internal/field/fe_arm64.go b/curve25519/internal/field/fe_arm64.go index af459ef515..075fe9b925 100644 --- a/curve25519/internal/field/fe_arm64.go +++ b/curve25519/internal/field/fe_arm64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego package field diff --git a/curve25519/internal/field/fe_arm64.s b/curve25519/internal/field/fe_arm64.s index 5c91e45892..3126a43419 100644 --- a/curve25519/internal/field/fe_arm64.s +++ b/curve25519/internal/field/fe_arm64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build arm64 && gc && !purego -// +build arm64,gc,!purego #include "textflag.h" diff --git a/curve25519/internal/field/fe_arm64_noasm.go b/curve25519/internal/field/fe_arm64_noasm.go index 234a5b2e5d..fc029ac12d 100644 --- a/curve25519/internal/field/fe_arm64_noasm.go +++ b/curve25519/internal/field/fe_arm64_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !arm64 || !gc || purego -// +build !arm64 !gc purego package field diff --git a/go.mod b/go.mod index 97cbcb6929..c5c2f6d9ea 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module golang.org/x/crypto -go 1.17 +go 1.18 require ( golang.org/x/net v0.10.0 // tagx:ignore diff --git a/go.sum b/go.sum index f46a99b380..b99025deda 100644 --- a/go.sum +++ b/go.sum @@ -1,41 +1,8 @@ -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/internal/alias/alias.go b/internal/alias/alias.go index 69c17f822b..551ff0c353 100644 --- a/internal/alias/alias.go +++ b/internal/alias/alias.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !purego -// +build !purego // Package alias implements memory aliasing tests. package alias diff --git a/internal/alias/alias_purego.go b/internal/alias/alias_purego.go index 4775b0a438..6fe61b5c6e 100644 --- a/internal/alias/alias_purego.go +++ b/internal/alias/alias_purego.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build purego -// +build purego // Package alias implements memory aliasing tests. package alias diff --git a/internal/poly1305/bits_compat.go b/internal/poly1305/bits_compat.go index 45b5c966b2..d33c8890fc 100644 --- a/internal/poly1305/bits_compat.go +++ b/internal/poly1305/bits_compat.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !go1.13 -// +build !go1.13 package poly1305 diff --git a/internal/poly1305/bits_go1.13.go b/internal/poly1305/bits_go1.13.go index ed52b3418a..495c1fa697 100644 --- a/internal/poly1305/bits_go1.13.go +++ b/internal/poly1305/bits_go1.13.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.13 -// +build go1.13 package poly1305 diff --git a/internal/poly1305/mac_noasm.go b/internal/poly1305/mac_noasm.go index f184b67d98..333da285b3 100644 --- a/internal/poly1305/mac_noasm.go +++ b/internal/poly1305/mac_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!amd64 && !ppc64le && !s390x) || !gc || purego -// +build !amd64,!ppc64le,!s390x !gc purego package poly1305 diff --git a/internal/poly1305/sum_amd64.go b/internal/poly1305/sum_amd64.go index 6d522333f2..164cd47d32 100644 --- a/internal/poly1305/sum_amd64.go +++ b/internal/poly1305/sum_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/internal/poly1305/sum_amd64.s b/internal/poly1305/sum_amd64.s index 1d74f0f881..e0d3c64756 100644 --- a/internal/poly1305/sum_amd64.s +++ b/internal/poly1305/sum_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/internal/poly1305/sum_ppc64le.go b/internal/poly1305/sum_ppc64le.go index 4a069941a6..4aec4874b5 100644 --- a/internal/poly1305/sum_ppc64le.go +++ b/internal/poly1305/sum_ppc64le.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/internal/poly1305/sum_ppc64le.s b/internal/poly1305/sum_ppc64le.s index 58422aad23..d2ca5deeb9 100644 --- a/internal/poly1305/sum_ppc64le.s +++ b/internal/poly1305/sum_ppc64le.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/internal/poly1305/sum_s390x.go b/internal/poly1305/sum_s390x.go index ec95966889..e1d033a491 100644 --- a/internal/poly1305/sum_s390x.go +++ b/internal/poly1305/sum_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package poly1305 diff --git a/internal/poly1305/sum_s390x.s b/internal/poly1305/sum_s390x.s index aa9e0494c9..0fe3a7c217 100644 --- a/internal/poly1305/sum_s390x.s +++ b/internal/poly1305/sum_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/internal/wycheproof/eddsa_test.go b/internal/wycheproof/eddsa_test.go index 118dfc043f..9b97490955 100644 --- a/internal/wycheproof/eddsa_test.go +++ b/internal/wycheproof/eddsa_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.13 -// +build go1.13 package wycheproof diff --git a/ocsp/ocsp_test.go b/ocsp/ocsp_test.go index 0bc194b2f4..a23d29bd1f 100644 --- a/ocsp/ocsp_test.go +++ b/ocsp/ocsp_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.7 -// +build go1.7 package ocsp diff --git a/otr/libotr_test_helper.c b/otr/libotr_test_helper.c index b3ca072d48..aae03a3df7 100644 --- a/otr/libotr_test_helper.c +++ b/otr/libotr_test_helper.c @@ -5,7 +5,7 @@ // This code can be compiled and used to test the otr package against libotr. // See otr_test.go. -// +build ignore +//go:build ignore #include #include diff --git a/salsa20/salsa/salsa20_amd64.go b/salsa20/salsa/salsa20_amd64.go index c400dfcf7b..e76b44fe59 100644 --- a/salsa20/salsa/salsa20_amd64.go +++ b/salsa20/salsa/salsa20_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc package salsa diff --git a/salsa20/salsa/salsa20_amd64.s b/salsa20/salsa/salsa20_amd64.s index c089277204..fcce0234b6 100644 --- a/salsa20/salsa/salsa20_amd64.s +++ b/salsa20/salsa/salsa20_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc // This code was translated into a form compatible with 6a from the public // domain sources in SUPERCOP: https://bench.cr.yp.to/supercop.html diff --git a/salsa20/salsa/salsa20_amd64_test.go b/salsa20/salsa/salsa20_amd64_test.go index fc781f76f9..fe14604fc9 100644 --- a/salsa20/salsa/salsa20_amd64_test.go +++ b/salsa20/salsa/salsa20_amd64_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc package salsa diff --git a/salsa20/salsa/salsa20_noasm.go b/salsa20/salsa/salsa20_noasm.go index 4392cc1ac7..9448760f26 100644 --- a/salsa20/salsa/salsa20_noasm.go +++ b/salsa20/salsa/salsa20_noasm.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc -// +build !amd64 purego !gc package salsa diff --git a/sha3/hashes_generic.go b/sha3/hashes_generic.go index c74fc20fcb..fe8c84793c 100644 --- a/sha3/hashes_generic.go +++ b/sha3/hashes_generic.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !gc || purego || !s390x -// +build !gc purego !s390x package sha3 diff --git a/sha3/keccakf.go b/sha3/keccakf.go index e5faa375c0..ce48b1dd3e 100644 --- a/sha3/keccakf.go +++ b/sha3/keccakf.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !amd64 || purego || !gc -// +build !amd64 purego !gc package sha3 diff --git a/sha3/keccakf_amd64.go b/sha3/keccakf_amd64.go index 248a38241f..b908696be5 100644 --- a/sha3/keccakf_amd64.go +++ b/sha3/keccakf_amd64.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc package sha3 diff --git a/sha3/keccakf_amd64.s b/sha3/keccakf_amd64.s index 4cfa54383b..8fb26aebb2 100644 --- a/sha3/keccakf_amd64.s +++ b/sha3/keccakf_amd64.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build amd64 && !purego && gc -// +build amd64,!purego,gc // This code was translated into a form compatible with 6a from the public // domain sources at https://github.com/gvanas/KeccakCodePackage diff --git a/sha3/register.go b/sha3/register.go index 8b4453aac3..addfd5049b 100644 --- a/sha3/register.go +++ b/sha3/register.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build go1.4 -// +build go1.4 package sha3 diff --git a/sha3/sha3_s390x.go b/sha3/sha3_s390x.go index ec26f147ff..d861bca528 100644 --- a/sha3/sha3_s390x.go +++ b/sha3/sha3_s390x.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego package sha3 diff --git a/sha3/sha3_s390x.s b/sha3/sha3_s390x.s index a0e051b045..826b862c77 100644 --- a/sha3/sha3_s390x.s +++ b/sha3/sha3_s390x.s @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build gc && !purego -// +build gc,!purego #include "textflag.h" diff --git a/sha3/shake_generic.go b/sha3/shake_generic.go index 5c0710ef98..8d31cf5be2 100644 --- a/sha3/shake_generic.go +++ b/sha3/shake_generic.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !gc || purego || !s390x -// +build !gc purego !s390x package sha3 diff --git a/sha3/xor.go b/sha3/xor.go index 59c8eb9418..7337cca88e 100644 --- a/sha3/xor.go +++ b/sha3/xor.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build (!amd64 && !386 && !ppc64le) || purego -// +build !amd64,!386,!ppc64le purego package sha3 diff --git a/sha3/xor_unaligned.go b/sha3/xor_unaligned.go index 1ce606246d..870e2d16e0 100644 --- a/sha3/xor_unaligned.go +++ b/sha3/xor_unaligned.go @@ -3,8 +3,6 @@ // license that can be found in the LICENSE file. //go:build (amd64 || 386 || ppc64le) && !purego -// +build amd64 386 ppc64le -// +build !purego package sha3 diff --git a/ssh/test/agent_unix_test.go b/ssh/test/agent_unix_test.go index 43fbdb22eb..aeecaebb1d 100644 --- a/ssh/test/agent_unix_test.go +++ b/ssh/test/agent_unix_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package test diff --git a/ssh/test/banner_test.go b/ssh/test/banner_test.go index 3bfdd4b059..dd17db5a87 100644 --- a/ssh/test/banner_test.go +++ b/ssh/test/banner_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package test diff --git a/ssh/test/cert_test.go b/ssh/test/cert_test.go index 83dd534c5c..15c44fb58e 100644 --- a/ssh/test/cert_test.go +++ b/ssh/test/cert_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package test diff --git a/ssh/test/dial_unix_test.go b/ssh/test/dial_unix_test.go index 4a7ec31737..0a5f5e395f 100644 --- a/ssh/test/dial_unix_test.go +++ b/ssh/test/dial_unix_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !windows && !js && !wasip1 -// +build !windows,!js,!wasip1 package test diff --git a/ssh/test/forward_unix_test.go b/ssh/test/forward_unix_test.go index 1171bc3a14..611122b9e8 100644 --- a/ssh/test/forward_unix_test.go +++ b/ssh/test/forward_unix_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package test diff --git a/ssh/test/multi_auth_test.go b/ssh/test/multi_auth_test.go index 403d7363ab..14cf1cce12 100644 --- a/ssh/test/multi_auth_test.go +++ b/ssh/test/multi_auth_test.go @@ -15,7 +15,6 @@ // (for linux) in file ./sshd_test_pw.c. //go:build linux -// +build linux package test diff --git a/ssh/test/session_test.go b/ssh/test/session_test.go index 4745ed9dbb..69c8b86dd5 100644 --- a/ssh/test/session_test.go +++ b/ssh/test/session_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build !windows && !js && !wasip1 -// +build !windows,!js,!wasip1 package test diff --git a/ssh/test/sshd_test_pw.c b/ssh/test/sshd_test_pw.c index 2794a563a4..1e48619994 100644 --- a/ssh/test/sshd_test_pw.c +++ b/ssh/test/sshd_test_pw.c @@ -20,7 +20,7 @@ // Run sshd: // LD_PRELOAD="sshd_test_pw.so" TEST_USER="..." TEST_PASSWD="..." sshd ... -// +build ignore +//go:build ignore #define _GNU_SOURCE #include diff --git a/ssh/test/test_unix_test.go b/ssh/test/test_unix_test.go index f3f55db128..8dbedb0b13 100644 --- a/ssh/test/test_unix_test.go +++ b/ssh/test/test_unix_test.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || plan9 || solaris -// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9 solaris package test diff --git a/x509roots/gen_fallback_bundle.go b/x509roots/gen_fallback_bundle.go index c22d1b0c38..80b2044d22 100644 --- a/x509roots/gen_fallback_bundle.go +++ b/x509roots/gen_fallback_bundle.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. //go:build generate -// +build generate //go:generate go run gen_fallback_bundle.go From ee1860803fffcac9d73d297d5080e50aae102013 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Thu, 12 Oct 2023 10:28:59 +0100 Subject: [PATCH 07/13] rename channelOpenDirectMsg fields to export --- ssh/tcpip.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index af6f1e6648..f8e3285e60 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -406,18 +406,18 @@ func (c *Client) DialTCP(n string, laddr, raddr *net.TCPAddr) (net.Conn, error) // RFC 4254 7.2 type channelOpenDirectMsg struct { - raddr string - rport uint32 - laddr string - lport uint32 + Addr string + Port uint32 + OriginAddr string + OriginPort uint32 } func (c *Client) dial(laddr string, lport int, raddr string, rport int) (Channel, error) { msg := channelOpenDirectMsg{ - raddr: raddr, - rport: uint32(rport), - laddr: laddr, - lport: uint32(lport), + Addr: raddr, + Port: uint32(rport), + OriginAddr: laddr, + OriginPort: uint32(lport), } ch, in, err := c.OpenChannel("direct-tcpip", Marshal(&msg)) if err != nil { From 53e97f4434e21c01aa86a98b9bf10fcd1dae30a4 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Thu, 12 Oct 2023 10:41:26 +0100 Subject: [PATCH 08/13] defer close pipe --- ssh/tcpip_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ssh/tcpip_test.go b/ssh/tcpip_test.go index 56d0ad7170..9478f132b3 100644 --- a/ssh/tcpip_test.go +++ b/ssh/tcpip_test.go @@ -34,6 +34,8 @@ func TestDialNamedPort(t *testing.T) { if err != nil { t.Fatalf("netPipe: %v", err) } + defer srvConn.Close() + defer clientConn.Close() serverConf := &ServerConfig{ NoClientAuth: true, @@ -87,7 +89,6 @@ func TestDialNamedPort(t *testing.T) { } tcpipconn.Close() - srvConn.Close() clientConn.Close() for err := range srvErr { From 612be7106ac52c2425c31fa89c468be44ee7747a Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Thu, 12 Oct 2023 11:09:53 +0100 Subject: [PATCH 09/13] reuse channelOpenDirectMsg --- ssh/tcpip_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/ssh/tcpip_test.go b/ssh/tcpip_test.go index 9478f132b3..2cedf5d5ea 100644 --- a/ssh/tcpip_test.go +++ b/ssh/tcpip_test.go @@ -20,13 +20,6 @@ func TestAutoPortListenBroken(t *testing.T) { } } -type directTCPIPPayload struct { - Addr string - Port uint32 - OriginAddr string - OriginPort uint32 -} - func TestDialNamedPort(t *testing.T) { // Test that sshClient.Dial supports named ports. @@ -54,7 +47,7 @@ func TestDialNamedPort(t *testing.T) { if newChan.ChannelType() != "direct-tcpip" { srvErr <- fmt.Errorf("expected direct-tcpip channel, got=%s", newChan.ChannelType()) } - data := directTCPIPPayload{} + data := channelOpenDirectMsg{} if err := Unmarshal(newChan.ExtraData(), &data); err != nil { srvErr <- err } From 6b972a0f80ec4563371a8199569e92f7e1d0d2f8 Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Wed, 18 Oct 2023 22:57:58 +0100 Subject: [PATCH 10/13] clean up tests --- ssh/tcpip_test.go | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/ssh/tcpip_test.go b/ssh/tcpip_test.go index 2cedf5d5ea..f52dc4aa17 100644 --- a/ssh/tcpip_test.go +++ b/ssh/tcpip_test.go @@ -21,8 +21,6 @@ func TestAutoPortListenBroken(t *testing.T) { } func TestDialNamedPort(t *testing.T) { - // Test that sshClient.Dial supports named ports. - srvConn, clientConn, err := netPipe() if err != nil { t.Fatalf("netPipe: %v", err) @@ -46,21 +44,34 @@ func TestDialNamedPort(t *testing.T) { for newChan := range chans { if newChan.ChannelType() != "direct-tcpip" { srvErr <- fmt.Errorf("expected direct-tcpip channel, got=%s", newChan.ChannelType()) + if err := newChan.Reject(UnknownChannelType, "This test server only supports direct-tcpip"); err != nil { + srvErr <- err + } + continue } data := channelOpenDirectMsg{} if err := Unmarshal(newChan.ExtraData(), &data); err != nil { - srvErr <- err + if err := newChan.Reject(ConnectionFailed, err.Error()); err != nil { + srvErr <- err + } + continue } // Below we dial for service `ssh` which should be translated to 22. if data.Port != 22 { - srvErr <- fmt.Errorf("expected port 22 got=%d", data.Port) + if err := newChan.Reject(ConnectionFailed, fmt.Sprintf("expected port 22 got=%d", data.Port)); err != nil { + srvErr <- err + } + continue } ch, reqs, err := newChan.Accept() if err != nil { srvErr <- fmt.Errorf("Accept: %w", err) + continue } go DiscardRequests(reqs) - ch.Close() + if err := ch.Close(); err != nil { + srvErr <- err + } } }() @@ -68,22 +79,20 @@ func TestDialNamedPort(t *testing.T) { User: "testuser", HostKeyCallback: InsecureIgnoreHostKey(), } - sshClientConn, newChans, reqs, err := NewClientConn(clientConn, "", clientConf) if err != nil { t.Fatal(err) } sshClient := NewClient(sshClientConn, newChans, reqs) - // port being a named port `ssh` is the main point of the test. - tcpipconn, err := sshClient.Dial("tcp", "localhost:ssh") + // The port section in the host:port string being a named service `ssh` is the main point of the test. + _, err = sshClient.Dial("tcp", "localhost:ssh") if err != nil { - t.Fatal(err) + t.Error(err) } - tcpipconn.Close() + // Stop the ssh server. clientConn.Close() - for err := range srvErr { t.Errorf("ssh server: %s", err) } From 9da413179440dc5409ae187b543d74f279a97b7a Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Thu, 19 Oct 2023 09:14:36 +0100 Subject: [PATCH 11/13] Add comment about service names --- ssh/tcpip.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index f8e3285e60..16f749d5de 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -334,6 +334,9 @@ func (l *tcpListener) Addr() net.Addr { // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). +// Like net.Dial +// For TCP addresses the port section of the address can be a service name. +// Service names are resolved at the client side, domain names are resolved on the server. func (c *Client) Dial(n, addr string) (net.Conn, error) { var ch Channel switch n { From 127a3e63e5ce6926a7ea6fd930934f762a80002a Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Thu, 19 Oct 2023 09:20:39 +0100 Subject: [PATCH 12/13] update Dial method comment --- ssh/tcpip.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 16f749d5de..b0965943cf 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -334,8 +334,7 @@ func (l *tcpListener) Addr() net.Addr { // Dial initiates a connection to the addr from the remote host. // The resulting connection has a zero LocalAddr() and RemoteAddr(). -// Like net.Dial -// For TCP addresses the port section of the address can be a service name. +// For TCP addresses the port section of the address can be a port number or a service name. // Service names are resolved at the client side, domain names are resolved on the server. func (c *Client) Dial(n, addr string) (net.Conn, error) { var ch Channel From f2112bf3e386dfdcf8619c43f0fcfe7d0de8d66e Mon Sep 17 00:00:00 2001 From: Kobe Housen Date: Mon, 4 Dec 2023 12:36:08 +0000 Subject: [PATCH 13/13] use context in lookup port --- ssh/tcpip.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ssh/tcpip.go b/ssh/tcpip.go index 8b9cf8b6b3..c52c840812 100644 --- a/ssh/tcpip.go +++ b/ssh/tcpip.go @@ -384,7 +384,7 @@ func (c *Client) dialContext(ctx context.Context, n, addr string) (net.Conn, err if err != nil { return nil, err } - port, err := net.LookupPort(n, portString) + port, err := net.DefaultResolver.LookupPort(ctx, n, portString) if err != nil { return nil, err }