Browse Source

p2p: session should terminate on nonce wrapping (#3531) (#3609)

Refs #3531
pull/3612/head
Ivan Kushmantsev 5 years ago
committed by Anton Kaliaev
parent
commit
5df6cf563a
2 changed files with 9 additions and 2 deletions
  1. +3
    -2
      CHANGELOG_PENDING.md
  2. +6
    -0
      p2p/conn/secret_connection.go

+ 3
- 2
CHANGELOG_PENDING.md View File

@ -20,13 +20,14 @@
### IMPROVEMENTS: ### IMPROVEMENTS:
- [rpc] [\#3534](https://github.com/tendermint/tendermint/pull/3534) Add support for batched requests/responses in JSON RPC - [rpc] [\#3534](https://github.com/tendermint/tendermint/pull/3534) Add support for batched requests/responses in JSON RPC
- [cli] \#3606 (https://github.com/tendermint/tendermint/issues/3585) Add option to not clear address book with unsafe reset (@climber73)
- [cli] \#3585 Add option to not clear address book with unsafe reset (@climber73)
- [cli] [\#3160](https://github.com/tendermint/tendermint/issues/3160) Add `-config=<path-to-config>` option to `testnet` cmd (@gregdhill) - [cli] [\#3160](https://github.com/tendermint/tendermint/issues/3160) Add `-config=<path-to-config>` option to `testnet` cmd (@gregdhill)
- [cs/replay] \#3460 check appHash for each block - [cs/replay] \#3460 check appHash for each block
- [p2p] \#3531 Terminate session on nonce wrapping (@climber73)
### BUG FIXES: ### BUG FIXES:
- [p2p] \#3532 limit the number of attempts to connect to a peer in seed mode - [p2p] \#3532 limit the number of attempts to connect to a peer in seed mode
to 16 (as a result, the node will stop retrying after a 35 hours time window) to 16 (as a result, the node will stop retrying after a 35 hours time window)
- [consensus] \#2723, \#3451 and \#3317 Fix non-deterministic tests - [consensus] \#2723, \#3451 and \#3317 Fix non-deterministic tests
- [consensus] \#3067 getBeginBlockValidatorInfo loads validators from stateDB instead of state
- [consensus] \#3067 getBeginBlockValidatorInfo loads validators from stateDB instead of state (@james-ray)
- [pex] \#3603 Dial seeds when addrbook needs more addresses (@defunctzombie) - [pex] \#3603 Dial seeds when addrbook needs more addresses (@defunctzombie)

+ 6
- 0
p2p/conn/secret_connection.go View File

@ -8,6 +8,7 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"io" "io"
"math"
"net" "net"
"sync" "sync"
"time" "time"
@ -439,6 +440,11 @@ func shareAuthSignature(sc *SecretConnection, pubKey crypto.PubKey, signature []
// (little-endian in nonce[4:]). // (little-endian in nonce[4:]).
func incrNonce(nonce *[aeadNonceSize]byte) { func incrNonce(nonce *[aeadNonceSize]byte) {
counter := binary.LittleEndian.Uint64(nonce[4:]) counter := binary.LittleEndian.Uint64(nonce[4:])
if counter == math.MaxUint64 {
// Terminates the session and makes sure the nonce would not re-used.
// See https://github.com/tendermint/tendermint/issues/3531
panic("can't increase nonce without overflow")
}
counter++ counter++
binary.LittleEndian.PutUint64(nonce[4:], counter) binary.LittleEndian.PutUint64(nonce[4:], counter)
} }

Loading…
Cancel
Save