]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[dev.boringcrypto] all: merge master into dev.boringcrypto
authorRoland Shoemaker <roland@golang.org>
Fri, 5 Nov 2021 18:08:36 +0000 (11:08 -0700)
committerRoland Shoemaker <roland@golang.org>
Fri, 5 Nov 2021 20:13:16 +0000 (13:13 -0700)
Change-Id: I1aa33cabd0c55fe64994b08f8a3f7b6bbfb3282c

15 files changed:
1  2 
api/go1.9.txt
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/rand/rand_unix.go
src/crypto/sha1/sha1_test.go
src/crypto/sha256/sha256_test.go
src/crypto/sha512/sha512_test.go
src/crypto/tls/common.go
src/crypto/x509/verify.go
src/go/build/build.go
src/go/build/deps_test.go

diff --cc api/go1.9.txt
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 1a7635ec2be3364981b845f298f989c4c267fb0e,282596d2d2df5e725bbdc11e1c0d2413d6e5e60a..4be0026b9a5dc4914041c13bf741e9d42084a678
@@@ -227,21 -200,8 +227,17 @@@ var errZeroParam = errors.New("zero par
  func Sign(rand io.Reader, priv *PrivateKey, hash []byte) (r, s *big.Int, err error) {
        randutil.MaybeReadByte(rand)
  
-       // Get min(log2(q) / 2, 256) bits of entropy from rand.
-       entropylen := (priv.Curve.Params().BitSize + 7) / 16
-       if entropylen > 32 {
-               entropylen = 32
-       }
-       entropy := make([]byte, entropylen)
 +      if boring.Enabled && rand == boring.RandReader {
 +              b, err := boringPrivateKey(priv)
 +              if err != nil {
 +                      return nil, nil, err
 +              }
 +              return boring.SignECDSA(b, hash)
 +      }
 +      boring.UnreachableExceptTests()
 +
+       // Get 256 bits of entropy from rand.
+       entropy := make([]byte, 32)
        _, err = io.ReadFull(rand, entropy)
        if err != nil {
                return
Simple merge
index e369c3b7f491eee1e7cc2f30d1b6aa616b202fa9,ab43c7792d4949800532408cd407fe33ce4c31e1..f1a5448dd2dd75eb18b405c4237b9cf2dc93f063
@@@ -218,6 -210,20 +218,23 @@@ func TestLargeHashes(t *testing.T) 
        }
  }
  
+ func TestAllocations(t *testing.T) {
++      if boring.Enabled {
++              t.Skip("BoringCrypto doesn't allocate the same way as stdlib")
++      }
+       in := []byte("hello, world!")
+       out := make([]byte, 0, Size)
+       h := New()
+       n := int(testing.AllocsPerRun(10, func() {
+               h.Reset()
+               h.Write(in)
+               out = h.Sum(out[:0])
+       }))
+       if n > 0 {
+               t.Errorf("allocs = %d, want 0", n)
+       }
+ }
  var bench = New()
  var buf = make([]byte, 8192)
  
index 91a4edde047f68bb85ea9f635f746e45bb454ff7,702aa0b371abb6d65b57c235479f7bcedcc14277..a762afc4d9e8ff6878ec0ed1202e36972d47e8eb
@@@ -294,6 -289,20 +294,23 @@@ func TestLargeHashes(t *testing.T) 
        }
  }
  
+ func TestAllocations(t *testing.T) {
++      if boring.Enabled {
++              t.Skip("BoringCrypto doesn't allocate the same way as stdlib")
++      }
+       in := []byte("hello, world!")
+       out := make([]byte, 0, Size)
+       h := New()
+       n := int(testing.AllocsPerRun(10, func() {
+               h.Reset()
+               h.Write(in)
+               out = h.Sum(out[:0])
+       }))
+       if n > 0 {
+               t.Errorf("allocs = %d, want 0", n)
+       }
+ }
  var bench = New()
  var buf = make([]byte, 8192)
  
index 966cd51d157ae31d3932a670f92586848e7fdc5e,aea772c7da5e60a4df3d2e85fee0025b87497c86..99d1423527bb5ee37f5b0cc4de99f8bfeeef4aa9
@@@ -893,6 -888,20 +893,23 @@@ func TestLargeHashes(t *testing.T) 
        }
  }
  
+ func TestAllocations(t *testing.T) {
++      if boring.Enabled {
++              t.Skip("BoringCrypto doesn't allocate the same way as stdlib")
++      }
+       in := []byte("hello, world!")
+       out := make([]byte, 0, Size)
+       h := New()
+       n := int(testing.AllocsPerRun(10, func() {
+               h.Reset()
+               h.Write(in)
+               out = h.Sum(out[:0])
+       }))
+       if n > 0 {
+               t.Errorf("allocs = %d, want 0", n)
+       }
+ }
  var bench = New()
  var buf = make([]byte, 8192)
  
Simple merge
Simple merge
Simple merge
index 7e43445a0739664fc915c11abd183fc793657f25,1dd65d60d9a74126509d73f27db5a2e865b347c0..9b5dabf6f144156d8f0e5be05058470bf876b9ae
@@@ -398,13 -407,18 +410,14 @@@ var depsRules = 
        < crypto/subtle
        < crypto/internal/subtle
        < crypto/elliptic/internal/fiat
-       < crypto/ed25519/internal/edwards25519/field
+       < crypto/elliptic/internal/nistec
+       < crypto/ed25519/internal/edwards25519/field, golang.org/x/crypto/curve25519/internal/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