Closed cjpatton closed 6 years ago
Actually, this behavior is intended. From conn.go
:
// SSL 3.0 and TLS 1.0 are susceptible to a chosen-plaintext
// attack when using block mode ciphers due to predictable IVs.
// This can be prevented by splitting each Application Data
// record into two records, effectively randomizing the IV.
//
// http://www.openssl.org/~bodo/tls-cbc.txt
// https://bugzilla.mozilla.org/show_bug.cgi?id=665814
// http://www.imperialviolet.org/2012/01/15/beastfollowup.html
var m int
if len(b) > 1 && c.vers <= VersionTLS10 {
if _, ok := c.out.cipher.(cipher.BlockMode); ok {
n, err := c.writeRecordLocked(recordTypeApplicationData, b[:1])
if err != nil {
return n, c.out.setErrorLocked(err)
}
m, b = 1, b[1:]
}
}
When TLS 1.0 is negotiated,
Conn.Read()
appears to only output 1 byte on the first call, then outputs the remainder of the bytes on the next call. This is not an issue in later versions.This appears to be an issue with the upstream
crypto/tls
, and not with tris.Here's some code for reproducing the bug;