diff options
Diffstat (limited to 'src/crypto')
| -rw-r--r-- | src/crypto/cipher/ctr_aes_test.go | 4 | ||||
| -rw-r--r-- | src/crypto/internal/cryptotest/aead.go | 8 | ||||
| -rw-r--r-- | src/crypto/internal/cryptotest/hash.go | 4 | ||||
| -rw-r--r-- | src/crypto/md5/md5_test.go | 2 | ||||
| -rw-r--r-- | src/crypto/sha1/sha1_test.go | 4 | ||||
| -rw-r--r-- | src/crypto/sha256/sha256_test.go | 4 | ||||
| -rw-r--r-- | src/crypto/subtle/constant_time_test.go | 8 |
7 files changed, 17 insertions, 17 deletions
diff --git a/src/crypto/cipher/ctr_aes_test.go b/src/crypto/cipher/ctr_aes_test.go index d019ae0d02..c82a8757ab 100644 --- a/src/crypto/cipher/ctr_aes_test.go +++ b/src/crypto/cipher/ctr_aes_test.go @@ -80,7 +80,7 @@ func TestCTR_AES(t *testing.T) { ctr := cipher.NewCTR(c, tt.iv) encrypted := make([]byte, len(in)) ctr.XORKeyStream(encrypted, in) - if out := tt.out[0:len(in)]; !bytes.Equal(out, encrypted) { + if out := tt.out[:len(in)]; !bytes.Equal(out, encrypted) { t.Errorf("%s/%d: CTR\ninpt %x\nhave %x\nwant %x", test, len(in), in, encrypted, out) } } @@ -90,7 +90,7 @@ func TestCTR_AES(t *testing.T) { ctr := cipher.NewCTR(c, tt.iv) plain := make([]byte, len(in)) ctr.XORKeyStream(plain, in) - if out := tt.in[0:len(in)]; !bytes.Equal(out, plain) { + if out := tt.in[:len(in)]; !bytes.Equal(out, plain) { t.Errorf("%s/%d: CTRReader\nhave %x\nwant %x", test, len(out), plain, out) } } diff --git a/src/crypto/internal/cryptotest/aead.go b/src/crypto/internal/cryptotest/aead.go index e17cdf8cb8..a6107e5419 100644 --- a/src/crypto/internal/cryptotest/aead.go +++ b/src/crypto/internal/cryptotest/aead.go @@ -204,8 +204,8 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { out := sealMsg(t, aead, prefix, nonce, plaintext, addData) // Check that Seal didn't alter the prefix - if !bytes.Equal(out[0:len(prefix)], prefix) { - t.Errorf("Seal alters dst instead of appending; got %s, want %s", truncateHex(out[0:len(prefix)]), truncateHex(prefix)) + if !bytes.Equal(out[:len(prefix)], prefix) { + t.Errorf("Seal alters dst instead of appending; got %s, want %s", truncateHex(out[:len(prefix)]), truncateHex(prefix)) } ciphertext := out[len(prefix):] @@ -237,8 +237,8 @@ func TestAEAD(t *testing.T, mAEAD MakeAEAD) { out := openWithoutError(t, aead, prefix, nonce, ciphertext, addData) // Check that Open didn't alter the prefix - if !bytes.Equal(out[0:len(prefix)], prefix) { - t.Errorf("Open alters dst instead of appending; got %s, want %s", truncateHex(out[0:len(prefix)]), truncateHex(prefix)) + if !bytes.Equal(out[:len(prefix)], prefix) { + t.Errorf("Open alters dst instead of appending; got %s, want %s", truncateHex(out[:len(prefix)]), truncateHex(prefix)) } after := out[len(prefix):] diff --git a/src/crypto/internal/cryptotest/hash.go b/src/crypto/internal/cryptotest/hash.go index a950dcb282..f03623dfa2 100644 --- a/src/crypto/internal/cryptotest/hash.go +++ b/src/crypto/internal/cryptotest/hash.go @@ -39,8 +39,8 @@ func TestHash(t *testing.T, mh MakeHash) { sum := getSum(t, h, prefix) // Append new digest to prefix // Check that Sum didn't alter the prefix - if !bytes.Equal(sum[0:len(prefix)], prefix) { - t.Errorf("Sum alters passed buffer instead of appending; got %x, want %x", sum[0:len(prefix)], prefix) + if !bytes.Equal(sum[:len(prefix)], prefix) { + t.Errorf("Sum alters passed buffer instead of appending; got %x, want %x", sum[:len(prefix)], prefix) } // Check that the appended sum wasn't affected by the prefix diff --git a/src/crypto/md5/md5_test.go b/src/crypto/md5/md5_test.go index c445b10832..6a8258a67e 100644 --- a/src/crypto/md5/md5_test.go +++ b/src/crypto/md5/md5_test.go @@ -69,7 +69,7 @@ func TestGolden(t *testing.T) { if j < 2 { io.WriteString(c, g.in) } else if j == 2 { - io.WriteString(c, g.in[0:len(g.in)/2]) + io.WriteString(c, g.in[:len(g.in)/2]) c.Sum(nil) io.WriteString(c, g.in[len(g.in)/2:]) } else if j > 2 { diff --git a/src/crypto/sha1/sha1_test.go b/src/crypto/sha1/sha1_test.go index 32b01d4dee..d03892c57d 100644 --- a/src/crypto/sha1/sha1_test.go +++ b/src/crypto/sha1/sha1_test.go @@ -74,7 +74,7 @@ func TestGolden(t *testing.T) { io.WriteString(c, g.in) sum = c.Sum(nil) case 2: - io.WriteString(c, g.in[0:len(g.in)/2]) + io.WriteString(c, g.in[:len(g.in)/2]) c.Sum(nil) io.WriteString(c, g.in[len(g.in)/2:]) sum = c.Sum(nil) @@ -82,7 +82,7 @@ func TestGolden(t *testing.T) { if boring.Enabled { continue } - io.WriteString(c, g.in[0:len(g.in)/2]) + io.WriteString(c, g.in[:len(g.in)/2]) c.(*digest).ConstantTimeSum(nil) io.WriteString(c, g.in[len(g.in)/2:]) sum = c.(*digest).ConstantTimeSum(nil) diff --git a/src/crypto/sha256/sha256_test.go b/src/crypto/sha256/sha256_test.go index 92268f32da..3237c6a73e 100644 --- a/src/crypto/sha256/sha256_test.go +++ b/src/crypto/sha256/sha256_test.go @@ -104,7 +104,7 @@ func TestGolden(t *testing.T) { if j < 2 { io.WriteString(c, g.in) } else { - io.WriteString(c, g.in[0:len(g.in)/2]) + io.WriteString(c, g.in[:len(g.in)/2]) c.Sum(nil) io.WriteString(c, g.in[len(g.in)/2:]) } @@ -126,7 +126,7 @@ func TestGolden(t *testing.T) { if j < 2 { io.WriteString(c, g.in) } else { - io.WriteString(c, g.in[0:len(g.in)/2]) + io.WriteString(c, g.in[:len(g.in)/2]) c.Sum(nil) io.WriteString(c, g.in[len(g.in)/2:]) } diff --git a/src/crypto/subtle/constant_time_test.go b/src/crypto/subtle/constant_time_test.go index 033301a6e4..c2ccd28ad7 100644 --- a/src/crypto/subtle/constant_time_test.go +++ b/src/crypto/subtle/constant_time_test.go @@ -78,9 +78,9 @@ func TestConstantTimeEq(t *testing.T) { func makeCopy(v int, x, y []byte) []byte { if len(x) > len(y) { - x = x[0:len(y)] + x = x[:len(y)] } else { - y = y[0:len(x)] + y = y[:len(x)] } if v == 1 { copy(x, y) @@ -90,9 +90,9 @@ func makeCopy(v int, x, y []byte) []byte { func constantTimeCopyWrapper(v int, x, y []byte) []byte { if len(x) > len(y) { - x = x[0:len(y)] + x = x[:len(y)] } else { - y = y[0:len(x)] + y = y[:len(x)] } v &= 1 ConstantTimeCopy(v, x, y) |
