Fork of the Go standard TLS library, providing low-level access to the ClientHello for mimicry purposes.
Find a file
Filippo Valsorda 89df05a1c4 crypto/tls: make cipher suite preference ordering automatic
We now have a (well, two, depending on AES hardware support) universal
cipher suite preference order, based on their security and performance.
Peer and application lists are now treated as filters (and AES hardware
support hints) that are applied to this universal order.

This removes a complex and nuanced decision from the application's
responsibilities, one which we are better equipped to make and which
applications usually don't need to have an opinion about. It also lets
us worry less about what suites we support or enable, because we can be
confident that bad ones won't be selected over good ones.

This also moves 3DES suites to InsecureCipherSuites(), even if they are
not disabled by default. Just because we can keep them as a last resort
it doesn't mean they are secure. Thankfully we had not promised that
Insecure means disabled by default.

Notable test changes:

  - TestCipherSuiteCertPreferenceECDSA was testing that we'd pick the
    right certificate regardless of CipherSuite ordering, which is now
    completely ignored, as tested by TestCipherSuitePreference. Removed.

  - The openssl command of TestHandshakeServerExportKeyingMaterial was
    broken for TLS 1.0 in CL 262857, but its golden file was not
    regenerated, so the test kept passing. It now broke because the
    selected suite from the ones in the golden file changed.

  - In TestAESCipherReordering, "server strongly prefers AES-GCM" is
    removed because there is no way for a server to express a strong
    preference anymore; "client prefers AES-GCM and AES-CBC over ChaCha"
    switched to ChaCha20 when the server lacks AES hardware; and finally
    "client supports multiple AES-GCM" changed to always prefer AES-128
    per the universal preference list.

    * this is going back on an explicit decision from CL 262857, and
      while that client order is weird and does suggest a strong dislike
      for ChaCha20, we have a strong dislike for software AES, so it
      didn't feel worth making the logic more complex

  - All Client-* golden files had to be regenerated because the
    ClientHello cipher suites have changed.
    (Even when Config.CipherSuites was limited to one suite, the TLS 1.3
    default order changed.)

Fixes #45430
Fixes #41476 (as 3DES is now always the last resort)

Change-Id: If5f5d356c0f8d1f1c7542fb06644a478d6bad1e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/314609
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Roland Shoemaker <roland@golang.org>
Trust: Filippo Valsorda <filippo@golang.org>
2021-05-08 05:15:48 +00:00
testdata crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
alert.go crypto/tls: add missing alert values 2020-04-01 19:32:57 +00:00
auth.go crypto: fix PKCS space in docs 2020-07-08 17:21:49 +00:00
auth_test.go crypto/tls: add {SignatureScheme,CurveID,ClientAuthType}.String() 2020-03-11 20:02:18 +00:00
cipher_suites.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
common.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
common_string.go crypto/tls: add {SignatureScheme,CurveID,ClientAuthType}.String() 2020-03-11 20:02:18 +00:00
conn.go crypto/tls: add HandshakeContext method to Conn 2021-03-16 14:05:45 +00:00
conn_test.go crypto/tls: select only compatible chains from Certificates 2019-11-12 01:08:57 +00:00
example_test.go crypto/tls: replace VerifyPeerCertificate example with VerifyConnection 2020-06-24 20:48:12 +00:00
generate_cert.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
handshake_client.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
handshake_client_test.go crypto/tls: enforce ALPN overlap when negotiated on both sides 2021-05-06 18:57:43 +00:00
handshake_client_tls13.go crypto/tls: add HandshakeContext method to Conn 2021-03-16 14:05:45 +00:00
handshake_messages.go crypto/tls: send ec_points_format extension in ServerHello 2019-10-31 15:14:45 +00:00
handshake_messages_test.go crypto/tls: rotate session keys in older TLS versions 2020-05-07 18:33:39 +00:00
handshake_server.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
handshake_server_test.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
handshake_server_tls13.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
handshake_test.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
handshake_unix_test.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
key_agreement.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00
key_schedule.go math/big: add (*Int).FillBytes 2020-05-05 00:36:44 +00:00
key_schedule_test.go crypto/tls: implement TLS 1.3 cryptographic computations 2018-11-02 21:54:52 +00:00
link_test.go all: update to use os.ReadFile, os.WriteFile, os.CreateTemp, os.MkdirTemp 2020-12-09 19:12:23 +00:00
prf.go crypto/tls: improve error messages for invalid certificates and signatures 2019-10-30 20:18:59 +00:00
prf_test.go crypto/tls: remove SSLv3 support 2019-08-27 22:24:05 +00:00
ticket.go crypto/tls: remove version check when unmarshaling sessionState 2020-05-18 23:09:31 +00:00
tls.go crypto/tls: add HandshakeContext method to Conn 2021-03-16 14:05:45 +00:00
tls_test.go crypto/tls: make cipher suite preference ordering automatic 2021-05-08 05:15:48 +00:00