]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/rc4: fix type errors in pure Go implementation
authorRichard Musiol <mail@richard-musiol.de>
Thu, 12 Dec 2013 19:32:31 +0000 (14:32 -0500)
committerAdam Langley <agl@golang.org>
Thu, 12 Dec 2013 19:32:31 +0000 (14:32 -0500)
R=golang-dev, agl
CC=golang-dev
https://golang.org/cl/40540049

src/pkg/crypto/rc4/rc4_ref.go

index 44d3804368ae3b6e127e538d05cc07a028c8d2fa..bca4d28e1d1d8a2d6a2b5763395dea9bc88a9c10 100644 (file)
@@ -12,9 +12,9 @@ func (c *Cipher) XORKeyStream(dst, src []byte) {
        i, j := c.i, c.j
        for k, v := range src {
                i += 1
-               j += c.s[i]
+               j += uint8(c.s[i])
                c.s[i], c.s[j] = c.s[j], c.s[i]
-               dst[k] = v ^ c.s[c.s[i]+c.s[j]]
+               dst[k] = v ^ uint8(c.s[uint8(c.s[i]+c.s[j])])
        }
        c.i, c.j = i, j
 }