]> Cypherpunks.ru repositories - govpn.git/blobdiff - src/cypherpunks.ru/govpn/verifier.go
Replace blake2b with golang.org/x/crypto implementation
[govpn.git] / src / cypherpunks.ru / govpn / verifier.go
index b68063b94823361f25bc5734d50cd7aa43a6502b..832fafe2dacf4981ee3ffc39e20aa5cde77d3a68 100644 (file)
@@ -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)