X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fencless.go;h=966a2dde65aac3498de3dddcebd5c8f5b1f7d9fe;hb=572cac17bde738055312f7a468a0bde0e760a262;hp=f9d9bbfe075e587e6fd16fd9e023a62a5f343537;hpb=5fd6174b77647f847a6e6db1cb7d5276747fcd39;p=govpn.git diff --git a/src/cypherpunks.ru/govpn/encless.go b/src/cypherpunks.ru/govpn/encless.go index f9d9bbf..966a2dd 100644 --- a/src/cypherpunks.ru/govpn/encless.go +++ b/src/cypherpunks.ru/govpn/encless.go @@ -1,6 +1,6 @@ /* GoVPN -- simple secure free software virtual private network daemon -Copyright (C) 2014-2016 Sergey Matveev +Copyright (C) 2014-2017 Sergey Matveev This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ const ( // encryption nor steganography) over All-Or-Nothing-Transformed data. // nonce is 64-bit nonce. Output data will be EnclessEnlargeSize larger. // It also consumes 64-bits of entropy. -func EnclessEncode(authKey *[32]byte, nonce, in []byte) ([]byte, error) { +func EnclessEncode(authKey *[32]byte, nonce *[16]byte, in []byte) ([]byte, error) { r := new([aont.RSize]byte) var err error if _, err = io.ReadFull(Rand, r[:]); err != nil { @@ -46,7 +46,7 @@ func EnclessEncode(authKey *[32]byte, nonce, in []byte) ([]byte, error) { return nil, err } out := append( - cnw.Chaff(authKey, nonce, aonted[:aont.RSize]), + cnw.Chaff(authKey, nonce[8:], aonted[:aont.RSize]), aonted[aont.RSize:]..., ) SliceZero(aonted[:aont.RSize]) @@ -54,10 +54,10 @@ func EnclessEncode(authKey *[32]byte, nonce, in []byte) ([]byte, error) { } // Decode EnclessEncode-ed data. -func EnclessDecode(authKey *[32]byte, nonce, in []byte) ([]byte, error) { +func EnclessDecode(authKey *[32]byte, nonce *[16]byte, in []byte) ([]byte, error) { var err error winnowed, err := cnw.Winnow( - authKey, nonce, in[:aont.RSize*cnw.EnlargeFactor], + authKey, nonce[8:], in[:aont.RSize*cnw.EnlargeFactor], ) if err != nil { return nil, err