mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-18 02:40:45 +00:00
crypto: use clear from go1.21 (#29307)
This commit is contained in:
parent
d0566e4165
commit
efad15f9f4
2 changed files with 3 additions and 9 deletions
|
|
@ -287,7 +287,5 @@ func PubkeyToAddress(p ecdsa.PublicKey) common.Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
func zeroBytes(bytes []byte) {
|
func zeroBytes(bytes []byte) {
|
||||||
for i := range bytes {
|
clear(bytes)
|
||||||
bytes[i] = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,12 +44,8 @@ func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int,
|
||||||
// Unpack the result and clear temporaries.
|
// Unpack the result and clear temporaries.
|
||||||
x := new(big.Int).SetBytes(point[:32])
|
x := new(big.Int).SetBytes(point[:32])
|
||||||
y := new(big.Int).SetBytes(point[32:])
|
y := new(big.Int).SetBytes(point[32:])
|
||||||
for i := range point {
|
clear(point)
|
||||||
point[i] = 0
|
clear(scalar)
|
||||||
}
|
|
||||||
for i := range padded {
|
|
||||||
scalar[i] = 0
|
|
||||||
}
|
|
||||||
if res != 1 {
|
if res != 1 {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue