]> Sergey Matveev's repositories - btrtrc.git/blobdiff - mse/mse.go
fs/cmd/torrentfs: Add main logger
[btrtrc.git] / mse / mse.go
index 522612c93787077bd8fe96323396d209841259f4..c3a9f3d3ae840c77eed1c37a881111194ae71c9f 100644 (file)
@@ -12,7 +12,6 @@ import (
        "expvar"
        "fmt"
        "io"
-       "io/ioutil"
        "math"
        "math/big"
        "strconv"
@@ -69,7 +68,7 @@ func hash(parts ...[]byte) []byte {
        return h.Sum(nil)
 }
 
-func newEncrypt(initer bool, s []byte, skey []byte) (c *rc4.Cipher) {
+func newEncrypt(initer bool, s, skey []byte) (c *rc4.Cipher) {
        c, err := rc4.NewCipher(hash([]byte(func() string {
                if initer {
                        return "keyA"
@@ -409,7 +408,7 @@ func (h *handshake) initerSteps() (ret io.ReadWriter, selected CryptoMethod, err
        if err != nil {
                return
        }
-       _, err = io.CopyN(ioutil.Discard, r, int64(padLen))
+       _, err = io.CopyN(io.Discard, r, int64(padLen))
        if err != nil {
                return
        }
@@ -474,7 +473,7 @@ func (h *handshake) receiverSteps() (ret io.ReadWriter, chosen CryptoMethod, err
        }
        cryptoProvidesCount.Add(strconv.FormatUint(uint64(provides), 16), 1)
        chosen = h.chooseMethod(provides)
-       _, err = io.CopyN(ioutil.Discard, r, int64(padLen))
+       _, err = io.CopyN(io.Discard, r, int64(padLen))
        if err != nil {
                return
        }
@@ -542,7 +541,7 @@ func (h *handshake) Do() (ret io.ReadWriter, method CryptoMethod, err error) {
 }
 
 func InitiateHandshake(
-       rw io.ReadWriter, skey []byte, initialPayload []byte, cryptoProvides CryptoMethod,
+       rw io.ReadWriter, skey, initialPayload []byte, cryptoProvides CryptoMethod,
 ) (
        ret io.ReadWriter, method CryptoMethod, err error,
 ) {