crypto: use clear from go1.21 (#29307)

This commit is contained in:
Daniel Liu 2025-01-03 09:56:02 +08:00
parent d0566e4165
commit efad15f9f4
2 changed files with 3 additions and 9 deletions

View file

@ -287,7 +287,5 @@ func PubkeyToAddress(p ecdsa.PublicKey) common.Address {
}
func zeroBytes(bytes []byte) {
for i := range bytes {
bytes[i] = 0
}
clear(bytes)
}

View file

@ -44,12 +44,8 @@ func (BitCurve *BitCurve) ScalarMult(Bx, By *big.Int, scalar []byte) (*big.Int,
// Unpack the result and clear temporaries.
x := new(big.Int).SetBytes(point[:32])
y := new(big.Int).SetBytes(point[32:])
for i := range point {
point[i] = 0
}
for i := range padded {
scalar[i] = 0
}
clear(point)
clear(scalar)
if res != 1 {
return nil, nil
}