mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
internal/bigmod: use clear()
This commit is contained in:
parent
869be23867
commit
dc1c5806c9
@ -374,9 +374,7 @@ type zr struct{}
|
||||
|
||||
// Read replaces the contents of dst with zeros. It is safe for concurrent use.
|
||||
func (zr) Read(dst []byte) (n int, err error) {
|
||||
for i := range dst {
|
||||
dst[i] = 0
|
||||
}
|
||||
clear(dst)
|
||||
return len(dst), nil
|
||||
}
|
||||
|
||||
|
@ -85,10 +85,7 @@ func (x *Nat) expand(n int) *Nat {
|
||||
return x
|
||||
}
|
||||
extraLimbs := x.limbs[len(x.limbs):n]
|
||||
// clear(extraLimbs)
|
||||
for i := range extraLimbs {
|
||||
extraLimbs[i] = 0
|
||||
}
|
||||
clear(extraLimbs)
|
||||
x.limbs = x.limbs[:n]
|
||||
return x
|
||||
}
|
||||
@ -99,10 +96,7 @@ func (x *Nat) reset(n int) *Nat {
|
||||
x.limbs = make([]uint, n)
|
||||
return x
|
||||
}
|
||||
// clear(x.limbs)
|
||||
for i := range x.limbs {
|
||||
x.limbs[i] = 0
|
||||
}
|
||||
clear(x.limbs)
|
||||
x.limbs = x.limbs[:n]
|
||||
return x
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user