]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.boringcrypto] crypto/tls: restore AES-GCM priority when BoringCrypto is enabled
authorFilippo Valsorda <hi@filippo.io>
Fri, 25 May 2018 22:20:36 +0000 (18:20 -0400)
committerFilippo Valsorda <filippo@golang.org>
Tue, 29 May 2018 18:19:47 +0000 (18:19 +0000)
This patch used to be in crypto/internal/cipherhw.AESGCMSupport which
was removed from the tree. It was meant and documented to affect only
crypto/tls, so move the logic there.

Change-Id: I36ed4f08a5fe2abaab18907910899ae0297d1611
Reviewed-on: https://go-review.googlesource.com/114816
Run-TryBot: Filippo Valsorda <filippo@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Adam Langley <agl@golang.org>
src/crypto/tls/common.go

index c47c432f01aae748caf6b8fcf770d8f24f274a25..897a8e09bc35541251a366dd402086ced3e94294 100644 (file)
@@ -7,6 +7,7 @@ package tls
 import (
        "container/list"
        "crypto"
+       "crypto/internal/boring"
        "crypto/rand"
        "crypto/sha512"
        "crypto/x509"
@@ -945,7 +946,8 @@ func initDefaultCipherSuites() {
 
        hasGCMAsm := hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X
 
-       if hasGCMAsm {
+       if hasGCMAsm || boring.Enabled {
+               // If BoringCrypto is enabled, always prioritize AES-GCM.
                // If AES-GCM hardware is provided then prioritise AES-GCM
                // cipher suites.
                topCipherSuites = []uint16{