From b1bab67e830c7d1c5f7222b5a11304dd2ca872b2 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Sun, 8 Mar 2020 23:31:40 -0400 Subject: [PATCH] upgrade golang.org/x/crypto --- go.mod | 2 +- go.sum | 2 ++ vendor/golang.org/x/crypto/sha3/sha3_s390x.go | 2 +- .../x/crypto/ssh/terminal/terminal.go | 17 +++++++++++++++-- .../x/crypto/ssh/terminal/util_windows.go | 4 ++-- vendor/modules.txt | 2 +- 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index c243a5ab..19387380 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/oragono/go-ident v0.0.0-20170110123031-337fed0fd21a github.com/stretchr/testify v1.4.0 // indirect github.com/tidwall/buntdb v1.1.2 - golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 + golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 golang.org/x/text v0.3.2 gopkg.in/yaml.v2 v2.2.8 ) diff --git a/go.sum b/go.sum index 27c3c2eb..0393bd56 100644 --- a/go.sum +++ b/go.sum @@ -61,6 +61,8 @@ github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563/go.mod h1:mLqSmt golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 h1:pXVtWnwHkrWD9ru3sDxY/qFK/bfc0egRovX91EjWjf4= golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 h1:xMPOj6Pz6UipU1wXLkrtqpHbR0AVFnyPEQq/wRWz9lM= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= diff --git a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go index c13ec85b..259ff4da 100644 --- a/vendor/golang.org/x/crypto/sha3/sha3_s390x.go +++ b/vendor/golang.org/x/crypto/sha3/sha3_s390x.go @@ -112,7 +112,7 @@ func (s *asmState) Write(b []byte) (int, error) { if len(s.buf) == 0 && len(b) >= cap(s.buf) { // Hash the data directly and push any remaining bytes // into the buffer. - remainder := len(s.buf) % s.rate + remainder := len(b) % s.rate kimd(s.function, &s.a, b[:len(b)-remainder]) if remainder != 0 { s.copyIntoBuf(b[len(b)-remainder:]) diff --git a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go index 2f04ee5b..d1b4fca3 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/terminal.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/terminal.go @@ -7,6 +7,7 @@ package terminal import ( "bytes" "io" + "runtime" "strconv" "sync" "unicode/utf8" @@ -939,6 +940,8 @@ func (s *stRingBuffer) NthPreviousEntry(n int) (value string, ok bool) { // readPasswordLine reads from reader until it finds \n or io.EOF. // The slice returned does not include the \n. // readPasswordLine also ignores any \r it finds. +// Windows uses \r as end of line. So, on Windows, readPasswordLine +// reads until it finds \r and ignores any \n it finds during processing. func readPasswordLine(reader io.Reader) ([]byte, error) { var buf [1]byte var ret []byte @@ -947,10 +950,20 @@ func readPasswordLine(reader io.Reader) ([]byte, error) { n, err := reader.Read(buf[:]) if n > 0 { switch buf[0] { + case '\b': + if len(ret) > 0 { + ret = ret[:len(ret)-1] + } case '\n': - return ret, nil + if runtime.GOOS != "windows" { + return ret, nil + } + // otherwise ignore \n case '\r': - // remove \r from passwords on Windows + if runtime.GOOS == "windows" { + return ret, nil + } + // otherwise ignore \r default: ret = append(ret, buf[0]) } diff --git a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go index 5cfdf8f3..f614e9cb 100644 --- a/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go +++ b/vendor/golang.org/x/crypto/ssh/terminal/util_windows.go @@ -85,8 +85,8 @@ func ReadPassword(fd int) ([]byte, error) { } old := st - st &^= (windows.ENABLE_ECHO_INPUT) - st |= (windows.ENABLE_PROCESSED_INPUT | windows.ENABLE_LINE_INPUT | windows.ENABLE_PROCESSED_OUTPUT) + st &^= (windows.ENABLE_ECHO_INPUT | windows.ENABLE_LINE_INPUT) + st |= (windows.ENABLE_PROCESSED_OUTPUT | windows.ENABLE_PROCESSED_INPUT) if err := windows.SetConsoleMode(windows.Handle(fd), st); err != nil { return nil, err } diff --git a/vendor/modules.txt b/vendor/modules.txt index 0995776e..c47ae63a 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -59,7 +59,7 @@ github.com/tidwall/rtree github.com/tidwall/rtree/base # github.com/tidwall/tinyqueue v0.0.0-20180302190814-1e39f5511563 github.com/tidwall/tinyqueue -# golang.org/x/crypto v0.0.0-20191112222119-e1110fd1c708 +# golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073 ## explicit golang.org/x/crypto/bcrypt golang.org/x/crypto/blowfish