Commit Graph
488 Commits
Author SHA1 Message Date
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
Roland Shoemaker b07d8c9677 x/crypto/ocsp: Don't hard-code OCSP response hash function
Allows user to set the hash function to use in the OCSP response
when using ocsp.CreateResponse instead of hard-coding the use of
SHA-1. The field IssuerHash is added to the ocsp.Response struct
to set which hash to use. If none is provided CreateResponse falls
back to SHA1. ParseResponse also attempts to populate this field
and will fail if a unsupported hash algorithm is provided.

Change-Id: I3905b1706f347387724e57c33cb82a3b46ffcdf9
Reviewed-on: https://go-review.googlesource.com/32214
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-12-08 20:19:12 +00:00
Adam Langley 95cb608f36 x/crypto/ssh/terminal: replace \n with \r\n.
911fafb28f made MakeRaw match C's behaviour. This included clearing the
OPOST flag, which means that one now needs to write \r\n for a newline,
otherwise the cursor doesn't move back to the beginning and the terminal
prints a staircase.

(Dear god, we're still emulating line printers.)

This change causes the terminal package to do the required
transformation.

Fixes golang/go#17364.

Change-Id: Ida15d3cf701a21eaa59161ab61b3ed4dee2ded46
Reviewed-on: https://go-review.googlesource.com/33902
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-07 22:17:40 +00:00
David Lazar 3f77d69517 bn256: fix equations in comments
Change-Id: Icb220341756f472ade15f5fc6b91016214233da9
Reviewed-on: https://go-review.googlesource.com/34030
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-06 19:59:59 +00:00
Shenghou Ma 8a549a1948 chacha20poly1305: make polyHashADInternal private
For golang/go#18154.

Change-Id: Ieab8bae9cb8be5e2817a87ae62ac0a2218f63dbb
Reviewed-on: https://go-review.googlesource.com/33855
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-02 06:00:03 +00:00
Adam Langley 7efbae5d10 x/crypto/blake2b: SSE4.1 is bit 19, not 15.
I missed this in the initial review but this will cause blake2b to
SIGILL on, at least, some Atom chips.

Fixes golang/go#18113.

Change-Id: I0c16319df71f3ce4a38411ad4c4e9d3871fd9533
Reviewed-on: https://go-review.googlesource.com/33830
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-12-01 19:22:57 +00:00
Brad Fitzpatrick 21853a76e0 acme/autocert: remove trailing dot from domain before requesting cert
Browsers can send an SNI name of "example.com." for
https://example.com./ but LetsEncrypt rejects the trailing dot.

Fixes golang/go#18114

Change-Id: Ie38e355e5b5566a7eb18f77a2449660e22e21b4c
Reviewed-on: https://go-review.googlesource.com/33711
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-11-30 19:27:24 +00:00
Ryuzo Yamamoto ede567c8e0 x/crypto/ssh: Add FingerprintLegacyMD5 and FingerprintSHA256 methods
Implement a standards-compliant fingerprint format method (RFC 4716 section 4)
and a newer SHA256 fingerprint format method.

Fixes golang/go#12292

Change-Id: I4f3f8fc1d0a263cb3b0964d0078e69006a39d1a5
Reviewed-on: https://go-review.googlesource.com/32814
Reviewed-by: Han-Wen Nienhuys <hanwen@google.com>
Run-TryBot: Han-Wen Nienhuys <hanwen@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-22 14:27:12 +00:00
Alex Vaghin 9477e0b78b chacha20poly1305: fix build constraints
Similarly to https://go-review.googlesource.com/32311,
chacha20poly1305 needs additional build constraints
for non-standard toolchains.

Change-Id: I22816ef333c05450e9ab4debb3ce591518b6b84b
Reviewed-on: https://go-review.googlesource.com/32391
Run-TryBot: Alex Vaghin <ddos@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2016-10-31 18:08:06 +00:00
Adam Langley b2fa06b6af blake2s: fix build constraints
Having a trailing comma before a space doesn't mean that the next option
will be ANDed rather than ORed. This worked with the standard toolchain
because the filenames prevented the incorrect build constraints for
other platforms from being acted on.

Change-Id: Iaee5b60a7496166f23fc36319abe07c7a7ec04e5
Reviewed-on: https://go-review.googlesource.com/32311
Run-TryBot: Adam Langley <agl@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-28 19:53:00 +00:00
Alex Vaghin ca7e7f10cb acme: add v3 implementation to RevokeAuthorization
Let's Encrypt apparently implements authorization revocation as specified
in the v3 of the spec:
https://tools.ietf.org/html/draft-ietf-acme-acme-03#section-6.4.2.

See the relevant boulder source code here:
https://github.com/letsencrypt/boulder/blob/be01ca17d334f73823a9c69afbcf99d777482547/wfe/wfe.go#L1177-L1213

This change makes RevokeAuthorization compatible with both v2 and v3
versions of the spec, as well as Let's Encrypt staging/production
actual implementation.

Change-Id: I7e860944005a55b156a45d96e1b8eb41126ce6bb
Reviewed-on: https://go-review.googlesource.com/31990
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-10-25 16:12:29 +00:00
Adam Langley 1150b8bd09 poly1305: don't move R13 in sum_arm.s.
Rather than change the value of R13 during the execution, keep R13 fixed
(after the initial prelude) and always use offsets from it.

This should help the runtime figure out what's going on if, say, a
signal should occur while running this code.

I've also trimmed the set of saved registers since Go doesn't require
the callee to maintain anything except R10 and R13.

Change-Id: Ifbeca73c1d964cc43bb7f8c20c61066f22fd562d
Reviewed-on: https://go-review.googlesource.com/31717
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-10-24 22:35:48 +00:00
Austin Clements 8291fff38a blake2b: test all three hashing implementations
This adds use* flags for all arches so a common test can observe what
implementations are supported and test all supported implementations.

Change-Id: I0497b91294ed99309074ac4614ac996e006630c5
Reviewed-on: https://go-review.googlesource.com/31714
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andreas Auernhammer <aead@mail.de>
2016-10-24 19:19:48 +00:00
Austin Clements 814723eff7 blake2s: test all four hashing implementations
This adds use* flags for all arches so a common test can observe what
implementations are supported and test all supported implementations.

Change-Id: Icc9c3c1d15626e95f0446493b7fa3159bbe9567d
Reviewed-on: https://go-review.googlesource.com/31712
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
Reviewed-by: Andreas Auernhammer <aead@mail.de>
2016-10-24 19:19:44 +00:00
Austin Clements 3c0d69f177 blake2s: fix frame size of hashBlocksSSE4
The frame is actually 16 bytes plus alignment, not 0.

This fixes the build on Go 1.6.

Change-Id: Id3dcf4e1628791ed55a38a819dcf3c11ecc2f488
Reviewed-on: https://go-review.googlesource.com/31711
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-10-21 21:01:31 +00:00
Austin Clements a9ecc67d46 blake2s: remove NOSPLIT from asm functions
Now that the frame sizes of these functions are correct, the compiler
is detecting that they overflow the NOSPLIT stack. They don't need to
be NOSPLIT, so remove that flag.

This fixes the 1.7 build. The build is not broken at tip because the
stack guard is larger.

Change-Id: Ie32779c819f63b27ec0a77a44b7d20ee2d550843
Reviewed-on: https://go-review.googlesource.com/31667
TryBot-Result: Gobot Gobot <gobot@golang.org>
Run-TryBot: Austin Clements <austin@google.com>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2016-10-21 20:10:06 +00:00
Austin Clements 77e80449e8 sha3: fix SP adjustment
keccakF1600 manually subtracts 200 from SP, but the generated prologue
already does this and the extra subtraction just means keccakF1600 is
defeating the stack growth check.

Remove the unnecessary SP adjustment.

Change-Id: I9450f6b12489bcd20e9ace30f9dd3066025d3a1a
Reviewed-on: https://go-review.googlesource.com/31653
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
2016-10-21 19:51:19 +00:00
Austin Clements 1705134e1b salsa20/salsa: eliminate unnecessary "callee save" prologue/epilogue
SP offsets were adjusted to fill in the now unused callee save area
using the following Python script:

import sys, re
def adj(m):
    delta = int(m.group(1))
    if delta >= 408:
        delta -= (408 - 352)
    return "%d(SP)" % delta
sys.stdout.write(re.sub(r"(\d+)\(SP\)", adj, sys.stdin.read()))

Change-Id: I06675a75d89e5834f804df595868fe4bb8976719
Reviewed-on: https://go-review.googlesource.com/31587
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2016-10-21 19:51:17 +00:00
Austin Clements a0819bbd36 salsa20/salsa: hide SP alignment from spadj
The spadj computation in the assembler can't handle SP alignment code
and will just get confused by how it's currently written. Do the
alignment in a scratch register to hide it from the assembler.

Change-Id: I8857f428d96717db29e3a56050f2381bd86807c6
Reviewed-on: https://go-review.googlesource.com/31586
Run-TryBot: Austin Clements <austin@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Adam Langley <agl@golang.org>
2016-10-21 19:51:15 +00:00
Austin Clements e67f5eca87 blake2b: use proper Go frame sizes
Similar to the previous commit, blake2b's assembly routines claim they
have a zero byte frame and manually subtract a frame from the SP,
which can fail to grow the stack when necessary, leading to memory
corruption.

Fix this by using the correct stack frame sizes so the generated stack
growth prologue is correct, and aligning the SP up instead of down.

Change-Id: Ic426338c45c94a2c01d549860c2295a0ee9200be
Reviewed-on: https://go-review.googlesource.com/31585
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Andreas Auernhammer <aead@mail.de>
2016-10-21 19:51:14 +00:00
Austin Clements 5953a478da blake2s: use proper Go frame sizes
Currently blake2s's assembly routines claim they have a zero byte
frame and manually subtract upwards of 704 bytes from the stack
pointer without cooperating with Go's ABI. As a result, these
functions may not grow the stack when necessary, leading to memory
corruption.

Fix this by using the correct stack frame sizes so the generated stack
growth prologue is correct, and aligning the SP up instead of down.

Change-Id: Ic426338c45c94a2c01d549860c2295a0ee9200bf
Reviewed-on: https://go-review.googlesource.com/31583
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Andreas Auernhammer <aead@mail.de>
Reviewed-by: Minux Ma <minux@golang.org>
2016-10-21 19:51:11 +00:00
Austin Clements f62085100e curve25519: eliminate unnecessary "callee save" prologues
The assembly implementations of ladderstep and mul contain register
save prologues that are unnecessary in Go because there are no callee
save registers in the Go ABI. Remove these prologues, update all SP
offsets, and reduce the frame size accordingly.

The SP offsets were updated with:

python -c 'import sys, re; sys.stdout.write(re.sub(r"(\d+)\(SP\)", lambda m: "%d(SP)" % (int(m.group(1))-YYY), sys.stdin.read()))'

where YYY was 64 for mul_amd64.s and 56 for ladderstep_amd64.s.

Change-Id: I728948809f479b1c061cc65167dadad651efab31
Reviewed-on: https://go-review.googlesource.com/31580
Reviewed-by: Adam Langley <agl@golang.org>
Reviewed-by: Minux Ma <minux@golang.org>
2016-10-21 19:51:09 +00:00