On 32-bit systems int by default is 32-bits long and that counter can
not hold 2**32 value.
Signed-off-by: Sergey Matveev <stargrave@stargrave.org>
S20BS = 64
HeartbeatSize = 12
// Maximal amount of bytes transfered with single key (4 GiB)
S20BS = 64
HeartbeatSize = 12
// Maximal amount of bytes transfered with single key (4 GiB)
- MaxBytesPerKey = 1 << 32
+ MaxBytesPerKey int64 = 1 << 32
tag *[poly1305.TagSize]byte
keyAuth *[KeySize]byte
nonceRecv uint64
tag *[poly1305.TagSize]byte
keyAuth *[KeySize]byte
nonceRecv uint64
frame []byte
nonce []byte
}
frame []byte
nonce []byte
}
p.LastPing = time.Now()
p.NonceRecv = p.nonceRecv
p.frame = p.buf[S20BS : S20BS+size-NonceSize-poly1305.TagSize]
p.LastPing = time.Now()
p.NonceRecv = p.nonceRecv
p.frame = p.buf[S20BS : S20BS+size-NonceSize-poly1305.TagSize]
- p.Bytes += len(p.frame)
+ p.Bytes += int64(len(p.frame))
if subtle.ConstantTimeCompare(p.frame[:HeartbeatSize], HeartbeatMark) == 1 {
return true
}
if subtle.ConstantTimeCompare(p.frame[:HeartbeatSize], HeartbeatMark) == 1 {
return true
}
p.frame = p.buf[S20BS-NonceSize : S20BS+size]
poly1305.Sum(p.tag, p.frame, p.keyAuth)
p.frame = p.buf[S20BS-NonceSize : S20BS+size]
poly1305.Sum(p.tag, p.frame, p.keyAuth)
- p.Bytes += len(p.frame)
+ p.Bytes += int64(len(p.frame))
p.LastSent = now
if _, err := conn.WriteTo(append(p.frame, p.tag[:]...), p.Addr); err != nil {
log.Println("Error sending UDP", err)
p.LastSent = now
if _, err := conn.WriteTo(append(p.frame, p.tag[:]...), p.Addr); err != nil {
log.Println("Error sending UDP", err)