Граф коммитов

20 Коммитов

Автор SHA1 Сообщение Дата
Michael Munday 613d6eafa3 ssh: fix copy and paste error
Doesn't matter because contentKey and lengthKey are the same length,
but we should really be looping over lengthKey here.

Change-Id: Ic7af3c553eb4382239bec1c030e77c7f5baa0662
Reviewed-on: https://go-review.googlesource.com/109735
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-05-01 15:52:21 +00:00
Michael Munday 83c378c48d ssh: update to use new ChaCha20 API
Use the new streaming API added in CL 104856.

Change-Id: I6453a54a9739f20fc4d05f476c6e26f720ccd354
Reviewed-on: https://go-review.googlesource.com/108656
Run-TryBot: Michael Munday <mike.munday@ibm.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-04-26 22:59:36 +00:00
Han-Wen Nienhuys 3d37316aaa ssh: return correct error on read failure
Change-Id: I6cc94ae8dbc65f394550551eaad88594d22eda42
Reviewed-on: https://go-review.googlesource.com/89095
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-23 09:55:55 +00:00
Han-Wen Nienhuys d94f6bc902 ssh: use io.ReadFull() for reading chacha20-poly1305 packets.
Incomplete reads leave (part of) the verification tag zeroed, leading
to a failing MAC, and this is more likely to happen with larger
packets. The test added in the previous commit should stop this from
regressing.

Reinstate chacha20-poly1305 as a default cipher and prefer it over AES
CTR flavors.

Fixes golang/go#23510

Change-Id: I7599897e59448edb7b814eebcc8226ea15b365d6
Reviewed-on: https://go-review.googlesource.com/89075
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-01-22 21:37:07 +00:00
Han-Wen Nienhuys 39efaea5da ssh: cleanup cipher creation logic
Change-Id: I0e6ac0a381ffa53650304f0bea2ba79c3cf1d8c2
Reviewed-on: https://go-review.googlesource.com/87196
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-22 08:56:10 +00:00
Han-Wen Nienhuys ee41a25c63 ssh: support chacha20-poly1305 cipher
chacha20-poly1305 is an AEAD which performs well without hardware
support. It is recommended as a replacement for the aging arcfour128
and arcfour256 ciphers.

Fixes golang/go#9489

Change-Id: I5d5a4620a435e65997f0ba7e683a34c29d9a396b
Reviewed-on: https://go-review.googlesource.com/87077
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-01-19 07:46:36 +00:00
Kevin Burke e8f229864d all: fix errors reported by vet, golint
None are "wrong" per se, but there are a lot of good suggestions and
in one case a docstring that was not present in godoc due to the
presence of an extra newline.

Changed "Id" in struct properties to "ID" in some non-exported
structs. Removed a trailing period from some error messages; I believe
the exact contents of error strings are not covered by the Go
compatibility promise.

Change-Id: I7c620582dc247396f72c52d38c909ccc0ec87b83
Reviewed-on: https://go-review.googlesource.com/80145
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-11-28 17:48:09 +00:00
Tobias Klauser 6a293f2d4b ssh: remove unused parameter of newGCMCipher
The macKey parameter of newGCMCipher is not used inside the function.
Remove it and adjust the only caller accordingly.

Change-Id: Ieb9c70d7f51825d734fdeedbc8962f0178fc0131
Reviewed-on: https://go-review.googlesource.com/65890
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2017-11-08 09:18:19 +00:00
Han-Wen Nienhuys a48ac81e47 ssh: allow up to 255 bytes of padding in AES-GCM
The writing side would generate a maximum of 19 bytes of padding, so
the reading side erroneously checked this. However, RFC 5647 specifies
255 as the maximum amount of padding for AES-GCM.

Fixes golang/go#18953.

Change-Id: I416b0023c6e4cbd91a6a1b4214a03f1663b77248
Reviewed-on: https://go-review.googlesource.com/47590
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-07-06 15:27:25 +00:00
MiLk 84bacda6ed ssh: Add the hmac-sha2-256-etm@openssh.com algorithm
Fixes golang/go#17676

Change-Id: I96c51431b174898a6bc0f6bec7f4561d5d64819f
Reviewed-on: https://go-review.googlesource.com/35513
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-08 15:25:40 +00:00
Sam Hug b6789ab629 x/crypto/ssh: add 3des-cbc as a non-default cipher
3des-cbc is an insecure cipher. As such, you must explictly add it to
Config in order to use it.

Change-Id: Ifd15cde46a9908eefef1c75bae7e97b05767361d
Reviewed-on: https://go-review.googlesource.com/22770
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
2016-05-15 12:48:58 +00:00
Adam Langley 803f01ea27 x/crypto/ssh: allow a custom Config to specify CBC mode.
Cryptographic flaws are so hard to kill it can only be a matter of time
before they start crying “brains!” and holding their arms out straight.

Fixes golang/go#13776.

Change-Id: Iee1c19dbe823eb8728e283dd11083638e41f7189
Reviewed-on: https://go-review.googlesource.com/18482
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-01-10 18:39:22 +00:00
Han-Wen Nienhuys 9fb97e878d x/crypto/ssh: add padding oracle countermeasures for AES-CBC.
This deprives an attacker of feedback for guesses against the packet
length given by the connection dropping.

Change-Id: I14939a82e5243a86d192bb18be93d45589227147
Reviewed-on: https://go-review.googlesource.com/9908
Reviewed-by: Adam Langley <agl@golang.org>
2015-05-30 19:27:53 +00:00
Nathan(yinian) Hu 5c68cfdf2a crypto/ssh: add support for aes128-cbc cipher.
The aes128cbc cipher is commented out in cipher.go on purpose, anyone wants to
use the cipher needs to uncomment line 119 in cipher.go

Fixes #4274.

Change-Id: I4bbc88ab884bda821c5f155dcf495bb7235c8605
Reviewed-on: https://go-review.googlesource.com/8396
Reviewed-by: Adam Langley <agl@golang.org>
2015-04-10 21:42:31 +00:00
Yan Zou e1b0d6c49f go.crypto/ssh: Add support for the pre-2006 RC4 cipher mode.
LGTM=hanwen
R=agl, hanwen
CC=golang-codereviews
https://golang.org/cl/86600044
2014-04-14 10:43:20 -07:00
Adam Langley fa50e7408b go.crypto/ssh: import gosshnew.
See https://groups.google.com/d/msg/Golang-nuts/AoVxQ4bB5XQ/i8kpMxdbVlEJ

R=hanwen
CC=golang-codereviews
https://golang.org/cl/86190043
2014-04-09 13:57:52 -07:00
Han-Wen Nienhuys d7d50b0a7c go.crypto/ssh: implement ECDH.
Implement elliptic-curve Diffie-Hellman, including host key signature
verification.

Moves host key cryptographic verification to ClientConn.handshake(), so
RSA host keys are also verified.

Fixes golang/go#6158.

R=dave, agl
CC=golang-dev
https://golang.org/cl/13021045
2013-08-28 10:50:25 -04:00
Dave Cheney 1582bf0781 go.crypto/ssh: never negotiate unsupported ciphers
Fixes golang/go#4285.

Adding a new cipher that is supported by the remote end, but not supported by our client causes that cipher to be considered a valid candidate. This fails later in setupKeys when there is no cipherModes configuration.

In summary, unsupported ciphers cannot be willed into existence by adding them to the client config. This change enforces this.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6780047
2012-10-30 18:13:59 +11:00
Adam Langley 63f855d724 ssh: cosmetic cleanups
These are the cosmetic cleanups from the bits of code that I
rereviewed.

1) stringLength now takes a int; the length of the string. Too many
   callers were allocating with stringLength([]byte(s)) and
   stringLength only needs to call len().

2) agent.go now has sendAndReceive to remove logic that was
   duplicated.

3) We now reject negative DH values

4) We now reject empty packets rather than crashing.

R=dave, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/6061052
2012-04-20 15:17:42 -04:00
Russ Cox 470549d502 go.crypto: initial code
Manual edits to README.
Moved from main Go repository, deleted Makefiles, ran gofix -r go1rename.

Tested with: go test code.google.com/p/go.crypto/...

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5564059
2012-01-25 15:31:12 -05:00