go 1.11: Switch to GO 1.11

Minimal amount of changes needed to switch to GO 1.11
* crypto/internal/cipherhw was removed and internal/cpu was introduced
* wrong code formatting in handhsake_server_test.go was breaking
  the build
This commit is contained in:
Henry Case 2018-10-16 23:58:43 +01:00 committed by Kris Kwiatkowski
parent 8da51abeca
commit 86b0aecf5e
4 changed files with 20 additions and 8 deletions

View File

@ -5,7 +5,7 @@ services:
- docker - docker
go: go:
- 1.10.x - 1.11.x
env: env:
- TEST_SUITE=test-unit - TEST_SUITE=test-unit

View File

@ -1,4 +1,4 @@
FROM golang:1.10-alpine FROM golang:1.11-alpine
RUN apk add --update \ RUN apk add --update \
git \ git \

View File

@ -7,12 +7,12 @@ package tls
import ( import (
"container/list" "container/list"
"crypto" "crypto"
"crypto/internal/cipherhw"
"crypto/rand" "crypto/rand"
"crypto/sha512" "crypto/sha512"
"crypto/x509" "crypto/x509"
"errors" "errors"
"fmt" "fmt"
"internal/cpu"
"io" "io"
"math/big" "math/big"
"net" "net"
@ -1127,7 +1127,19 @@ func defaultTLS13CipherSuites() []uint16 {
func initDefaultCipherSuites() { func initDefaultCipherSuites() {
var topCipherSuites, topTLS13CipherSuites []uint16 var topCipherSuites, topTLS13CipherSuites []uint16
if cipherhw.AESGCMSupport() {
// Check the cpu flags for each platform that has optimized GCM implementations.
// Worst case, these variables will just all be false
hasGCMAsmAMD64 := cpu.X86.HasAES && cpu.X86.HasPCLMULQDQ
hasGCMAsmARM64 := cpu.ARM64.HasAES && cpu.ARM64.HasPMULL
// Keep in sync with crypto/aes/cipher_s390x.go.
hasGCMAsmS390X := cpu.S390X.HasAES && cpu.S390X.HasAESCBC && cpu.S390X.HasAESCTR && (cpu.S390X.HasGHASH || cpu.S390X.HasAESGCM)
hasGCMAsm := hasGCMAsmAMD64 || hasGCMAsmARM64 || hasGCMAsmS390X
if hasGCMAsm {
// If AES-GCM hardware is provided then prioritise AES-GCM // If AES-GCM hardware is provided then prioritise AES-GCM
// cipher suites. // cipher suites.
topTLS13CipherSuites = []uint16{ topTLS13CipherSuites = []uint16{

View File

@ -197,9 +197,9 @@ func TestDontSelectRSAWithECDSAKey(t *testing.T) {
func TestRenegotiationExtension(t *testing.T) { func TestRenegotiationExtension(t *testing.T) {
clientHello := &clientHelloMsg{ clientHello := &clientHelloMsg{
vers: VersionTLS12, vers: VersionTLS12,
compressionMethods: []uint8{compressionNone}, compressionMethods: []uint8{compressionNone},
random: make([]byte, 32), random: make([]byte, 32),
secureRenegotiationSupported: true, secureRenegotiationSupported: true,
cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA}, cipherSuites: []uint16{TLS_RSA_WITH_RC4_128_SHA},
} }
@ -1002,7 +1002,7 @@ func TestFallbackSCSV(t *testing.T) {
name: "FallbackSCSV", name: "FallbackSCSV",
config: &serverConfig, config: &serverConfig,
// OpenSSL 1.0.1j is needed for the -fallback_scsv option. // OpenSSL 1.0.1j is needed for the -fallback_scsv option.
command: []string{"openssl", "s_client", "-fallback_scsv"}, command: []string{"openssl", "s_client", "-fallback_scsv"},
expectHandshakeErrorIncluding: "inappropriate protocol fallback", expectHandshakeErrorIncluding: "inappropriate protocol fallback",
} }
runServerTestTLS11(t, test) runServerTestTLS11(t, test)