Archived
1
0

fix nil, initialize public and private key buffers

This commit is contained in:
Jeff Becker 2017-08-25 09:55:26 -04:00
parent 892a7ea58b
commit dbb5897305
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -414,13 +414,15 @@ func cryptoSignFucky(h, sk []byte) string {
// convert seed to secret key // convert seed to secret key
func seedToKeyPair(seed []byte) (pub ed25519.PublicKey, full ed25519.PrivateKey) { func seedToKeyPair(seed []byte) (pub ed25519.PublicKey, full ed25519.PrivateKey) {
pub = make(ed25519.PublicKey, ed25519.PublicKeySize)
full = make(ed25519.PrivateKey, ed25519.PrivateKeySize)
var in [32]byte var in [32]byte
var out [32]byte var out [32]byte
copy(in[:], seed[0:32]) copy(in[:], seed[0:32])
curve25519.ScalarBaseMult(&out, &in) curve25519.ScalarBaseMult(&out, &in)
copy(pub[:], out[:]) copy(pub[:], out[:])
copy(full[:], in[:]) copy(full[:], in[:])
copy(full[:32], pub[:]) copy(full[32:], pub[:])
return return
} }