// Zero handshake's memory state
func (h *Handshake) Zero() {
if h.rNonce != nil {
- sliceZero(h.rNonce[:])
+ SliceZero(h.rNonce[:])
}
if h.dhPriv != nil {
- sliceZero(h.dhPriv[:])
+ SliceZero(h.dhPriv[:])
}
if h.key != nil {
- sliceZero(h.key[:])
+ SliceZero(h.key[:])
}
if h.dsaPubH != nil {
- sliceZero(h.dsaPubH[:])
+ SliceZero(h.dsaPubH[:])
}
if h.rServer != nil {
- sliceZero(h.rServer[:])
+ SliceZero(h.rServer[:])
}
if h.rClient != nil {
- sliceZero(h.rClient[:])
+ SliceZero(h.rClient[:])
}
if h.sServer != nil {
- sliceZero(h.sServer[:])
+ SliceZero(h.sServer[:])
}
if h.sClient != nil {
- sliceZero(h.sClient[:])
+ SliceZero(h.sClient[:])
}
}
func (p *Peer) Zero() {
p.BusyT.Lock()
p.BusyR.Lock()
- sliceZero(p.Key[:])
- sliceZero(p.bufR)
- sliceZero(p.bufT)
- sliceZero(p.keyAuthR[:])
- sliceZero(p.keyAuthT[:])
+ SliceZero(p.Key[:])
+ SliceZero(p.bufR)
+ SliceZero(p.bufT)
+ SliceZero(p.keyAuthR[:])
+ SliceZero(p.keyAuthT[:])
p.BusyT.Unlock()
p.BusyR.Unlock()
}
if err != nil {
log.Fatalln("Unable to apply Argon2d", err)
}
- defer sliceZero(r)
+ defer SliceZero(r)
src := bytes.NewBuffer(r)
pub, prv, err := ed25519.GenerateKey(src)
if err != nil {