From 88d723219adb09ac310379880e266f749e479e1e Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Fri, 25 Aug 2017 10:11:23 -0400 Subject: [PATCH] add debugging for testing --- contrib/backends/srndv2/src/srnd/nacl_crypto.go | 3 +++ contrib/backends/srndv2/src/srnd/util.go | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/nacl_crypto.go b/contrib/backends/srndv2/src/srnd/nacl_crypto.go index b92558c..f90ddb4 100644 --- a/contrib/backends/srndv2/src/srnd/nacl_crypto.go +++ b/contrib/backends/srndv2/src/srnd/nacl_crypto.go @@ -2,6 +2,7 @@ package srnd import ( "github.com/majestrate/nacl" + "golang.org/x/crypto/curve25519" ) func naclCryptoVerifyFucky(h, sig, pk []byte) bool { @@ -19,3 +20,5 @@ func naclCryptoVerifyDetached(hash, sig, pk []byte) bool { func naclCryptoSignDetached(hash, sk []byte) []byte { return nacl.CryptoSignDetached(hash, sk) } + +var naclScalarBaseMult = curve25519.ScalarBaseMult diff --git a/contrib/backends/srndv2/src/srnd/util.go b/contrib/backends/srndv2/src/srnd/util.go index bc3a346..d04d6b4 100644 --- a/contrib/backends/srndv2/src/srnd/util.go +++ b/contrib/backends/srndv2/src/srnd/util.go @@ -12,7 +12,6 @@ import ( "encoding/base64" "encoding/hex" "fmt" - "golang.org/x/crypto/curve25519" "golang.org/x/crypto/ed25519" "io" "log" @@ -419,10 +418,11 @@ func seedToKeyPair(seed []byte) (pub ed25519.PublicKey, full ed25519.PrivateKey) var in [32]byte var out [32]byte copy(in[:], seed[0:32]) - curve25519.ScalarBaseMult(&out, &in) + naclScalarBaseMult(&out, &in) copy(pub[:], out[:]) - copy(full[:], in[:]) - copy(full[32:], pub[:]) + copy(full[0:32], in[:]) + copy(full[32:64], pub[:]) + log.Println("pk=", hexify(pub[:])) return }