diff options
| author | 2023-12-05 11:46:03 +0100 | |
|---|---|---|
| committer | 2023-12-05 11:46:03 +0100 | |
| commit | b576fbbdcb3fd6eabc5d6c2ec947879af386b388 (patch) | |
| tree | 63c2e4fd07e0be3fcc21f96c7048ec0a203f44f1 /vendor/golang.org/x/crypto/ssh | |
| parent | [chore]: Bump github.com/gorilla/feeds from 1.1.1 to 1.1.2 (#2414) (diff) | |
| download | gotosocial-b576fbbdcb3fd6eabc5d6c2ec947879af386b388.tar.xz | |
[chore]: Bump golang.org/x/crypto from 0.15.0 to 0.16.0 (#2413)
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.15.0 to 0.16.0.
- [Commits](https://github.com/golang/crypto/compare/v0.15.0...v0.16.0)
---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/golang.org/x/crypto/ssh')
| -rw-r--r-- | vendor/golang.org/x/crypto/ssh/client_auth.go | 20 | ||||
| -rw-r--r-- | vendor/golang.org/x/crypto/ssh/common.go | 8 | ||||
| -rw-r--r-- | vendor/golang.org/x/crypto/ssh/server.go | 5 | ||||
| -rw-r--r-- | vendor/golang.org/x/crypto/ssh/tcpip.go | 35 | 
4 files changed, 65 insertions, 3 deletions
| diff --git a/vendor/golang.org/x/crypto/ssh/client_auth.go b/vendor/golang.org/x/crypto/ssh/client_auth.go index 5c3bc2572..34bf089d0 100644 --- a/vendor/golang.org/x/crypto/ssh/client_auth.go +++ b/vendor/golang.org/x/crypto/ssh/client_auth.go @@ -307,7 +307,10 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand  	}  	var methods []string  	var errSigAlgo error -	for _, signer := range signers { + +	origSignersLen := len(signers) +	for idx := 0; idx < len(signers); idx++ { +		signer := signers[idx]  		pub := signer.PublicKey()  		as, algo, err := pickSignatureAlgorithm(signer, extensions)  		if err != nil && errSigAlgo == nil { @@ -321,6 +324,21 @@ func (cb publicKeyCallback) auth(session []byte, user string, c packetConn, rand  		if err != nil {  			return authFailure, nil, err  		} +		// OpenSSH 7.2-7.7 advertises support for rsa-sha2-256 and rsa-sha2-512 +		// in the "server-sig-algs" extension but doesn't support these +		// algorithms for certificate authentication, so if the server rejects +		// the key try to use the obtained algorithm as if "server-sig-algs" had +		// not been implemented if supported from the algorithm signer. +		if !ok && idx < origSignersLen && isRSACert(algo) && algo != CertAlgoRSAv01 { +			if contains(as.Algorithms(), KeyAlgoRSA) { +				// We retry using the compat algorithm after all signers have +				// been tried normally. +				signers = append(signers, &multiAlgorithmSigner{ +					AlgorithmSigner:     as, +					supportedAlgorithms: []string{KeyAlgoRSA}, +				}) +			} +		}  		if !ok {  			continue  		} diff --git a/vendor/golang.org/x/crypto/ssh/common.go b/vendor/golang.org/x/crypto/ssh/common.go index dd2ab0d69..7e9c2cbc6 100644 --- a/vendor/golang.org/x/crypto/ssh/common.go +++ b/vendor/golang.org/x/crypto/ssh/common.go @@ -127,6 +127,14 @@ func isRSA(algo string) bool {  	return contains(algos, underlyingAlgo(algo))  } +func isRSACert(algo string) bool { +	_, ok := certKeyAlgoNames[algo] +	if !ok { +		return false +	} +	return isRSA(algo) +} +  // supportedPubKeyAuthAlgos specifies the supported client public key  // authentication algorithms. Note that this doesn't include certificate types  // since those use the underlying algorithm. This list is sent to the client if diff --git a/vendor/golang.org/x/crypto/ssh/server.go b/vendor/golang.org/x/crypto/ssh/server.go index 8f1505af9..7f0c236a9 100644 --- a/vendor/golang.org/x/crypto/ssh/server.go +++ b/vendor/golang.org/x/crypto/ssh/server.go @@ -337,7 +337,7 @@ func checkSourceAddress(addr net.Addr, sourceAddrs string) error {  	return fmt.Errorf("ssh: remote address %v is not allowed because of source-address restriction", addr)  } -func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *connection, +func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, token []byte, s *connection,  	sessionID []byte, userAuthReq userAuthRequestMsg) (authErr error, perms *Permissions, err error) {  	gssAPIServer := gssapiConfig.Server  	defer gssAPIServer.DeleteSecContext() @@ -347,7 +347,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c  			outToken     []byte  			needContinue bool  		) -		outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(firstToken) +		outToken, srcName, needContinue, err = gssAPIServer.AcceptSecContext(token)  		if err != nil {  			return err, nil, nil  		} @@ -369,6 +369,7 @@ func gssExchangeToken(gssapiConfig *GSSAPIWithMICConfig, firstToken []byte, s *c  		if err := Unmarshal(packet, userAuthGSSAPITokenReq); err != nil {  			return nil, nil, err  		} +		token = userAuthGSSAPITokenReq.Token  	}  	packet, err := s.transport.readPacket()  	if err != nil { diff --git a/vendor/golang.org/x/crypto/ssh/tcpip.go b/vendor/golang.org/x/crypto/ssh/tcpip.go index 80d35f5ec..ef5059a11 100644 --- a/vendor/golang.org/x/crypto/ssh/tcpip.go +++ b/vendor/golang.org/x/crypto/ssh/tcpip.go @@ -5,6 +5,7 @@  package ssh  import ( +	"context"  	"errors"  	"fmt"  	"io" @@ -332,6 +333,40 @@ func (l *tcpListener) Addr() net.Addr {  	return l.laddr  } +// DialContext initiates a connection to the addr from the remote host. +// +// The provided Context must be non-nil. If the context expires before the +// connection is complete, an error is returned. Once successfully connected, +// any expiration of the context will not affect the connection. +// +// See func Dial for additional information. +func (c *Client) DialContext(ctx context.Context, n, addr string) (net.Conn, error) { +	if err := ctx.Err(); err != nil { +		return nil, err +	} +	type connErr struct { +		conn net.Conn +		err  error +	} +	ch := make(chan connErr) +	go func() { +		conn, err := c.Dial(n, addr) +		select { +		case ch <- connErr{conn, err}: +		case <-ctx.Done(): +			if conn != nil { +				conn.Close() +			} +		} +	}() +	select { +	case res := <-ch: +		return res.conn, res.err +	case <-ctx.Done(): +		return nil, ctx.Err() +	} +} +  // 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) { | 
