aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/secp256k1/secp256.go
diff options
context:
space:
mode:
authorFelix Lange <fjl@users.noreply.github.com>2017-01-23 06:28:47 +0800
committerGitHub <noreply@github.com>2017-01-23 06:28:47 +0800
commit96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc (patch)
tree6fb78f454ceeb29df77df35ed9ce2c00142eae14 /crypto/secp256k1/secp256.go
parent935d891e9db870edde6b37ad84bb21d7df19c383 (diff)
downloaddexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar.gz
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar.bz2
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar.lz
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar.xz
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.tar.zst
dexon-96778a1c216f7d0d987dd8ea6474b2d3eebe9cfc.zip
crypto/secp256k1: sign with deterministic K (rfc6979) (#3561)
Diffstat (limited to 'crypto/secp256k1/secp256.go')
-rw-r--r--crypto/secp256k1/secp256.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/crypto/secp256k1/secp256.go b/crypto/secp256k1/secp256.go
index 070e0d902..4284115e2 100644
--- a/crypto/secp256k1/secp256.go
+++ b/crypto/secp256k1/secp256.go
@@ -40,8 +40,6 @@ import (
"errors"
"math/big"
"unsafe"
-
- "github.com/ethereum/go-ethereum/crypto/randentropy"
)
var (
@@ -89,13 +87,11 @@ func Sign(msg []byte, seckey []byte) ([]byte, error) {
}
var (
- msgdata = (*C.uchar)(unsafe.Pointer(&msg[0]))
- nonce = randentropy.GetEntropyCSPRNG(32)
- noncefunc = &(*C.secp256k1_nonce_function_default)
- noncefuncData = unsafe.Pointer(&nonce[0])
- sigstruct C.secp256k1_ecdsa_recoverable_signature
+ msgdata = (*C.uchar)(unsafe.Pointer(&msg[0]))
+ noncefunc = C.secp256k1_nonce_function_rfc6979
+ sigstruct C.secp256k1_ecdsa_recoverable_signature
)
- if C.secp256k1_ecdsa_sign_recoverable(context, &sigstruct, msgdata, seckeydata, noncefunc, noncefuncData) == 0 {
+ if C.secp256k1_ecdsa_sign_recoverable(context, &sigstruct, msgdata, seckeydata, noncefunc, nil) == 0 {
return nil, ErrSignFailed
}