Commit Graph
95 Commits
Author SHA1 Message Date
Jonathan Pittman 54c65aebf4 go.crypto/ssh: Miscellaneous changes up for discussion.
Export key and certificate algorithm names.
Switch from string literals over to using the constants for any key/cert algorithm references.
Make URL references visible in the godoc web display.
Standardize url reference names with surrounding [].

R=dave, agl, jonathan.mark.pittman
CC=golang-dev
https://golang.org/cl/6944047
2012-12-14 10:11:06 -05:00
Alex Brainman 97c15b3da8 go.crypto/ssh/test: move some variables into common os source file to fix windows build
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6944048
2012-12-14 18:45:36 +11:00
Jonathan Pittman 94c9f92c92 go.crypto/ssh: Add support for ECDSA keys and certs.
R=agl, dave
CC=golang-dev
https://golang.org/cl/6873060
2012-12-14 05:52:19 +11:00
Adam Langley 4002be2701 go.crypto/ssh: run gofmt
gofmt got better at removing trailing whitespace.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6929044
2012-12-10 18:12:36 -05:00
Shawn Ledbetter 887809b6be ssh: add functions for public keys in wire & auth keys format.
This allows easy import/export of public keys in the format
expected by OpenSSH for authorized_keys files, as well as
allowing comparisons with ServerConfig's PublickeyCallback.
Fixes golang/go#3908.

R=agl, dave, golang-dev, bradfitz
CC=agl, golang-dev
https://golang.org/cl/6855107
2012-12-10 17:43:09 -05:00
Damian Gryski 62944567d8 go.crypto: remove cipher.Reset()
The go.crypto repo was missed when this function was removed from the
ciphers in the standard library.

R=agl
CC=golang-dev
https://golang.org/cl/6904062
2012-12-10 11:00:48 -05:00
Adam Langley 4c5258d8b6 go.crypto/bn256: ensure that t is initialised correctly.
t caches the value of z squared, but wasn't getting correctly
initialised when the value of z was reset.

R=golang-dev
CC=golang-dev
https://golang.org/cl/6850091
2012-11-22 13:44:59 -05:00
Joel Sing ae58a7bde0 go.crypto/ssh: make tests work on non-cgo platforms.
user.Current() currently requires cgo - if an error is returned
attempt to get the username from the environment.

R=golang-dev, minux.ma, bradfitz, dave
CC=golang-dev
https://golang.org/cl/6819113
2012-11-12 02:50:33 +11:00
Ian Lance Taylor 153731a6de go.crypto/ssh/test: don't kill process if it was never started
This case arises if s.cmd.Start fails when called by
server.Dial.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/6821097
2012-11-08 09:08:33 -08:00
Ian Lance Taylor 6779fad1d0 go.crypto: add and adjust +build lines for 386 and gccgo
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6827061
2012-11-07 22:50:39 -08:00
Jeff Hodges 2c5e207468 go.crypto/bcrypt: add Cost function
Extracts the cost used to generate a bcrypt hash from the hash itself.

R=agl, agl, dchest
CC=golang-dev
https://golang.org/cl/6810051
2012-10-31 12:35:46 -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
Willem van der Schyff 2fccde5d00 go.crypto/ssh: add terminal modes to ssh.RequestPty()
R=dave, agl
CC=golang-dev
https://golang.org/cl/6655046
2012-10-21 16:16:55 +11:00
Adam Langley c9c0e06eed go.crypto/otr: expose IsEncrypted.
It's useful to expose this bit of state because, although callers can
keep track of it themselves, it's already in the Conversation so it
seems wasteful to make them do so.

R=golang-dev, ioerror
CC=golang-dev
https://golang.org/cl/6724056
2012-10-17 14:58:16 -04:00
Dave Cheney 4ce1924ebb go.crypto: various: fix appengine compatibility
Fixes golang/go#4102.

R=russross, minux.ma, rsc, agl
CC=golang-dev
https://golang.org/cl/6623053
2012-10-09 13:15:42 +11:00
Dmitry Chestnykh dc67354e86 go.crypto/blowfish: document that only 16 bytes of salt are used.
Also fix salt expansion code to fill the properly sized array,
since the following code never uses more than 4 uints.

Also remove unused expandedKey array.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6622050
2012-10-06 10:03:43 -04:00
Dave Cheney 0b9766a68d go.crypto/ssh: new test subpackage
This proposal is an attempt to improve the state of functional testing in the ssh package. The previous functional tests required the user to give away some personal details, like their password and private key to run the tests, and so were probably not run as frequently as they should.

R=agl, gustav.paul, kardianos, fullung
CC=golang-dev
https://golang.org/cl/6601043
2012-10-05 11:11:10 +10:00
Gustav Paul 1aa39d6262 go.crypto/ssh: Read returns all unread bytes before returning io.EOF.
Fixes golang/go#4158.

R=dave, agl
CC=golang-dev
https://golang.org/cl/6586060
2012-10-03 09:25:25 +10:00
Russ Cox b1c91de896 curve25519: fix asm comment
As suggested in review of CL 6544048.

TBR=seed
CC=golang-dev
https://golang.org/cl/6553065
2012-09-24 11:15:53 -04:00
Russ Cox 750c6a9860 go.crypto: match asm variable names to Go func declarations
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6544048
2012-09-21 00:36:01 -04:00
Dmitry Chestnykh 6ba10a7acb go.crypto/scrypt: add package
R=golang-dev, agl, r
CC=golang-dev
https://golang.org/cl/6535043
2012-09-18 16:59:45 -04:00
Dmitry Chestnykh 815dd50d91 go.crypto/salsa20: add salsa.Core208.
R=golang-dev, agl, r
CC=golang-dev
https://golang.org/cl/6530044
2012-09-18 13:46:45 -04:00
Adam Langley 9c0a3ae199 go.crypto/poly1305: enable AMD64 assembly
This change alters the assembly to use FSUBD instructions such that
6l will actually emit the correct FSUBRD instructions and enables
the assembly code.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6514044
2012-09-14 17:00:38 -04:00
Dave Cheney 591d65c664 go.crypto/ssh: sanity check incoming packet length
The check for a sensible packet length was removed a while ago
when the window size and channel packet size checks were moved
into channel.go. While the RFC suggests that any packet of size
less than uint32 -1 is valid, most implmentations limit the size
to a smaller value. OpenSSH chose 256kb, so that sounds like a
sensible default.

R=agl, huin, kardianos
CC=golang-dev
https://golang.org/cl/6490098
2012-09-10 06:57:24 +10:00
Adam Langley f09bfbbb56 go.crypto/nacl: add package
R=golang-dev, dchest, r, rsc
CC=golang-dev
https://golang.org/cl/6497101
2012-09-09 11:18:00 -04:00
Adam Langley 6814ed3bb5 go.crypto/poly1305: add package.
(Reference implementation by dchest. amd64 disabled pending 6l fix.)

R=golang-dev, dchest
CC=golang-dev
https://golang.org/cl/6494105
2012-09-08 14:24:19 -04:00
Adam Langley 62fc357018 go.crypto/salsa20: add package.
Package salsa20 implements the Salsa20 stream cipher as specified in
http://cr.yp.to/snuffle/spec.pdf.

(Reference implementation by dchest.)

R=golang-dev, dchest
CC=golang-dev
https://golang.org/cl/6496083
2012-09-08 10:41:44 -04:00
Dave Cheney 552202b8e3 go.crypto/ssh: assorted close related fixes
Fixes golang/go#3810.

Fixes chanWriter Write after close behaviour bug.

Fixes serverChan writePacket after close bug.

Addresses final comments by agl on 6405064, plus various cleanups.

R=agl, kardianos, gustav.paul, fullung
CC=golang-dev
https://golang.org/cl/6479056
2012-09-05 09:47:02 +10:00
Dave Cheney 06790d30c2 go.crypto/ssh: improve test reliability
Fixes golang/go#3989.

Tested for several hours on an 8 core ec2 instance with
random GOMAXPROC values.

Also, rolls server_test.go into session_test using the
existing dial() framework.

R=fullung, agl, kardianos
CC=golang-dev
https://golang.org/cl/6475063
2012-08-28 08:06:15 +10:00
Dave Cheney d1710933d8 go.crypto/ssh: fix test failure on windows
Use a handler that does not attempt to send a status message
as the failing test closes the connection abruptly.

Also, check the err response on all shell.ReadLine operations.

R=agl, minux.ma, kardianos
CC=golang-dev
https://golang.org/cl/6487043
2012-08-25 17:52:59 +10:00
Daniel Theophanes fc6f6ba087 go.crypto/ssh: prevent server from sending more than maxPacket
Fixes golang/go#4003.

R=agl, dave, agl
CC=golang-dev
https://golang.org/cl/6483052
2012-08-25 14:52:54 +10:00
Dave Cheney c1c0bfbd3a go.crypto/ssh: prevent channel writes after Close
Fixes golang/go#3810.

This change introduces an atomic boolean to guard the close
of the clientChan. Previously the client code was quite
lax with the ordering of the close messages and could allow
window adjustment or EOF messages to leak after Close had
been signaled.

Consolidating the changes to the serverChan will be handled
in a following CL.

R=agl, kardianos, gustav.paul
CC=golang-dev
https://golang.org/cl/6405064
2012-08-24 09:46:44 +10:00
Dave Cheney 096d0eae01 go.crypto/ssh: fix misplaced defer
Fixes golang/go#3972.

R=golang-dev, agl, r
CC=golang-dev
https://golang.org/cl/6448166
2012-08-18 15:41:45 +10:00
Dave Cheney 7343d5f584 go.crypto/ssh: improve channel max packet handling
This proposal moves the check for max packet into
channel.writePacket. Callers should be aware they cannot
pass a buffer larger than max packet. This is only a
concern to chanWriter.Write and appropriate guards are
already in place.

There was some max packet handling in transport.go but it was
incorrect. This has been removed.

This proposal also cleans up session_test.go.

R=gustav.paul, agl, fullung, huin
CC=golang-dev
https://golang.org/cl/6460075
2012-08-13 08:22:53 +10:00
Adam Langley be3c8d448b openpgp: support 3DES encrypted private keys.
It appears that CentOS (and so I presume Fedora/RHEL too) default to
encrypting private keys with 3DES so it looks like we need to support
that.

Fixes golang/go#3940.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6446121
2012-08-12 17:36:49 -04:00
Dave Cheney 00f60517a3 go.crypto/ssh: cosmetic: move remaining channel code into channel.go
This CL scratches an itch by moving the remaining channel related code
into channel.go.

R=agl
CC=golang-dev
https://golang.org/cl/6454126
2012-08-11 12:18:54 +10:00
Dave Cheney f0da345629 go.crypto/curve25519: fix incorrect build tag
The build tag was incorrect. CL 6458091 exposed the mistake.

R=golang-dev, dsymonds, r
CC=golang-dev
https://golang.org/cl/6460067
2012-08-10 10:23:58 +10:00
Dave Cheney f4749cba32 go.crypto/ssh: never send more data than maxpacket
RFC 4254 s5.2 is clear that a client must never send a data
packet larger than the value of maximum packet supplied by the
remote side during channel setup. The client was not honoring
this value, in fact it wasn't even recording it.

Thanks to Albert Strasheim for the bug report.

R=agl, fullung
CC=golang-dev
https://golang.org/cl/6448128
2012-08-09 10:22:00 +10:00
Adam Langley 71484c7202 bn256: add package
Package bn256 implements a particular bilinear group at the 128-bit
security level.

R=golang-dev, remyoudompheng, r, r, akumar
CC=golang-dev
https://golang.org/cl/6402052
2012-07-27 12:54:55 -04:00
Shenghou Ma 2aed6cb9f1 otr: fix compilation
R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6446054
2012-07-26 19:56:54 -04:00
Adam Langley 327f456371 otr: support signaling the end of a conversation.
The explicit OTR termination signal tells the peer that they should
discard their session keys and, more importantly, tells them that
*you* have done so and therefore cannot decrypt future messages.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/6430043
2012-07-24 19:21:47 -04:00
Dave Cheney e751d5236a go.crypto/ssh: improve TestServerWindow robustness
Fix a few resource leaks and prevent the test from
hanging if an error occurs reading from the remote
server.

R=agl, gustav.paul, kardianos
CC=golang-dev
https://golang.org/cl/6423065
2012-07-21 14:19:30 +10:00
Dave Cheney d1bf83abcb go.crypto/ssh: use binary.BigEndian throughout
A small cleanup.

R=agl, gustav.paul
CC=golang-dev
https://golang.org/cl/6406043
2012-07-20 10:33:35 +10:00
Dave Cheney f77e98d970 go.crypto/ssh: avoid recover() when handling invalid channel ids
This proposal removes the use of recover() to catch
invalid channel ids sent from the remote side. The
recover() unfortuntaly makes debugging harder as it
obscures other panic causes.

Another source of panic()s exists inside marshal.go,
which will be handled with in a later CL.

R=agl, gustav.paul
CC=golang-dev
https://golang.org/cl/6404046
2012-07-17 10:59:23 +10:00
Peter Armitage dd83c0b64f bcrypt: Documentation
If you supply a cost < MinCost this package will use DefaultCost, not MinCost

R=golang-dev, jeff
CC=golang-dev
https://golang.org/cl/6354100
2012-07-16 09:37:31 -04:00
Adam Langley e6db49c37b xts: add package.
Package xts implements the XTS cipher mode as specified in IEEE
P1619/D16.

R=golang-dev, r, dchest
CC=golang-dev
https://golang.org/cl/6392050
2012-07-12 11:14:12 -04:00
Gary Burd f997e8a33c go.crypto/ssh: add ClientAuthAgent
ClientAuthAgent adapts a *AgentClient to a ClientAuth.

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/6352056
2012-06-29 13:05:23 -04:00
Christine Hansmann cde552e05f ssh: added RequestSubsystem().
RequestSubsystem requests the association of a subsystem with the ssh
session on the remote host. A subsystem is a predefined command that
runs in the background when the ssh session is initiated (i.e. sftp).

R=golang-dev, agl
CC=golang-dev, gustav.paul
https://golang.org/cl/6295096
2012-06-18 12:11:37 -04:00
Adam Langley 929dedf39d otr: add package
otr implements the Off-the-Record messaging protocol from
http://www.cypherpunks.ca/otr/. It's often used on IRC and Jabber
for private conversations.

R=golang-dev, rsc, dchest
CC=golang-dev
https://golang.org/cl/6300064
2012-06-14 13:36:13 -04:00
Daniel Theophanes f8bd48becc go.crypto/ssh: allow server to respond to client init key exchange.
A windows SSH client, PuTTY, by default re-keys after every 60 minutes
or 1G of data transfer.

R=dave, agl
CC=golang-dev
https://golang.org/cl/6301071
2012-06-12 16:34:46 -04:00