Commit Graph
146 Commits
Author SHA1 Message Date
Adam Langley b725ff72eb go.crypto/ssh/terminal: handle ^W, ^K and ^H
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/13207043
2013-08-28 07:36:04 -04:00
JP Sugarbroad c2c80b64c0 crypto/ssh: Allow customization of the client version.
R=agl, golang-dev, dave
CC=golang-dev
https://golang.org/cl/13176044
2013-08-27 13:40:08 -04:00
JP Sugarbroad 504f1d5525 crypto/ssh: Handle msgUserAuthBanner during keyboard-interactive auth.
R=agl, golang-dev
CC=golang-dev
https://golang.org/cl/12983046
2013-08-27 11:23:31 -04:00
Brian Gitonga Marete 690e22b80a openpgp: Implement compressed data packets & add support for compressing data during symmetric encryption.
This patch implements the facilities needed to compress data before
encryption as allowed (and recommended) by RFC 4880. The new
functionality is then used to add support for compressing data during
symmetric encryption (openpgp.SymmetricallyEncrypt()).

For now, compression defaults to off. Also, only the ZIP and ZLIB
compression schemes are supported by this patch.

Resulting output tested/verified using GPG.

https://gist.github.com/marete/6189760 is a small program that can be
used to test that the output of various compression/encryption settings
can be read by GPG or other RFC 4880 programs.

Upon review, I will follow this patch with 2 others: a) Add support for 	compression during public key encryption (openpgp.Encrypt()) b) Enable
compression by default (subject to the restrictions of the "Compression 	Preferences" section in RFC 4880).

R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/12685044
2013-08-15 12:04:10 -04:00
Adam Langley f23aef828f go.crypto/openpgp: test that hashes are compiled in before using them.
Previously, if Encrypt decided to use a hash function that wasn't
compiled in then it would panic.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12055043
2013-08-05 14:22:57 -04:00
Adam Langley 16d76afb29 go.crypto/ocsp: pass in the issuing certificate.
Paul van Brouwershaven pointed out that it would be better to pass in
the issuing certificate and have the verification be done in the OCSP
package than to expect the caller to deal with the difference between
responses with and without a responder certificate.

R=golang-dev, dayveday, paul
CC=golang-dev
https://golang.org/cl/11220043
2013-07-29 15:32:19 -04:00
Han-Wen Nienhuys 4dc7c8e2f4 go.crypto/ssh: seed random generator, so auto port allocation is truly random.
R=agl, dave
CC=golang-dev
https://golang.org/cl/12027043
2013-07-29 13:09:39 -04:00
Han-Wen Nienhuys 2d394e3025 go.crypto/ssh: add workaround for broken port forwarding in
OpenSSH 5.

Tested with OpenSSH_5.9

R=agl, dave
CC=golang-dev
https://golang.org/cl/11921043
2013-07-26 14:37:37 -04:00
Adam Langley eb19e229bd go.crypto/openpgp: don't select expired keys.
When selecting keys for encryption, don't select keys that have
expired.

Fixes golang/go#5808.

R=bradfitz
CC=golang-dev
https://golang.org/cl/10847043
2013-07-22 18:23:28 -04:00
Han-Wen Nienhuys 7f7cbbf18e go.crypto/ssh: close channel feeding tcpListener.
Close both on closing the listener, and on closing the
connection. Test the former case.

R=dave
CC=golang-dev
https://golang.org/cl/11349043
2013-07-22 21:50:13 +10:00
Adam Langley 396847505b go.crypto/salsa: fix typo in comment and move TODO out of package comment.
Thanks to Frithjof Schulze for noticing.

R=goland-dev, r
CC=golang-dev
https://golang.org/cl/11033044
2013-07-16 19:34:54 -04:00
Drew Hintz 0982ebf089 crypto: Correct s2k type constants. They are 0,1,3 according to both the RFC: http://tools.ietf.org/html/rfc4880#section-3.7
And according to the gpg implementation: http://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git&a=search&h=refs%2Fheads%2FSTABLE-BRANCH-2-0&st=grep&s=s2kmode

R=agl
CC=evn, golang-dev
https://golang.org/cl/11355046
2013-07-16 17:39:57 -04:00
Adam Langley c4978816b9 go.crypto/ssh/terminal: support Go 1.0.
For those still stuck on Go 1.0.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/11297043
2013-07-15 18:01:31 -04:00
Brian Gitonga Marete d43a35d821 openpgp: Add support for BZIP2-compressed data packets.
Tested using a variety of files encrypted with gpg and the
"--compress-algo BZIP2" gpg option.

R=golang-dev, bradfitz, agl
CC=golang-dev
https://golang.org/cl/10801043
2013-07-03 11:31:17 -04:00
Adam Langley c4711a569a go.crypto/ssh/terminal: don't save passwords in history.
The history buffer would recall previously entered lines: including passwords. With this change, lines entered while echo is disabled are no longer put into the history.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/10853043
2013-07-02 19:46:13 -04:00
Adam Langley 3f4ad28b7c go.crypto/ocsp: make the zero value of RequestOptions valid and documented.
R=bradfitz
CC=golang-dev
https://golang.org/cl/10431044
2013-06-21 15:16:14 -04:00
Han-Wen Nienhuys afdc305bc8 go.crypto/ssh: add hook for host key checking.
R=dave, agl
CC=gobot, golang-dev
https://golang.org/cl/9922043
2013-06-21 12:46:35 -04:00
Adam Langley b88b016522 go.crypto/ocsp: allow cert-less responses and support making requests.
Some OCSP responses (notably COMODO's) don't use an intermediate
certificate to sign OCSP responses so this change allowed that.

Additionally, a CreateRequest function is added for creating OCSP
requests.

This change makes one API change: SerialNumber becomes a *big.Int to
match crypto/x509. The original code dates to before encoding/asn1
could cope with big.Ints and using a []byte was a workaround for that.

R=golang-dev
CC=golang-dev
https://golang.org/cl/10402043
2013-06-20 11:11:09 -04:00
Han-Wen Nienhuys 7cbb17fecb go.crypto/ssh: fix test breakages introduced by 125:40246d2ae2eb
* Remove special handling for dynamically allocated
  ports. This was a bug in OpenSSH 5.x sshd.

* Run the test with a preselected port number.

* Run TestPortForward only on unix platforms.

R=dave, agl
CC=golang-dev
https://golang.org/cl/10049045
2013-06-18 12:43:42 -04:00
Han-Wen Nienhuys b9b3892677 go.crypto/ssh/test: Run sshd with -e, so the debug output goes onto stderr.
R=dave, agl
CC=golang-dev
https://golang.org/cl/10230043
2013-06-18 21:50:58 +10:00
Han-Wen Nienhuys 0d8dc3cd6a go.crypto/ssh: fix and test port forwarding.
Set maxPacket in forwarded connection, and use the requested port
number as key in forwardList.

R=golang-dev, agl, dave
CC=golang-dev
https://golang.org/cl/9753044
2013-06-11 22:10:15 -04:00
Adam Langley c2ba5865a8 go.crypto/nacl/secretbox: fix append behaviour.
secretbox is supposed to append to the given slice, like hash.Sum() and
append(). However, I had a complete brain-fart: I've really no idea what
I was thinking of at the time.

R=golang-dev, sfrithjof, rsc
CC=agl, golang-dev
https://golang.org/cl/10099043
2013-06-10 18:03:26 -04:00
Adam Langley aa0f5b4081 go.crypto: revert 7f5a59ff6b43.
This change reverts https://golang.org/cl/10113043/ because
some folks are stuck on 1.0 till 1.1.1 comes out.

R=golang-dev
CC=golang-dev
https://golang.org/cl/10151043
2013-06-10 10:57:00 -04:00
Adam Langley eca6c1626e go.crypto: remove unreachable code.
I ran go vet over all of go.crypto and removed lots of panic("unreachable") that are no longer needed.

R=golang-dev, r, dgryski
CC=golang-dev
https://golang.org/cl/10113043
2013-06-07 16:05:15 -04:00
Adam Langley 59566675d5 ssh/terminal: support home, end, up and down keys.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9777043
2013-06-07 10:21:53 -04:00
Han-Wen Nienhuys c7df565dd4 go.crypto/ssh: implement keyboard-interactive auth (RFC 4256), both
on client and server-side.

R=dave, agl
CC=gobot, golang-dev
https://golang.org/cl/9853050
2013-06-06 10:44:12 -04:00
Han-Wen Nienhuys 36bf31eb71 go.crypto/ssh: add a error return to decode(), and avoid casting decode() output.
R=dave, kardianos, agl
CC=gobot, golang-dev
https://golang.org/cl/9738053
2013-06-06 10:24:21 -04:00
Dave Cheney e8889f5e72 go.crypto/ssh: fix race on mock ssh network connection
Fixes golang/go#5138.
Fixes golang/go#4703.

This appears to pass my stress tests with and without the -race detector, but I'd like to see others hit it with their machines.

R=golang-dev, fullung, huin, kardianos, agl
CC=golang-dev
https://golang.org/cl/9929043
2013-06-05 11:19:21 +10:00
Dave Cheney 1a6f1e67fb go.crypto/ssh: fix test breakage
Followup CL for 9711043. The order that CombinedOutput returns data captured from stdout/stderr is not specified, so we have to test both variants.

Thanks to fullung for the bug report.

R=fullung, kr
CC=golang-dev
https://golang.org/cl/9921044
2013-06-01 10:58:02 +10:00
Keith Rarick 0e971cde33 ssh: add Output and CombinedOutput helpers
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/9711043
2013-05-29 16:06:18 +10:00
David Symonds ac9976b0b7 go.crypto/ssh: More error reporting improvements.
R=golang-dev, kardianos, dave
CC=golang-dev
https://golang.org/cl/8596047
2013-04-26 09:44:04 +10:00
David Symonds 41998200eb go.crypto/ssh/test: Replace FailNow with Fail where it is obvious that the test doesn't want to fail now.
Improve a couple of test error messages too.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/8661045
2013-04-23 12:15:38 +10:00
David Symonds 952dc41929 go.crypto/ssh/test: Fix distracting nil pointer dereference in a test.
If cgo is disabled (such as it appears to be on a subset of builders),
username() panics, and s.cmd is nil; let's not panic while recovering
from a different panic.

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8820043
2013-04-17 17:40:33 +10:00
David Symonds c7af4ef7d9 go.crypto/ssh/test: improve diagnostics for test failing to get username.
R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/8817043
2013-04-17 16:22:42 +10:00
Albert Strasheim 62eb5d3fac go.crypto/ssh/test: wait on sshd process in tests
R=dave
CC=golang-dev
https://golang.org/cl/8449043
2013-04-07 19:26:33 +10:00
Eric Roshan-Eisner d52ec73510 go.crypto/sha3: change keccakF to stateless function
Taken from my implementation: https://bitbucket.org/ede/sha3
Performance gain from using less memory and more registers.

benchmark                       old ns/op    new ns/op    delta
BenchmarkPermutationFunction         1484         1118  -24.66%
BenchmarkBulkKeccak512             374993       295178  -21.28%
BenchmarkBulkKeccak256             215496       172335  -20.03%

benchmark                        old MB/s     new MB/s  speedup
BenchmarkPermutationFunction       134.76       178.80    1.33x
BenchmarkBulkKeccak512              43.69        55.51    1.27x
BenchmarkBulkKeccak256              76.03        95.07    1.25x

R=jcb, agl
CC=golang-dev, nigeltao
https://golang.org/cl/8088044
2013-04-02 10:41:35 -04:00
Nigel Tao 44f6c2e4a2 go.crypto/sha3: fix typo; remove 4 million map lookups (5% of "go test"
time); delete some comments that didn't add much and were incorrect
anyway (the test specification was tc, not t).

R=jcb
CC=agl, golang-dev
https://golang.org/cl/7665045
2013-03-23 10:10:15 +11:00
Adam Langley 1ddfbba54b go.crypto/ssh: fix tests with -cpu 1,2.
When running the ssh tests several times (e.g. with -cpu 1,2), the
second run would fail because testing globals had been altered. This
change avoids altering the globals since the default worked anyway.

Fixes golang/go#4715.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7903045
2013-03-22 15:51:39 -04:00
Joseph Bonneau 0bc0bccba9 go.crypto/sha3: new package
Added a pure Go implementation of SHA3 (Keccak) which implements the hash.Hash interface.
A test file is included with performance benchmarks and standard test vectors.

R=agl, nigeltao
CC=golang-dev
https://golang.org/cl/7760044
2013-03-22 14:59:59 -04:00
Adam Langley dc703e91d7 ssh/test: deflake session test.
The session test previously had a one second timeout for the output of
stty and this was leading to flakiness. This change removes the timeout
since go test has a generic timeout mechanism.

Additionally, the test was looking for "-echo" in the output to test
the value of the echo flag. However, there are also typically "echoe",
"echok" and "echonl" flags, and "-echo" could be a prefix of any of
time. Thus we now also match a trailing space.

R=golang-dev, rsc, extraterrestrial.neighbour
CC=golang-dev
https://golang.org/cl/7579043
2013-03-08 10:09:40 -05:00
Shenghou Ma eccdd1285a go.crypto/bcrypt: fix interger overflow for cost == 31
Fixes golang/go#4803.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/7329043
2013-02-19 19:16:34 +08:00
Shenghou Ma bf5456312c go.crypto/{curve25519,poly1305,salsa20/salsa}: add //go:noescape annotation
R=golang-dev, rsc, agl
CC=golang-dev
https://golang.org/cl/7319045
2013-02-19 19:15:01 +08:00
Adam Langley db732cbcc6 ssh/terminal: add darwin support.
terminal contains a number of utility functions that are currently only
implemented for Linux. Darwin uses different named constants for
getting and setting the terminal state so this change splits them off
as constants and defines them for each arch.

R=golang-dev, minux.ma
CC=golang-dev
https://golang.org/cl/7286043
2013-02-04 10:36:09 -05:00
Dmitry Chestnykh 97488752ad scrypt: 2x faster.
Work on uint32 slices instead of bytes.
Replace usage of Salsa20/8 from salsa package with
the specialized version.

benchmark       old ns/op    new ns/op    delta
BenchmarkKey    266430525    126657130  -52.46%

R=agl
CC=golang-dev
https://golang.org/cl/7139050
2013-01-17 11:42:30 -05:00
Adam Langley 03be8f3bf0 ssh/terminal: add GetState and make ReadPassword work in raw mode.
GetState is useful for restoring the terminal in a signal handler.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6990043
2012-12-22 11:02:28 -05:00
Casey Marshall 50ff460fe1 openpgp: remove TeeReader from packet.Read
This is a followup to issue 6927044. I *really* don't want to
break streaming for large encrypted data packets.

Removing the automatic re-parsing. OpaqueReader can be
used for recovering useful information from mangled/unsupported packets.

R=agl
CC=golang-dev
https://golang.org/cl/6944056
2012-12-18 17:57:21 -05:00
Eric Milliken 61ab4d36df go.crypto/ssh: support OpenSSH keepalives
Fixes golang/go#4552.

R=minux.ma, agl
CC=golang-dev
https://golang.org/cl/6948059
2012-12-18 11:33:58 -05:00
Jonathan Pittman d95b28330d go.crypto/ssh: some cleanup
Simplify MarshalAuthorizedKey by using the algoName func.
Make the algoName func be very specific about supported key types in openssh certs.
Generalize some of the commentary that previously mentioned specific key types.

R=agl, dave
CC=golang-dev
https://golang.org/cl/6938067
2012-12-16 10:47:10 -05:00
Casey Marshall 2da167fbbe openpgp: improve parser resilience & flexibility, add PublicKey.BitLength()
These are improvements I've made as necessary to develop Hockeypuck,
an OpenPGP keyserver (https://launchpad.net/hockeypuck).

The max armor line length was increased to 96 because some keyservers (SKS)
will output armor with lines greater than 64 (the prior max).

I've exposed packet.ReadEntity to support stream-parsing, useful for
large SKS dump files.

ReadKeyRing attempts to recover in the event of malformed data.

Because many packet types are not yet supported, I added OpaquePacket to
capture unsupported types for offline storage and later reparsing.

R=agl
CC=golang-dev
https://golang.org/cl/6927044
2012-12-15 14:30:05 -05:00
Adam Langley 84f97f92d0 go.crypto/bn256: updates tests in light of b2b2ae1f5140.
https://golang.org/cl/6850091 fixed the bug in question.
This change updates the tests so that they are broken without
that change.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6846091
2012-12-15 14:19:38 -05:00