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{