X-Git-Url: http://www.git.cypherpunks.ru/?p=govpn.git;a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgovpn%2Fverifier.go;h=832fafe2dacf4981ee3ffc39e20aa5cde77d3a68;hp=b68063b94823361f25bc5734d50cd7aa43a6502b;hb=da9420230cd4ed2ff1d8685c96b99043e529da62;hpb=696d610336e0cf8cecc40ec94c138bec8cc42afa diff --git a/src/cypherpunks.ru/govpn/verifier.go b/src/cypherpunks.ru/govpn/verifier.go index b68063b..832fafe 100644 --- a/src/cypherpunks.ru/govpn/verifier.go +++ b/src/cypherpunks.ru/govpn/verifier.go @@ -23,6 +23,7 @@ import ( "encoding/base64" "errors" "fmt" + "hash" "io/ioutil" "log" "os" @@ -30,7 +31,7 @@ import ( "cypherpunks.ru/balloon" "github.com/agl/ed25519" - "github.com/dchest/blake2b" + "golang.org/x/crypto/blake2b" "golang.org/x/crypto/ssh/terminal" ) @@ -54,10 +55,18 @@ func VerifierNew(s, t, p int, id *PeerId) *Verifier { return &Verifier{S: s, T: t, P: p, Id: id} } +func blake2bKeyless() hash.Hash { + h, err := blake2b.New256(nil) + if err != nil { + panic(err) + } + return h +} + // Apply the password: create Ed25519 keypair based on it, save public // key in verifier. func (v *Verifier) PasswordApply(password string) *[ed25519.PrivateKeySize]byte { - r := balloon.H(blake2b.New256, []byte(password), v.Id[:], v.S, v.T, v.P) + r := balloon.H(blake2bKeyless, []byte(password), v.Id[:], v.S, v.T, v.P) defer SliceZero(r) src := bytes.NewBuffer(r) pub, prv, err := ed25519.GenerateKey(src)