diff options
author | Russ Cox <rsc@golang.org> | 2010-05-27 14:51:47 -0700 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2010-05-27 14:51:47 -0700 |
commit | 72aaa4ca27df8cf19707c1b5b4795be22dbe2260 (patch) | |
tree | 0a1979ffe528bfde23ecdc7ef0339d7d0a7d1a80 /src/pkg/crypto | |
parent | 9ead4aa791e9113b87c9ddbde498290d1e5e4b22 (diff) | |
download | golang-72aaa4ca27df8cf19707c1b5b4795be22dbe2260.tar.gz |
changes &x -> x[0:] for array to slice conversion
R=gri
CC=golang-dev
http://codereview.appspot.com/1326042
Diffstat (limited to 'src/pkg/crypto')
-rw-r--r-- | src/pkg/crypto/block/ecb_test.go | 4 | ||||
-rw-r--r-- | src/pkg/crypto/block/xor_test.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/blowfish/block.go | 10 | ||||
-rw-r--r-- | src/pkg/crypto/blowfish/cipher.go | 10 | ||||
-rw-r--r-- | src/pkg/crypto/md4/md4.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/md5/md5.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/rand/rand.go | 14 | ||||
-rw-r--r-- | src/pkg/crypto/ripemd160/ripemd160.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/sha1/sha1.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/sha256/sha256.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/sha512/sha512.go | 2 | ||||
-rw-r--r-- | src/pkg/crypto/tls/conn.go | 4 |
12 files changed, 28 insertions, 28 deletions
diff --git a/src/pkg/crypto/block/ecb_test.go b/src/pkg/crypto/block/ecb_test.go index 3767e63db..1e991e1dd 100644 --- a/src/pkg/crypto/block/ecb_test.go +++ b/src/pkg/crypto/block/ecb_test.go @@ -67,7 +67,7 @@ func TestECBEncrypter(t *testing.T) { for frag := 0; frag < 2; frag++ { c := &IncCipher{block, 0, true} b.Reset() - r := bytes.NewBuffer(&plain) + r := bytes.NewBuffer(plain[0:]) w := NewECBEncrypter(c, b) // copy plain into w in increasingly large chunks: 1, 1, 2, 4, 8, ... @@ -100,7 +100,7 @@ func TestECBEncrypter(t *testing.T) { continue } - if string(data) != string(&crypt) { + if string(data) != string(crypt[0:]) { t.Errorf("block=%d frag=%d: want %x got %x", block, frag, data, crypt) } } diff --git a/src/pkg/crypto/block/xor_test.go b/src/pkg/crypto/block/xor_test.go index 87b493a40..50f6bb08d 100644 --- a/src/pkg/crypto/block/xor_test.go +++ b/src/pkg/crypto/block/xor_test.go @@ -53,7 +53,7 @@ func testXorWriter(t *testing.T, maxio int) { for frag := 0; frag < 2; frag++ { test := fmt.Sprintf("block=%d frag=%d maxio=%d", block, frag, maxio) b.Reset() - r := bytes.NewBuffer(&plain) + r := bytes.NewBuffer(plain[0:]) s := newIncStream(block) w := newXorWriter(s, b) diff --git a/src/pkg/crypto/blowfish/block.go b/src/pkg/crypto/blowfish/block.go index 9d9a02e65..7fbe7eefb 100644 --- a/src/pkg/crypto/blowfish/block.go +++ b/src/pkg/crypto/blowfish/block.go @@ -5,11 +5,11 @@ package blowfish func expandKey(key []byte, c *Cipher) { - copy(&c.p, &p) - copy(&c.s0, &s0) - copy(&c.s1, &s1) - copy(&c.s2, &s2) - copy(&c.s3, &s3) + copy(c.p[0:], p[0:]) + copy(c.s0[0:], s0[0:]) + copy(c.s1[0:], s1[0:]) + copy(c.s2[0:], s2[0:]) + copy(c.s3[0:], s3[0:]) j := 0 for i := 0; i < 18; i++ { diff --git a/src/pkg/crypto/blowfish/cipher.go b/src/pkg/crypto/blowfish/cipher.go index 6a8bdc0e0..ee0def85e 100644 --- a/src/pkg/crypto/blowfish/cipher.go +++ b/src/pkg/crypto/blowfish/cipher.go @@ -71,9 +71,9 @@ func (c *Cipher) Decrypt(src, dst []byte) { // Reset zeros the key data, so that it will no longer // appear in the process's memory. func (c *Cipher) Reset() { - zero(&c.p) - zero(&c.s0) - zero(&c.s1) - zero(&c.s2) - zero(&c.s3) + zero(c.p[0:]) + zero(c.s0[0:]) + zero(c.s1[0:]) + zero(c.s2[0:]) + zero(c.s3[0:]) } diff --git a/src/pkg/crypto/md4/md4.go b/src/pkg/crypto/md4/md4.go index 54d1ba3dc..adbdf29e7 100644 --- a/src/pkg/crypto/md4/md4.go +++ b/src/pkg/crypto/md4/md4.go @@ -60,7 +60,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == _Chunk { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/md5/md5.go b/src/pkg/crypto/md5/md5.go index f61273c08..a83337651 100644 --- a/src/pkg/crypto/md5/md5.go +++ b/src/pkg/crypto/md5/md5.go @@ -60,7 +60,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == _Chunk { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/rand/rand.go b/src/pkg/crypto/rand/rand.go index 127b1d082..01c30316b 100644 --- a/src/pkg/crypto/rand/rand.go +++ b/src/pkg/crypto/rand/rand.go @@ -81,15 +81,15 @@ func (r *reader) Read(b []byte) (n int, err os.Error) { for len(b) > 0 { if r.budget == 0 { - _, err := io.ReadFull(r.entropy, &r.seed) + _, err := io.ReadFull(r.entropy, r.seed[0:]) if err != nil { return n - len(b), err } - _, err = io.ReadFull(r.entropy, &r.key) + _, err = io.ReadFull(r.entropy, r.key[0:]) if err != nil { return n - len(b), err } - r.cipher, err = aes.NewCipher(&r.key) + r.cipher, err = aes.NewCipher(r.key[0:]) if err != nil { return n - len(b), err } @@ -112,17 +112,17 @@ func (r *reader) Read(b []byte) (n int, err os.Error) { r.time[5] = byte(ns >> 16) r.time[6] = byte(ns >> 8) r.time[7] = byte(ns) - r.cipher.Encrypt(&r.time, &r.time) + r.cipher.Encrypt(r.time[0:], r.time[0:]) for i := 0; i < aes.BlockSize; i++ { r.dst[i] = r.time[i] ^ r.seed[i] } - r.cipher.Encrypt(&r.dst, &r.dst) + r.cipher.Encrypt(r.dst[0:], r.dst[0:]) for i := 0; i < aes.BlockSize; i++ { r.seed[i] = r.time[i] ^ r.dst[i] } - r.cipher.Encrypt(&r.seed, &r.seed) + r.cipher.Encrypt(r.seed[0:], r.seed[0:]) - m := copy(b, &r.dst) + m := copy(b, r.dst[0:]) b = b[m:] } diff --git a/src/pkg/crypto/ripemd160/ripemd160.go b/src/pkg/crypto/ripemd160/ripemd160.go index d48591056..5d5519842 100644 --- a/src/pkg/crypto/ripemd160/ripemd160.go +++ b/src/pkg/crypto/ripemd160/ripemd160.go @@ -64,7 +64,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == BlockSize { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/sha1/sha1.go b/src/pkg/crypto/sha1/sha1.go index cd7d8fd20..681870a21 100644 --- a/src/pkg/crypto/sha1/sha1.go +++ b/src/pkg/crypto/sha1/sha1.go @@ -62,7 +62,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == _Chunk { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/sha256/sha256.go b/src/pkg/crypto/sha256/sha256.go index b95fd8ecb..df00a7298 100644 --- a/src/pkg/crypto/sha256/sha256.go +++ b/src/pkg/crypto/sha256/sha256.go @@ -104,7 +104,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == _Chunk { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/sha512/sha512.go b/src/pkg/crypto/sha512/sha512.go index 9e8314898..21b030563 100644 --- a/src/pkg/crypto/sha512/sha512.go +++ b/src/pkg/crypto/sha512/sha512.go @@ -104,7 +104,7 @@ func (d *digest) Write(p []byte) (nn int, err os.Error) { } d.nx += n if d.nx == _Chunk { - _Block(d, &d.x) + _Block(d, d.x[0:]) d.nx = 0 } p = p[n:] diff --git a/src/pkg/crypto/tls/conn.go b/src/pkg/crypto/tls/conn.go index d0e8464d5..0798e26f6 100644 --- a/src/pkg/crypto/tls/conn.go +++ b/src/pkg/crypto/tls/conn.go @@ -171,7 +171,7 @@ func (hc *halfConn) decrypt(b *block) (bool, alert) { remoteMAC := payload[n:] hc.mac.Reset() - hc.mac.Write(&hc.seq) + hc.mac.Write(hc.seq[0:]) hc.incSeq() hc.mac.Write(b.data) @@ -188,7 +188,7 @@ func (hc *halfConn) encrypt(b *block) (bool, alert) { // mac if hc.mac != nil { hc.mac.Reset() - hc.mac.Write(&hc.seq) + hc.mac.Write(hc.seq[0:]) hc.incSeq() hc.mac.Write(b.data) mac := hc.mac.Sum() |