Skip to content

Commit

Permalink
Merge branch 'osmo-v25/v0.37.4' of github.com:osmosis-labs/cometbft i…
Browse files Browse the repository at this point in the history
…nto osmo-v25/v0.37.4
  • Loading branch information
ValarDragon committed Jul 3, 2024
2 parents 68397ea + bd883fa commit 1dc2ac9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion p2p/conn/evil_secret_connection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ func TestMakeSecretConnection(t *testing.T) {
{"share bad ethimeral key", newEvilConn(true, true, false, false), "wrong wireType"},
{"refuse to share auth signature", newEvilConn(true, false, false, false), "EOF"},
{"share bad auth signature", newEvilConn(true, false, true, true), "failed to decrypt SecretConnection"},
{"all good", newEvilConn(true, false, true, false), ""},
}

for _, tc := range testCases {
Expand Down
5 changes: 3 additions & 2 deletions p2p/conn/secret_connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ var (
// Otherwise they are vulnerable to MITM.
// (TODO(ismail): see also https://github.com/tendermint/tendermint/issues/3010)
type SecretConnection struct {

// immutable
recvAead cipher.AEAD
sendAead cipher.AEAD
Expand All @@ -73,6 +72,7 @@ type SecretConnection struct {

conn io.ReadWriteCloser
connWriter *bufio.Writer
connReader io.Reader

// net.Conn must be thread safe:
// https://golang.org/pkg/net/#Conn.
Expand Down Expand Up @@ -155,6 +155,7 @@ func MakeSecretConnection(conn io.ReadWriteCloser, locPrivKey crypto.PrivKey) (*
sc := &SecretConnection{
conn: conn,
connWriter: bufio.NewWriterSize(conn, defaultWriteBufferSize),
connReader: bufio.NewReaderSize(conn, defaultReadBufferSize),
recvBuffer: nil,
recvNonce: new([aeadNonceSize]byte),
sendNonce: new([aeadNonceSize]byte),
Expand Down Expand Up @@ -250,7 +251,7 @@ func (sc *SecretConnection) Read(data []byte) (n int, err error) {

// read off the conn
sealedFrame := sc.recvSealedFrame
_, err = io.ReadFull(sc.conn, sealedFrame)
_, err = io.ReadFull(sc.connReader, sealedFrame)
if err != nil {
return
}
Expand Down

0 comments on commit 1dc2ac9

Please sign in to comment.