]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.boringcrypto] all: merge commit 9d0819b27c (CL 314609) into dev.boringcrypto
authorFilippo Valsorda <filippo@golang.org>
Wed, 12 May 2021 17:23:21 +0000 (19:23 +0200)
committerFilippo Valsorda <filippo@golang.org>
Thu, 13 May 2021 16:59:22 +0000 (12:59 -0400)
There used to be two BoringCrypto-specific behaviors related to cipher
suites in crypto/tls:

1. in FIPS-only mode, only a restricted set of AES ciphers is allowed

2. NOT in FIPS-only mode, AES would be prioritized over ChaCha20 even if
   AES hardware was not available

The motivation of (2) is unclear, and BoringSSL doesn't have equivalent
logic. This merge drops (2), and keeps (1). Note that the list of
FIPS-only ciphers does not have priority semantics anymore, but the
default logic still sorts them the same way as they used to be.

Change-Id: I50544011085cfa2b087f323aebf5338c0bd2dd33

26 files changed:
1  2 
src/cmd/compile/internal/reflectdata/reflect.go
src/cmd/go/go_test.go
src/cmd/go/internal/load/pkg.go
src/cmd/link/internal/ld/lib.go
src/crypto/aes/cipher_asm.go
src/crypto/ecdsa/ecdsa.go
src/crypto/ed25519/ed25519_test.go
src/crypto/ed25519/internal/edwards25519/edwards25519_test.go
src/crypto/rand/rand_unix.go
src/crypto/rsa/pss.go
src/crypto/rsa/pss_test.go
src/crypto/rsa/rsa.go
src/crypto/sha1/sha1_test.go
src/crypto/sha256/sha256_test.go
src/crypto/sha512/sha512_test.go
src/crypto/tls/auth.go
src/crypto/tls/boring.go
src/crypto/tls/cipher_suites.go
src/crypto/tls/common.go
src/crypto/tls/handshake_client.go
src/crypto/tls/handshake_client_tls13.go
src/crypto/tls/handshake_server.go
src/crypto/tls/handshake_server_tls13.go
src/crypto/x509/verify.go
src/go/build/build.go
src/go/build/deps_test.go

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index adb09e409a502c58a4f7910c4308a18708e5f9cc,8a973b36eafb7b3b57923d72e700b97b6062c64f..84fdc3ca8b59fcf219fde18bf6b98c925872b2d8
@@@ -204,6 -185,24 +185,25 @@@ func TestMalleability(t *testing.T) 
        }
  }
  
+ func TestAllocations(t *testing.T) {
++      t.Skip("skipping allocations test on Go+BoringCrypto, as cgo causes allocations")
+       if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-noopt") {
+               t.Skip("skipping allocations test without relevant optimizations")
+       }
+       if allocs := testing.AllocsPerRun(100, func() {
+               seed := make([]byte, SeedSize)
+               message := []byte("Hello, world!")
+               priv := NewKeyFromSeed(seed)
+               pub := priv.Public().(PublicKey)
+               signature := Sign(priv, message)
+               if !Verify(pub, message, signature) {
+                       t.Fatal("signature didn't verify")
+               }
+       }); allocs > 0 {
+               t.Errorf("expected zero allocations, got %0.1v", allocs)
+       }
+ }
  func BenchmarkKeyGeneration(b *testing.B) {
        var zero zeroReader
        for i := 0; i < b.N; i++ {
index 0000000000000000000000000000000000000000,8031256525a53487fcadfbcfee4f971abe9611d0..69fdcfea7ab22a1c52f18a88de716f3eb2911b69
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,304 +1,305 @@@
+ // Copyright (c) 2019 The Go Authors. All rights reserved.
+ // Use of this source code is governed by a BSD-style
+ // license that can be found in the LICENSE file.
+ package edwards25519
+ import (
+       "crypto/ed25519/internal/edwards25519/field"
+       "encoding/hex"
+       "os"
+       "reflect"
+       "strings"
+       "testing"
+ )
+ var B = NewGeneratorPoint()
+ var I = NewIdentityPoint()
+ func checkOnCurve(t *testing.T, points ...*Point) {
+       t.Helper()
+       for i, p := range points {
+               var XX, YY, ZZ, ZZZZ field.Element
+               XX.Square(&p.x)
+               YY.Square(&p.y)
+               ZZ.Square(&p.z)
+               ZZZZ.Square(&ZZ)
+               // -x² + y² = 1 + dx²y²
+               // -(X/Z)² + (Y/Z)² = 1 + d(X/Z)²(Y/Z)²
+               // (-X² + Y²)/Z² = 1 + (dX²Y²)/Z⁴
+               // (-X² + Y²)*Z² = Z⁴ + dX²Y²
+               var lhs, rhs field.Element
+               lhs.Subtract(&YY, &XX).Multiply(&lhs, &ZZ)
+               rhs.Multiply(d, &XX).Multiply(&rhs, &YY).Add(&rhs, &ZZZZ)
+               if lhs.Equal(&rhs) != 1 {
+                       t.Errorf("X, Y, and Z do not specify a point on the curve\nX = %v\nY = %v\nZ = %v", p.x, p.y, p.z)
+               }
+               // xy = T/Z
+               lhs.Multiply(&p.x, &p.y)
+               rhs.Multiply(&p.z, &p.t)
+               if lhs.Equal(&rhs) != 1 {
+                       t.Errorf("point %d is not valid\nX = %v\nY = %v\nZ = %v", i, p.x, p.y, p.z)
+               }
+       }
+ }
+ func TestGenerator(t *testing.T) {
+       // These are the coordinates of B from RFC 8032, Section 5.1, converted to
+       // little endian hex.
+       x := "1ad5258f602d56c9b2a7259560c72c695cdcd6fd31e2a4c0fe536ecdd3366921"
+       y := "5866666666666666666666666666666666666666666666666666666666666666"
+       if got := hex.EncodeToString(B.x.Bytes()); got != x {
+               t.Errorf("wrong B.x: got %s, expected %s", got, x)
+       }
+       if got := hex.EncodeToString(B.y.Bytes()); got != y {
+               t.Errorf("wrong B.y: got %s, expected %s", got, y)
+       }
+       if B.z.Equal(feOne) != 1 {
+               t.Errorf("wrong B.z: got %v, expected 1", B.z)
+       }
+       // Check that t is correct.
+       checkOnCurve(t, B)
+ }
+ func TestAddSubNegOnBasePoint(t *testing.T) {
+       checkLhs, checkRhs := &Point{}, &Point{}
+       checkLhs.Add(B, B)
+       tmpP2 := new(projP2).FromP3(B)
+       tmpP1xP1 := new(projP1xP1).Double(tmpP2)
+       checkRhs.fromP1xP1(tmpP1xP1)
+       if checkLhs.Equal(checkRhs) != 1 {
+               t.Error("B + B != [2]B")
+       }
+       checkOnCurve(t, checkLhs, checkRhs)
+       checkLhs.Subtract(B, B)
+       Bneg := new(Point).Negate(B)
+       checkRhs.Add(B, Bneg)
+       if checkLhs.Equal(checkRhs) != 1 {
+               t.Error("B - B != B + (-B)")
+       }
+       if I.Equal(checkLhs) != 1 {
+               t.Error("B - B != 0")
+       }
+       if I.Equal(checkRhs) != 1 {
+               t.Error("B + (-B) != 0")
+       }
+       checkOnCurve(t, checkLhs, checkRhs, Bneg)
+ }
+ func TestComparable(t *testing.T) {
+       if reflect.TypeOf(Point{}).Comparable() {
+               t.Error("Point is unexpectedly comparable")
+       }
+ }
+ func TestInvalidEncodings(t *testing.T) {
+       // An invalid point, that also happens to have y > p.
+       invalid := "efffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"
+       p := NewGeneratorPoint()
+       if out, err := p.SetBytes(decodeHex(invalid)); err == nil {
+               t.Error("expected error for invalid point")
+       } else if out != nil {
+               t.Error("SetBytes did not return nil on an invalid encoding")
+       } else if p.Equal(B) != 1 {
+               t.Error("the Point was modified while decoding an invalid encoding")
+       }
+       checkOnCurve(t, p)
+ }
+ func TestNonCanonicalPoints(t *testing.T) {
+       type test struct {
+               name                string
+               encoding, canonical string
+       }
+       tests := []test{
+               // Points with x = 0 and the sign bit set. With x = 0 the curve equation
+               // gives y² = 1, so y = ±1. 1 has two valid encodings.
+               {
+                       "y=1,sign-",
+                       "0100000000000000000000000000000000000000000000000000000000000080",
+                       "0100000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+1,sign-",
+                       "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0100000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p-1,sign-",
+                       "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+               },
+               // Non-canonical y encodings with values 2²⁵⁵-19 (p) to 2²⁵⁵-1 (p+18).
+               {
+                       "y=p,sign+",
+                       "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0000000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p,sign-",
+                       "edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0000000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+1,sign+",
+                       "eeffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0100000000000000000000000000000000000000000000000000000000000000",
+               },
+               // "y=p+1,sign-" is already tested above.
+               // p+2 is not a valid y-coordinate.
+               {
+                       "y=p+3,sign+",
+                       "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0300000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+3,sign-",
+                       "f0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0300000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+4,sign+",
+                       "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0400000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+4,sign-",
+                       "f1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0400000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+5,sign+",
+                       "f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0500000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+5,sign-",
+                       "f2ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0500000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+6,sign+",
+                       "f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0600000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+6,sign-",
+                       "f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0600000000000000000000000000000000000000000000000000000000000080",
+               },
+               // p+7 is not a valid y-coordinate.
+               // p+8 is not a valid y-coordinate.
+               {
+                       "y=p+9,sign+",
+                       "f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0900000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+9,sign-",
+                       "f6ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0900000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+10,sign+",
+                       "f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0a00000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+10,sign-",
+                       "f7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0a00000000000000000000000000000000000000000000000000000000000080",
+               },
+               // p+11 is not a valid y-coordinate.
+               // p+12 is not a valid y-coordinate.
+               // p+13 is not a valid y-coordinate.
+               {
+                       "y=p+14,sign+",
+                       "fbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0e00000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+14,sign-",
+                       "fbffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0e00000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+15,sign+",
+                       "fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "0f00000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+15,sign-",
+                       "fcffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "0f00000000000000000000000000000000000000000000000000000000000080",
+               },
+               {
+                       "y=p+16,sign+",
+                       "fdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "1000000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+16,sign-",
+                       "fdffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "1000000000000000000000000000000000000000000000000000000000000080",
+               },
+               // p+17 is not a valid y-coordinate.
+               {
+                       "y=p+18,sign+",
+                       "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
+                       "1200000000000000000000000000000000000000000000000000000000000000",
+               },
+               {
+                       "y=p+18,sign-",
+                       "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
+                       "1200000000000000000000000000000000000000000000000000000000000080",
+               },
+       }
+       for _, tt := range tests {
+               t.Run(tt.name, func(t *testing.T) {
+                       p1, err := new(Point).SetBytes(decodeHex(tt.encoding))
+                       if err != nil {
+                               t.Fatalf("error decoding non-canonical point: %v", err)
+                       }
+                       p2, err := new(Point).SetBytes(decodeHex(tt.canonical))
+                       if err != nil {
+                               t.Fatalf("error decoding canonical point: %v", err)
+                       }
+                       if p1.Equal(p2) != 1 {
+                               t.Errorf("equivalent points are not equal: %v, %v", p1, p2)
+                       }
+                       if encoding := hex.EncodeToString(p1.Bytes()); encoding != tt.canonical {
+                               t.Errorf("re-encoding does not match canonical; got %q, expected %q", encoding, tt.canonical)
+                       }
+                       checkOnCurve(t, p1, p2)
+               })
+       }
+ }
+ var testAllocationsSink byte
+ func TestAllocations(t *testing.T) {
++      t.Skip("skipping allocations test on Go+BoringCrypto, as cgo causes allocations")
+       if strings.HasSuffix(os.Getenv("GO_BUILDER_NAME"), "-noopt") {
+               t.Skip("skipping allocations test without relevant optimizations")
+       }
+       if allocs := testing.AllocsPerRun(100, func() {
+               p := NewIdentityPoint()
+               p.Add(p, NewGeneratorPoint())
+               s := NewScalar()
+               testAllocationsSink ^= s.Bytes()[0]
+               testAllocationsSink ^= p.Bytes()[0]
+       }); allocs > 0 {
+               t.Errorf("expected zero allocations, got %0.1v", allocs)
+       }
+ }
+ func decodeHex(s string) []byte {
+       b, err := hex.DecodeString(s)
+       if err != nil {
+               panic(err)
+       }
+       return b
+ }
Simple merge
Simple merge
index 32f6f0c3aa93dc92c776902ab2fbbc6b141e3f54,c3a6d468497cd44ef38023e3d97a4b2e6dbc38d1..51f97601878e2cf3986986e44f6098dca1ad46ae
@@@ -9,9 -9,10 +9,9 @@@ import 
        "bytes"
        "compress/bzip2"
        "crypto"
 -      _ "crypto/md5"
        "crypto/rand"
        "crypto/sha1"
-       "crypto/sha256"
+       "crypto/sha256"
        "encoding/hex"
        "math/big"
        "os"
Simple merge
Simple merge
Simple merge
Simple merge
index 17595f0c358fae882e90faa9a913d986a6ea8f6f,a9df0da6d624b1b39b3b0813a93573e0319e1ac1..7c5675c6d933bb88dc53153f2b94bdf2920b824d
@@@ -169,6 -169,6 +169,7 @@@ var rsaSignatureSchemes = []struct 
  // and optionally filtered by its explicit SupportedSignatureAlgorithms.
  //
  // This function must be kept in sync with supportedSignatureAlgorithms.
++// FIPS filtering is applied in the caller, selectSignatureScheme.
  func signatureSchemesForCertificate(version uint16, cert *Certificate) []SignatureScheme {
        priv, ok := cert.PrivateKey.(crypto.Signer)
        if !ok {
index d61deb5b81785412730bbc3134a0e405f8f405df,0000000000000000000000000000000000000000..09f71c1691c12652666b180c38d7623f9cb66e6c
mode 100644,000000..100644
--- /dev/null
@@@ -1,132 -1,0 +1,127 @@@
-       "crypto/internal/boring"
 +// Copyright 2017 The Go Authors. All rights reserved.
 +// Use of this source code is governed by a BSD-style
 +// license that can be found in the LICENSE file.
 +
 +package tls
 +
 +import (
 +      "crypto/ecdsa"
- // boringEnabled is an alias of boring.Enabled to avoid a new import in common.go.
- const boringEnabled = boring.Enabled
 +      "crypto/internal/boring/fipstls"
 +      "crypto/rsa"
 +      "crypto/x509"
 +)
 +
- // default FIPSCipherSuites is the FIPS-allowed cipher suites,
- // in preference order (most preferable first).
- var defaultFIPSCipherSuites = []uint16{
 +// needFIPS returns fipstls.Required(); it avoids a new import in common.go.
 +func needFIPS() bool {
 +      return fipstls.Required()
 +}
 +
 +// fipsMinVersion replaces c.minVersion in FIPS-only mode.
 +func fipsMinVersion(c *Config) uint16 {
 +      // FIPS requires TLS 1.2.
 +      return VersionTLS12
 +}
 +
 +// fipsMaxVersion replaces c.maxVersion in FIPS-only mode.
 +func fipsMaxVersion(c *Config) uint16 {
 +      // FIPS requires TLS 1.2.
 +      return VersionTLS12
 +}
 +
 +// default defaultFIPSCurvePreferences is the FIPS-allowed curves,
 +// in preference order (most preferable first).
 +var defaultFIPSCurvePreferences = []CurveID{CurveP256, CurveP384, CurveP521}
 +
 +// fipsCurvePreferences replaces c.curvePreferences in FIPS-only mode.
 +func fipsCurvePreferences(c *Config) []CurveID {
 +      if c == nil || len(c.CurvePreferences) == 0 {
 +              return defaultFIPSCurvePreferences
 +      }
 +      var list []CurveID
 +      for _, id := range c.CurvePreferences {
 +              for _, allowed := range defaultFIPSCurvePreferences {
 +                      if id == allowed {
 +                              list = append(list, id)
 +                              break
 +                      }
 +              }
 +      }
 +      return list
 +}
 +
-               return defaultFIPSCipherSuites
++// defaultCipherSuitesFIPS are the FIPS-allowed cipher suites.
++var defaultCipherSuitesFIPS = []uint16{
 +      TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,
 +      TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,
 +      TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,
 +      TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,
 +      TLS_RSA_WITH_AES_128_GCM_SHA256,
 +      TLS_RSA_WITH_AES_256_GCM_SHA384,
 +}
 +
 +// fipsCipherSuites replaces c.cipherSuites in FIPS-only mode.
 +func fipsCipherSuites(c *Config) []uint16 {
 +      if c == nil || c.CipherSuites == nil {
-       var list []uint16
++              return defaultCipherSuitesFIPS
 +      }
-               for _, allowed := range defaultFIPSCipherSuites {
++      list := make([]uint16, 0, len(defaultCipherSuitesFIPS))
 +      for _, id := range c.CipherSuites {
++              for _, allowed := range defaultCipherSuitesFIPS {
 +                      if id == allowed {
 +                              list = append(list, id)
 +                              break
 +                      }
 +              }
 +      }
 +      return list
 +}
 +
 +// isBoringCertificate reports whether a certificate may be used
 +// when constructing a verified chain.
 +// It is called for each leaf, intermediate, and root certificate.
 +func isBoringCertificate(c *x509.Certificate) bool {
 +      if !needFIPS() {
 +              // Everything is OK if we haven't forced FIPS-only mode.
 +              return true
 +      }
 +
 +      // Otherwise the key must be RSA 2048, RSA 3072, or ECDSA P-256.
 +      switch k := c.PublicKey.(type) {
 +      default:
 +              return false
 +      case *rsa.PublicKey:
 +              if size := k.N.BitLen(); size != 2048 && size != 3072 {
 +                      return false
 +              }
 +      case *ecdsa.PublicKey:
 +              if name := k.Curve.Params().Name; name != "P-256" && name != "P-384" {
 +                      return false
 +              }
 +      }
 +
 +      return true
 +}
 +
 +// fipsSupportedSignatureAlgorithms currently are a subset of
 +// defaultSupportedSignatureAlgorithms without Ed25519 and SHA-1.
 +var fipsSupportedSignatureAlgorithms = []SignatureScheme{
 +      PSSWithSHA256,
 +      PSSWithSHA384,
 +      PSSWithSHA512,
 +      PKCS1WithSHA256,
 +      ECDSAWithP256AndSHA256,
 +      PKCS1WithSHA384,
 +      ECDSAWithP384AndSHA384,
 +      PKCS1WithSHA512,
 +      ECDSAWithP521AndSHA512,
 +}
 +
 +// supportedSignatureAlgorithms returns the supported signature algorithms.
 +func supportedSignatureAlgorithms() []SignatureScheme {
 +      if !needFIPS() {
 +              return defaultSupportedSignatureAlgorithms
 +      }
 +      return fipsSupportedSignatureAlgorithms
 +}
 +
 +var testingOnlyForceClientHelloSignatureAlgorithms []SignatureScheme
index 6596562fb13ecfa8f7aeec0455a48775e6392f39,4bf06468c6dae4741d0302b15b77f5219bc054ad..e07d742bd3b2d018c3215f7e0f3354bf6af2403f
@@@ -349,13 -510,7 +518,16 @@@ func aeadAESGCM(key, noncePrefix []byte
        if err != nil {
                panic(err)
        }
 -      aead, err := cipher.NewGCM(aes)
++      type gcmtls interface {
++              NewGCMTLS() (cipher.AEAD, error)
++      }
 +      var aead cipher.AEAD
 +      if aesTLS, ok := aes.(gcmtls); ok {
 +              aead, err = aesTLS.NewGCMTLS()
 +      } else {
 +              boring.Unreachable()
 +              aead, err = cipher.NewGCM(aes)
 +      }
        if err != nil {
                panic(err)
        }
index 2564dfee9e4cd9cc1f9a2c1be839ee5cd4b39388,77957ef82bd9d3752e31a422314be9d932a65d64..ca93d4341d5de5895e69fa45e853bcc66be665d6
@@@ -925,14 -951,10 +951,13 @@@ func (c *Config) time() time.Time 
  }
  
  func (c *Config) cipherSuites() []uint16 {
-       s := c.CipherSuites
-       if s == nil {
-               s = defaultCipherSuites()
 +      if needFIPS() {
 +              return fipsCipherSuites(c)
 +      }
+       if c.CipherSuites != nil {
+               return c.CipherSuites
        }
-       return s
+       return defaultCipherSuites
  }
  
  var supportedVersions = []uint16{
Simple merge
Simple merge
Simple merge
Simple merge
index e04b07d3a993a918392f17a8ecdc077afbcbe350,bb6d92f89acacf9986d0dbffe47d32c327d119b3..a2423cf0d932435b970a150475506be42174d175
@@@ -390,15 -392,21 +395,16 @@@ var depsRules = 
        < crypto
        < crypto/subtle
        < crypto/internal/subtle
+       < crypto/ed25519/internal/edwards25519/field
+       < crypto/ed25519/internal/edwards25519
        < crypto/cipher
 +      < encoding/asn1
 +      < crypto/internal/boring
        < crypto/aes, crypto/des, crypto/hmac, crypto/md5, crypto/rc4,
          crypto/sha1, crypto/sha256, crypto/sha512
 -      < CRYPTO;
 -
 -      CGO, fmt, net !< CRYPTO;
 -
 -      # CRYPTO-MATH is core bignum-based crypto - no cgo, net; fmt now ok.
 -      CRYPTO, FMT, math/big
        < crypto/rand
        < crypto/internal/randutil
-       < crypto/ed25519/internal/edwards25519
        < crypto/ed25519
 -      < encoding/asn1
        < golang.org/x/crypto/cryptobyte/asn1
        < golang.org/x/crypto/cryptobyte
        < golang.org/x/crypto/curve25519