go/src/crypto
Adam Langley af125a5193 crypto/tls: allow renegotiation to be handled by a client.
This change adds Config.Renegotiation which controls whether a TLS
client will accept renegotiation requests from a server. This is used,
for example, by some web servers that wish to “add” a client certificate
to an HTTPS connection.

This is disabled by default because it significantly complicates the
state machine.

Originally, handshakeMutex was taken before locking either Conn.in or
Conn.out. However, if renegotiation is permitted then a handshake may
be triggered during a Read() call. If Conn.in were unlocked before
taking handshakeMutex then a concurrent Read() call could see an
intermediate state and trigger an error. Thus handshakeMutex is now
locked after Conn.in and the handshake functions assume that Conn.in is
locked for the duration of the handshake.

Additionally, handshakeMutex used to protect Conn.out also. With the
possibility of renegotiation that's no longer viable and so
writeRecordLocked has been split off.

Fixes #5742.

Change-Id: I935914db1f185d507ff39bba8274c148d756a1c8
Reviewed-on: https://go-review.googlesource.com/22475
Run-TryBot: Adam Langley <agl@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
2016-04-28 17:56:28 +00:00
..
aes crypto/aes: use asm for BenchmarkExpand on amd64 2016-04-22 18:58:29 +00:00
cipher crypto/cipher: enable fastXORBytes on s390x 2016-04-14 18:26:09 +00:00
des all: remove unnecessary type conversions 2016-04-15 07:31:45 +00:00
dsa crypto/dsa: eliminate invalid PublicKey early 2016-04-05 17:41:47 +00:00
ecdsa crypto/rsa, crypto/ecdsa: fail earlier on zero parameters 2016-04-05 21:03:20 +00:00
elliptic all: fix spelling mistakes 2016-04-03 17:03:15 +00:00
hmac crypto/hmac: simplify implementation 2016-03-25 06:24:00 +00:00
md5 crypto/md5: add s390x assembly implementation 2016-04-27 22:11:41 +00:00
rand all: single space after period. 2016-03-02 00:13:47 +00:00
rc4 all: single space after period. 2016-03-02 00:13:47 +00:00
rsa crypto/rsa, crypto/ecdsa: fail earlier on zero parameters 2016-04-05 21:03:20 +00:00
sha1 crypto/sha1: add s390x assembly implementation 2016-04-22 05:27:51 +00:00
sha256 crypto/sha256: add s390x assembly implementation 2016-04-27 01:39:47 +00:00
sha512 crypto/sha512: add s390x assembly implementation 2016-04-26 17:37:45 +00:00
subtle
tls crypto/tls: allow renegotiation to be handled by a client. 2016-04-28 17:56:28 +00:00
x509 crypto/x509: fix copy/paste-o in error message 2016-04-19 22:31:49 +00:00
crypto.go crypto: document that Signer.Sign does not hash 2016-01-26 16:27:16 +00:00