mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
crypto/secp256k1: rename output variables in DecompressPubkey
This commit is contained in:
parent
e34dea192c
commit
689c7d630a
1 changed files with 4 additions and 4 deletions
|
|
@ -135,17 +135,17 @@ func VerifySignature(pubkey, msg, signature []byte) bool {
|
||||||
|
|
||||||
// DecompressPubkey parses a public key in the 33-byte compressed format.
|
// DecompressPubkey parses a public key in the 33-byte compressed format.
|
||||||
// It returns non-nil coordinates if the public key is valid.
|
// It returns non-nil coordinates if the public key is valid.
|
||||||
func DecompressPubkey(pubkey []byte) (X, Y *big.Int) {
|
func DecompressPubkey(pubkey []byte) (x, y *big.Int) {
|
||||||
if len(pubkey) != 33 {
|
if len(pubkey) != 33 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
buf := make([]byte, 65)
|
out := make([]byte, 65)
|
||||||
bufdata := (*C.uchar)(unsafe.Pointer(&buf[0]))
|
outdata := (*C.uchar)(unsafe.Pointer(&out[0]))
|
||||||
pubkeydata := (*C.uchar)(unsafe.Pointer(&pubkey[0]))
|
pubkeydata := (*C.uchar)(unsafe.Pointer(&pubkey[0]))
|
||||||
if C.secp256k1_ext_decompress_pubkey(context, outdata, pubkeydata) == 0 {
|
if C.secp256k1_ext_decompress_pubkey(context, outdata, pubkeydata) == 0 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return new(big.Int).SetBytes(buf[1:33]), new(big.Int).SetBytes(buf[33:])
|
return new(big.Int).SetBytes(out[1:33]), new(big.Int).SetBytes(out[33:])
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkSignature(sig []byte) error {
|
func checkSignature(sig []byte) error {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue