Skip to content

Commit

Permalink
v2: Remove leftover comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Feb 20, 2023
1 parent 2e35ea2 commit 537577b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
13 changes: 0 additions & 13 deletions v2/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,6 @@ import (
"io"
)

//
// However, multiple frames may be stored within a single packet. After a
// receiver decodes a frame, it checks for the presence of another frame within
// the packet by inspecting the next unread bit. A 1 bit indicates another
// frame. (This bit is "stolen" from the stream ID; see encodeFrameHeader.) If
// the bit is 0, the next unread bit is inspected. A 0 bit indicates padding:
// the rest of the packet is discarded. A 1 bit indicates "covert stream data:"
// the remaining 6 bits of the byte are discarded, and the remainder of the
// packet is treated as a distinct stream of raw data. This data is buffered
// until it comprises a full frame, whereupon it is decoded and processed as
// usual and the covert buffer is reset. Since this covert data is only ever
// sent in place of padding, it cannot be detected by traffic analysis.

const (
flagFirst = 1 << iota // first frame in stream
flagLast // stream is being closed gracefully
Expand Down
4 changes: 2 additions & 2 deletions v2/handshake.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func deriveSharedCipher(xsk, xpk [32]byte) (*seqCipher, error) {
aead: c,
ourNonce: *(*[chachaPoly1305NonceSize]byte)(nonce[:]),
theirNonce: *(*[chachaPoly1305NonceSize]byte)(nonce[:]),
}, err
}, nil
}

type connSettings struct {
Expand Down Expand Up @@ -208,7 +208,7 @@ func acceptHandshake(conn net.Conn, ourKey ed25519.PrivateKey, ourSettings connS
if _, err := io.ReadFull(conn, buf[:connSettingsSize+chachaPoly1305TagSize]); err != nil {
return nil, connSettings{}, fmt.Errorf("could not read settings response: %w", err)
} else if plaintext, err := cipher.decryptInPlace(buf[:connSettingsSize+chachaPoly1305TagSize]); err != nil {
return nil, connSettings{}, fmt.Errorf("could2 not decrypt settings response: %w", err)
return nil, connSettings{}, fmt.Errorf("could not decrypt settings response: %w", err)
} else if settings, err = mergeSettings(ourSettings, decodeConnSettings(plaintext)); err != nil {
return nil, connSettings{}, fmt.Errorf("peer sent unacceptable settings: %w", err)
}
Expand Down

0 comments on commit 537577b

Please sign in to comment.