Commit Graph
509 Commits
Author SHA1 Message Date
Brad Fitzpatrick 88915ccf7a acme, acme/autocert: switch to Go 1.7+ context package
The standard library context package has been available since Go 1.7,
and the Go build dashboard (build.golang.org) only tests master and
the past two releases.

Also, the acme package makes no backwards compatibility guarantees,
not that I expect this to influence many people.

Change-Id: Ia1a294212e1e531f28f53cd954d4743a64611cab
Reviewed-on: https://go-review.googlesource.com/39272
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-04-02 21:05:33 +00:00
Brad Fitzpatrick b5cf4d8d48 acme/autocert: context propagation and doc tweaks
Change-Id: I061b797d46097e37880bea1911475e2b2f1a0378
Reviewed-on: https://go-review.googlesource.com/39270
Reviewed-by: Alex Vaghin <ddos@google.com>
2017-04-02 20:13:55 +00:00
Brad Fitzpatrick 3cb07270c9 ssh: fix typo in unexported comment
Thanks to Anisse Astier (@anisse) for noticing.

Change-Id: I1c282b2bb54601cf5649e194eafd5344c70331ca
Reviewed-on: https://go-review.googlesource.com/38916
Reviewed-by: dnv aps Sn <sndnvaps@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-30 16:07:16 +00:00
Han-Wen Nienhuys 9d2d6c1e36 ssh: handle error from prepareKeyChange.
Fixes #18850.

Change-Id: Id3ae89233f9e95ec3238462bf2ecda3e0c515f88
Reviewed-on: https://go-review.googlesource.com/36051
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-03-30 16:00:32 +00:00
Han-Wen Nienhuys e4e2799dd7 ssh: require host key checking in the ClientConfig
This change breaks existing behavior.

Before, a missing ClientConfig.HostKeyCallback would cause host key
checking to be disabled. In this configuration, establishing a
connection to any host just works, so today, most SSH client code in
the wild does not perform any host key checks.

This makes it easy to perform a MITM attack:

* SSH installations that use keyboard-interactive or password
authentication can be attacked with MITM, thereby stealing
passwords.

* Clients that use public-key authentication with agent forwarding are
also vulnerable: the MITM server could allow the login to succeed, and
then immediately ask the agent to authenticate the login to the real
server.

* Clients that use public-key authentication without agent forwarding
are harder to attack unnoticedly: an attacker cannot authenticate the
login to the real server, so it cannot in general present a convincing
server to the victim.

Now, a missing HostKeyCallback will cause the handshake to fail. This
change also provides InsecureIgnoreHostKey() and FixedHostKey(key) as
ready made host checkers.

A simplistic parser for OpenSSH's known_hosts file is given as an
example.  This change does not provide a full-fledged parser, as it
has complexity (wildcards, revocation, hashed addresses) that will
need further consideration.

When introduced, the host checking feature maintained backward
compatibility at the expense of security. We have decided this is not
the right tradeoff for the SSH library.

Fixes golang/go#19767

Change-Id: I45fc7ba9bd1ea29c31ec23f115cdbab99913e814
Reviewed-on: https://go-review.googlesource.com/38701
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-30 15:57:35 +00:00
Fredrik Forsmo 459e265272 pkcs12: fix ToPEM to not ignore non-nil error from getSafeContents
Fixes golang/go#19542

Change-Id: I60d2370d1d1e0763c72c9cc203ea2ff21123af73
Reviewed-on: https://go-review.googlesource.com/38261
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-17 16:37:34 +00:00
Martin Kreichgauer 728b753d01 cryptobyte: new package.
cryptobyte is a helper library for building and parsing byte strings,
specifically for TLS and ASN.1.

Change-Id: I046b94773f6781153784c79f3d81e6d464eaebe0
Reviewed-on: https://go-review.googlesource.com/36123
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-07 00:40:51 +00:00
Andreas Auernhammer 40541ccb1c blake2s: register BLAKE2s
Register BLAKE2s-256 if the package is imported.
Change-Id: Ib415ae641f21d863720bf9c089017ee97654a555
Reviewed-on: https://go-review.googlesource.com/36878
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 19:32:44 +00:00
Andreas Auernhammer 83de8c7b40 blake2b: register BLAKE2b
Register BLAKE2b-256, BLAKE2b-384 and BLAKE2b-512 if the package is imported.
Change-Id: Iba425a62b42ed07219f7e56ff173ed5ae503704e
Reviewed-on: https://go-review.googlesource.com/36877
Reviewed-by: Matt Layher <mdlayher@gmail.com>
Reviewed-by: Adam Langley <agl@golang.org>
Run-TryBot: Matt Layher <mdlayher@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-03-02 19:32:28 +00:00
Adam Langley 453249f01c poly1305: add burn-in test.
This is the test that I use to sanity-check significant changes to the
package, thus it's probably worth checking it in. Since it's very slow,
it's disabled by default.

(Note that while it stands a good chance of catching errors in 32-bit
implementations, no amount of random testing is going to get useful
coverage for 64-bit implementations. Thus it really is just a sanity
check, despite the long run-time.)

Change-Id: I95b321eec6f3026dafbbc157a7ef35a27e88d247
Reviewed-on: https://go-review.googlesource.com/36566
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 23:39:01 +00:00
Adam Langley dd96d35c1b ocsp: fix test flakiness
The test was assuming that the OCSP creation wouldn't cross a minute
boundary, which is flakey nonsense. Instead assert that the timestamp in
the OCSP response is within an hour of when we check it.

Change-Id: I3c822b738e9b04385319eb29a1cd275dc2ed112e
Reviewed-on: https://go-review.googlesource.com/36648
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-09 19:00:49 +00:00
Alex Vaghin 92783773f0 acme: reduce the number of network round trips
Before this change, every JWS-signed request was preceded
by a HEAD request to fetch a fresh nonce.

The Client is now able to collect nonce values
from server responses and use them for future requests.
Additionally, this change also makes sure the client propagates
any error encountered during a fresh nonce fetch.

Fixes golang/go#18428.

Change-Id: I33d21b450351cf4d98e72ee6c8fa654e9554bf92
Reviewed-on: https://go-review.googlesource.com/36514
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-08 23:57:13 +00:00
Andreas Auernhammer 537c9dfe43 poly1305: simplify reference implementation
Reduce code complexity by replacing the floating-point implementation
with a 32-bit implementation.

Moreover this improves the performance on 386:

name 		old time/op 	new time/op 	delta
64-2 		972ns ± 2% 	350ns ± 1% 	-64.04% (p=0.029 n=4+4)
1K-2 		10.9µs ± 3% 	4.2µs ± 1% 	-61.11% (p=0.029 n=4+4)
64Unaligned-2	969ns ± 2% 	354ns ± 2% 	-63.44% (p=0.029 n=4+4)
1KUnaligned-2 	10.8µs ± 3% 	4.2µs ± 1% 	-61.15% (p=0.029 n=4+4)

name 		old speed 	new speed 	delta
64-2 		65.8MB/s ± 2% 	182.9MB/s ± 1% 	+177.93% (p=0.029 n=4+4)
1K-2 		94.3MB/s ± 3% 	242.3MB/s ± 1% 	+157.08% (p=0.029 n=4+4)
64Unaligned-2 	66.0MB/s ± 2% 	180.4MB/s ± 2% 	+173.32% (p=0.029 n=4+4)
1KUnaligned-2  	94.4MB/s ± 3%  	243.0MB/s ± 1% 	+157.36% (p=0.029 n=4+4)

There are already optimized versions for amd64 and arm,
and a optimized version for s390x seems to be planned.
	See: https://go-review.googlesource.com/#/c/32812/

Change-Id: I7a5ac62ae33727b0e6060cb966de73a468317e30
Reviewed-on: https://go-review.googlesource.com/35294
Reviewed-by: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-08 20:50:45 +00:00
Andreas Auernhammer f671756e04 blake2b: fix AVX performance problems on amd64
On some amd64 CPUs (Xeon E5-2680v4 / E5-2620v3) using SSE and AVX instructions
leads to very low performance.
On a i7-6500U the SSE-AVX code performs following:

AVX2:
name        time/op
Write128-4    165ns ± 0%
Write1K-4    1.20µs ± 0%
Sum128-4      189ns ± 1%
Sum1K-4      1.22µs ± 0%

name        speed
Write128-4  773MB/s ± 1%
Write1K-4   855MB/s ± 0%
Sum128-4    675MB/s ± 1%
Sum1K-4     838MB/s ± 0%

while the same code achieves values < 65MB/s on a Xeon E5-2620v3.

Replacing the `MOVQ` and `PINSRQ` with the AVX instructions `VMOVQ` and `VPINSRQ`
increases the performance of the AVX/AVX2 code to some expected values:

name         old time/op    new time/op     delta
Write128-12    2.20µs ±10%     0.22µs ± 9%    -90.00%  (p=0.029 n=4+4)
Write1K-12     16.2µs ± 0%      1.1µs ± 0%    -93.07%  (p=0.029 n=4+4)
Sum128-12      2.10µs ± 0%     0.22µs ± 0%    -89.47%  (p=0.029 n=4+4)
Sum1K-12       16.3µs ± 0%      1.2µs ± 0%    -92.65%  (p=0.029 n=4+4)

name         old speed      new speed       delta
Write128-12  58.5MB/s ±10%  582.8MB/s ±10%   +897.08%  (p=0.029 n=4+4)
Write1K-12   63.1MB/s ± 0%  909.8MB/s ± 0%  +1341.40%  (p=0.029 n=4+4)
Sum128-12    60.8MB/s ± 0%  576.3MB/s ± 0%   +847.84%  (p=0.029 n=4+4)
Sum1K-12     62.8MB/s ± 0%  855.2MB/s ± 0%  +1260.78%  (p=0.029 n=4+4)

The AVX/AVX2 code now uses only AVX (no SSE) instructions.

Fixes golang/go#18563.

Change-Id: I1961dd8fa02014642587523b7f099816a263c9f5
Reviewed-on: https://go-review.googlesource.com/34993
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-08 19:53:58 +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
Heschi Kreinick 22ddb68ecc acme/autocert: fix racy tests
memCache used an unsynchronized map, which failed go test -race. Add a
mutex and constructor function to fix it.

Change-Id: Iddaa492ea1e3d7747965c6423368baa6556402ed
Reviewed-on: https://go-review.googlesource.com/36545
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-07 22:59:19 +00:00
Russ Cox 59a182cab6 curve25519: avoid loss of R15 in -dynlink mode
Fixes golang/go#18820.

Change-Id: I4b3a49b3bbbecc4e1008989fefd39da9725a28ea
Reviewed-on: https://go-review.googlesource.com/36359
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Austin Clements <austin@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-02-06 19:40:01 +00:00
Heschi Kreinick 5a6e40e042 ssh/agent: fix another test to not require IPv4.
Missed a copy/paste of netPipe in change 36110.

Change-Id: I1a850dd9273d71fadc0519cf4cb2a2de6ecae4c2
Reviewed-on: https://go-review.googlesource.com/36259
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2017-02-06 18:08:00 +00:00
Han-Wen Nienhuys 77014cf7f9 ssh: prevent double kex at connection start, 2nd try
The previous attempt would fail in the following scenario:

* select picks "first" kex from requestKex

* read loop receives a remote kex, posts on requestKex (which is now
  empty) [*] for sending out a response, and sends pendingKex on startKex.

* select picks pendingKex from startKex, and proceeds to run the key
  exchange.

* the posting on requestKex in [*] now triggers a second key exchange.

Fixes #18861. 

Change-Id: I443e82f1d04c7f17d1485fdb87072b9feec26aa8
Reviewed-on: https://go-review.googlesource.com/36055
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2017-02-06 10:12:19 +00:00
Heschi Kreinick bed12803fa ssh: Support multiple source-addresses, don't require IPv4 in tests.
The ssh tests currently require 127.0.0.1 to work which isn't
necessarily available everywhere. To fix the source-address tests,
support comma-separated source-address values per the PROTOCOL.certkeys
file:

  Comma-separated list of source addresses
  from which this certificate is accepted
  for authentication. Addresses are
  specified in CIDR format (nn.nn.nn.nn/nn
  or hhhh::hhhh/nn).
  If this option is not present then
  certificates may be presented from any
  source address.

Change-Id: I87536ff81ffa005c073da103021ebc0dfb12b620
Reviewed-on: https://go-review.googlesource.com/36110
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
2017-02-02 20:10:58 +00:00
Han-Wen Nienhuys 641ab6b320 ssh: reset buffered packets after sending
Since encryption messes up the packets, the wrongly retained packets
look like noise and cause application protocol errors or panics in the
SSH library.

This normally triggers very rarely: the mandatory key exchange doesn't
have parallel writes, so this failure condition would be setup on the
first key exchange, take effect only after the second key exchange.

Fortunately, the tests against openssh exercise this. This change adds
also adds a unittest.

Fixes #18850.

Change-Id: I656c8b94bfb265831daa118f4d614a2f0c65d2af
Reviewed-on: https://go-review.googlesource.com/36056
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-02-02 10:03:54 +00:00
Han-Wen Nienhuys b05791f2e1 ssh: add debug print at the lowest level
This is a simple minded, fast print, suitable for debugging timing
sensitive issues.

Change-Id: I9ae3df5fe86f1883c1fa9265b6f7f9a98d33747e
Reviewed-on: https://go-review.googlesource.com/36054
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-02-02 09:54:18 +00:00
Michael Munday dc137beb6c poly1305: add test vectors for edge cases
Often intermediate results of poly1305 calculations are only reduced to
the range [0, 2^130). These new test vectors exercise the code that
reduces the final output to the range [0, 2^130-5).

This improves the test coverage of CL 35294 and CL 32812.

Change-Id: Ifd2f64d4668c08a396ed81db3e88969a49baf777
Reviewed-on: https://go-review.googlesource.com/35918
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-30 17:18:27 +00:00
Han-Wen Nienhuys a59c127441 ssh: rationalize rekeying decisions.
1) Always force a key exchange if we exchange 2^31 packets. In the past
this might not happen if RekeyThreshold was set to a very large
interval.

2) Follow recommendations from RFC 4344 for block ciphers. For AES, we
can encrypt 2^(blocksize/4) blocks under the same keys.

On modern hardware, the previous default of 1Gb could force a key
exchange within ~10 seconds. Since the key exchange takes 3 roundtrips
(send kex init, send DH init, send NEW_KEYS), this is relatively
expensive on high-latency links.

Change-Id: I1297124a307c541b7bf22d814d136ec0c6d8ed97
Reviewed-on: https://go-review.googlesource.com/35410
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-30 09:33:53 +00:00
Han-Wen Nienhuys 6fb066875c ssh: make sure we execute the initial key exchange only once
The initial kex is started from both sides simultaneously, and before,
we could consume the the incoming kex request before we consumed from
our internal channel. This would result in initiating a key exchange
just after completing the initial one, which is not only an extra
delay, but also an error when using OpenSSH (OpenSSH does not support
key exchanges during user authentication).

Change-Id: Ia7e0748ea2bca80ae97d187bcf2931ab6422276b
Reviewed-on: https://go-review.googlesource.com/35851
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-30 08:21:40 +00:00
Michael Munday 854ae91cdc crypto/chacha20poly1305: rename test vectors file
The previous name did not have the '_test.go' suffix and so was
always built.

Change-Id: I2d18d0ba5c863ac7f0dd0465ebafba4e022faa14
Reviewed-on: https://go-review.googlesource.com/35875
Run-TryBot: Michael Munday <munday@ca.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-26 20:06:16 +00:00
Michael Munday 33e8e8f6b3 crypto/chacha20poly1305/internal/chacha20: add missing copyright header
The file was originally added in 2016.

Change-Id: I1b5c01400fb73e83f39c086ea1235a948d27308d
Reviewed-on: https://go-review.googlesource.com/35874
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-26 20:05:52 +00:00
Han-Wen Nienhuys 41d678d1df ssh: soft code internal channel size for testing purposes
Change-Id: I2ee0ed4ba82d2d156a7896551dea04b28cdeceb0
Reviewed-on: https://go-review.googlesource.com/35184
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-23 10:44:52 +00:00
Adam Langley b8a2a83acf otr: add missing return on error path
Due to a missing return, corrupt TLV data would cause an infinite loop
that consumes memory, eventually crashing the process.

Thanks to Ivan Markin for pointing this out.

Change-Id: Iaaf7c5f7ce911d3e542b86f6b942b15e2ccbdf3b
Reviewed-on: https://go-review.googlesource.com/35247
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-18 18:54:26 +00:00
Adam Langley 88e46b5e95 otr: reject private keys with parameters <= 0.
This serves as a basic sanity check and also prevents malformed private
keys from setting P=0 and consuming large amounts of CPU and memory in
the Exp call.

Change-Id: Ife22069b989a7347d8deaaf13030df82ee59e87b
Reviewed-on: https://go-review.googlesource.com/35246
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-18 18:34:45 +00:00
Paul Querna b82246307b crypto/ssh: fix parsing order for ssh.ParseDSAPrivateKey
The inline struct has the wrong order for the public and private key parts.

Change-Id: Ib3a5d6846296a2300241331a2ad398579e042ca9
Reviewed-on: https://go-review.googlesource.com/35351
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-18 01:33:05 +00:00
Adam Langley 91902e332b ssh/terminal: consume data before checking for an error.
According to the io.Reader docs, Alex had it right the first time. (See
discussion on https://golang.org/cl/25355.)

Change-Id: Ib6fb9dfb99009e034263574e82d7e9d4828df38f
Reviewed-on: https://go-review.googlesource.com/35242
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-17 00:48:27 +00:00
Alex Brainman 13d9f6188e ssh/terminal: fix line endings handling in ReadPassword
Fixes golang/go#16552

Change-Id: I18a9c9b42fe042c4871b3efb3f51bef7cca335d0
Reviewed-on: https://go-review.googlesource.com/25355
Reviewed-by: Adam Langley <alangley@gmail.com>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-16 17:16:45 +00:00
Han-Wen Nienhuys 2e74c77368 ssh: rewrite (re)keying logic.
Use channels and a dedicated write loop for managing the rekeying
process.  This lets us collect packets to be written while a key
exchange is in progress.

Previously, the read loop ran the key exchange, and writers would
block if a key exchange was going on. If a reader wrote back a packet
while processing a read packet, it could block, stopping the read
loop, thus causing a deadlock.  Such coupled read/writes are inherent
with handling requests that want a response (eg. keepalive,
opening/closing channels etc.). The buffered channels (most channels
have capacity 16) papered over these problems, but under load SSH
connections would occasionally deadlock.

Fixes #18439.

Change-Id: I7c14ff4991fa3100a5d36025125d0cf1119c471d
Reviewed-on: https://go-review.googlesource.com/35012
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2017-01-16 13:08:31 +00:00
Shenghou Ma abc5fa7ad0 poly1305: make data declared in assembly files private
Update golang/go#18673.

Change-Id: I3ba89bab42f17e6fd7005df40c7a853aef1fda37
Reviewed-on: https://go-review.googlesource.com/35259
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-16 01:45:04 +00:00
Han-Wen Nienhuys 2f8be38b9a ssh: make client auth tests less chatty.
Change-Id: Ib35ce0e7437e32a3fa24a9330c479306b7fa6880
Reviewed-on: https://go-review.googlesource.com/35011
Reviewed-by: Adam Langley <agl@golang.org>
2017-01-13 19:40:33 +00:00
Han-Wen Nienhuys 7c6cc321c6 x/ssh: filter debug and ignore messages in transport.readPacket.
This prevents these messages from confusing higher layers of the
protocol.

Fixes #16927.

Change-Id: If18d8d02bdde3c0470e29a7280cd355d3e55ad78
Reviewed-on: https://go-review.googlesource.com/34959
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
2017-01-10 10:35:34 +00:00
Andrew Gerrand 1d77d5bd47 acme/autocert: fix typo in Cache doc comment
Change-Id: I13dc3119cb46f0649147959c05c6c62624c43690
Reviewed-on: https://go-review.googlesource.com/35070
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-01-10 02:19:11 +00:00
Peter Morjan c3b1d0d6d8 ssh/terminal: consistent return value for Restore
This patch makes the Restore function return nil
on success to be consistent with other functions
like MakeRaw.

Change-Id: I81e63f568787dd88466a5bb30cb87c4c3be75a5c
Reviewed-on: https://go-review.googlesource.com/34952
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-07 18:00:30 +00:00
Lion Yang cb497ae8f1 chacha20poly1305: fix detection of BMI on amd64
This change detects BMI2 usability as an additional condition
to examine the usability of AVX2 version algorithm, fixes
the crash on the platfrom which supports AVX2 but not support BMI2.

Change-Id: I5438d4ec84265c79a51c1439265a33b1be04878a
Reviewed-on: https://go-review.googlesource.com/34852
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-06 18:10:41 +00:00
Joe Tsai 5b4074c2c4 all: fix some vet warnings
Change-Id: I85c2912a6862c6c251450f2a0926ecd33a9fb8e7
Reviewed-on: https://go-review.googlesource.com/34815
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2017-01-04 23:09:04 +00:00
Mikio Hara f6b343c37c blake2b: fix build on non-amd64 platforms
Change-Id: Ib9ebb1a2eff4b61f60453086be5c63ac7af1f7fc
Reviewed-on: https://go-review.googlesource.com/34672
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2016-12-21 23:57:47 +00:00
Martin Kreichgauer f5719d2458 ocsp: Expose ResponderID in parsed Response.
ResponderID is unmarshalled into either ResponderName or
ResponderKeyHash depending on which one is present.

Fixes golang/go#14971.

Change-Id: I5ba602753d81835da531321e94898408395068dd
Reviewed-on: https://go-review.googlesource.com/34380
Reviewed-by: Adam Langley <agl@golang.org>
2016-12-21 17:16:36 +00:00
Andreas Auernhammer d8e61c69ab blake2b: add AVX assembly
Add an AVX implementation and improve SSE4.1 assembly.

AVX vs SSE4.1
name 		old time/op 		new time/op 	delta
Write128-8 	249ns ± 0% 		220ns ± 0% 	-11.85% (p=0.029 n=4+4)
Write1K-8 	1.68µs ± 1% 		1.56µs ± 1% 	-6.71% (p=0.029 n=4+4)
Write32K-8 	52.6µs ± 0% 		48.7µs ± 0% 	-7.40% (p=0.029 n=4+4)
Sum128-8 	264ns ± 0% 		241ns ± 1% 	-8.52% (p=0.029 n=4+4)
Sum1K-8 	1.70µs ± 0% 		1.57µs ± 0% 	-7.79% (p=0.029 n=4+4)
Sum32K-8 	54.1µs ± 3% 		49.5µs ± 1% 	-8.36% (p=0.029 n=4+4)

name 		old speed 		new speed	 delta
Write128-8 	513MB/s ± 0% 		582MB/s ± 0% 	+13.38% (p=0.029 n=4+4)
Write1K-8 	610MB/s ± 1% 		654MB/s ± 1% 	+7.22% (p=0.029 n=4+4)
Write32K-8 	622MB/s ± 0% 		672MB/s ± 0% 	+7.99% (p=0.029 n=4+4)
Sum128-8 	484MB/s ± 1% 		529MB/s ± 0% 	+9.21% (p=0.029 n=4+4)
Sum1K-8 	602MB/s ± 0% 		653MB/s ± 0% 	+8.42% (p=0.029 n=4+4)
Sum32K-8 	607MB/s ± 3% 		662MB/s ± 1% 	+9.03% (p=0.029 n=4+4)

AVX2 vs AVX
name 		old time/op 		new time/op 	delta
Write128-4 	192ns ± 0% 		166ns ± 0% 	-14.03% (p=0.029 n=4+4)
Write1K-4 	1.37µs ± 0% 		1.19µs ± 0% 	-12.65% (p=0.029 n=4+4)
Write32K-4 	42.5µs ± 0% 		37.3µs ± 0% 	-12.33% (p=0.029 n=4+4)
Sum128-4 	213ns ± 0% 		188ns ± 0% 	-11.97% (p=0.029 n=4+4)
Sum1K-4 	1.40µs ± 0% 		1.22µs ± 0% 	-12.85% (p=0.029 n=4+4)
Sum32K-4 	42.8µs ± 0% 		37.3µs ± 0% 	-12.94% (p=0.029 n=4+4)

name 		old speed 		new speed 	delta
Write128-4 	662MB/s ± 0% 		771MB/s ± 0% 	+16.47% (p=0.029 n=4+4)
Write1K-4 	748MB/s ± 0% 		857MB/s ± 0% 	+14.49% (p=0.029 n=4+4)
Write32K-4 	771MB/s ± 0% 		879MB/s ± 0% 	+14.07% (p=0.029 n=4+4)
Sum128-4 	600MB/s ± 0% 		680MB/s ± 0% 	+13.49% (p=0.029 n=4+4)
Sum1K-4 	733MB/s ± 0% 		841MB/s ± 0% 	+14.72% (p=0.029 n=4+4)
Sum32K-4    	765MB/s ± 0%  		879MB/s ± 0%  	+14.85% (p=0.029 n=4+4)

Change-Id: Idf85742e952c07b76c0c7fb5404ed9b0caf0f6eb
Reviewed-on: https://go-review.googlesource.com/34319
Reviewed-by: Adam Langley <agl@golang.org>
2016-12-20 18:11:55 +00:00
Mikio Hara 2b786ab9e9 chacha20poly1305: fix typos
Change-Id: I55a2ad4495f4e1164af6a8504b035cf658f8b822
Reviewed-on: https://go-review.googlesource.com/34536
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-19 15:50:45 +00:00
Mikio Hara abc3c1b020 ssh/terminal: fix a typo
Change-Id: Iafe2ebb6d37afd2a64aa72750a722d4860bb735e
Reviewed-on: https://go-review.googlesource.com/34535
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-19 06:01:35 +00:00
Mikio Hara a70a72a727 chacha20poly1305: fix typos
Change-Id: Icf4ccb29e9eae0fb6fd237ca1d8785d4fd39a8d8
Reviewed-on: https://go-review.googlesource.com/34534
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-19 06:01:24 +00:00
Alex Vaghin 9b1a210a06 acme/autocert: add an option for RSA-based certs
Currently, autocert.Manager always generates EC-based certificates.
This change adds an optional field forcing the Manager to use RSA
instead.

An alternative idea, a "double" certificate, where the Manager
presents either RSA or EC certificate based on client's compatibility,
doesn't seem to be worth the implementation time given the constant
increase in Elliptic Curve cryptography.

Fixes golang/go#17744

Change-Id: Idc68abfc698bcff4aad99715baefc06f8fae50ad
Reviewed-on: https://go-review.googlesource.com/34570
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-16 17:19:27 +00:00
Péter Szilágyi 01be46f620 crypto/ssh: use net.IP.Equal instead of bytes.Equal
A net.IP may be represented by both by a 4 as well as a 16 byte long
byte slice. Because of this, it is not safe to compare IP addresses
using bytes.Equal as the same IP address using a different internal
representation will produce mismatches.

Change-Id: I0d228771cf363ccfb9532f8bc2a2fc8eff61f6e9
Reviewed-on: https://go-review.googlesource.com/34450
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-15 16:25:12 +00:00
Andreas Auernhammer 9a6f0a0198 blake2b: fix constant size
Change-Id: Icae0ec427183d1e319f5a28d6372c823c269d898
Reviewed-on: https://go-review.googlesource.com/34252
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-12 17:50:00 +00:00