On Wed, Oct 14, 2015 at 4:05 PM Matt Caswell <fr...@baggins.org> wrote:

> On 14/10/15 16:44, Martin Rex wrote:
> > Matt Caswell wrote:
> >>
> >> Does anyone have any views on the below?
> >
> > Yup.  Interleaving application & handshake records is a
> > highly dangerous idea (and fortunately some TLS implementations
> > will abort if you try).
> >
> > http://www.ietf.org/mail-archive/web/tls/current/msg07648.html
> >
> > http://www.ietf.org/mail-archive/web/tls/current/msg09743.html
> >
> >
>
> So is your recommendation that we should ignore the RFC and prevent
> interleaving at all? The current OpenSSL behaviour is to abort, but this
> is causing an interoperability problem. Since the RFC is clear that
> OpenSSL is in the wrong we were seeking to fix it.
>

BoringSSL doesn't allow application/handshake interleave under any
circumstances and further requires that renegotiate be server-initiated and
at a quiescent point in the application protocol. That is, a point where
the client is done writing and will not write more until receiving more
data from the server, like between an HTTP/1.1 request and response. This
avoids a ton of complexity and state-space explosion. (OpenSSL's
in_read_app_data = 2 and the interaction with in_handshake are terrifying.)
It's meant to be the bare minimum needed to support the legacy
renego/client-auth mistake for unpipelined HTTP/1.1 as a client and nothing
more.

It's been shipping in Chrome for a while now and I've never had a report of
breakage. But I also don't have to deal with the particular interop
situation you came across, so this approach may not work as well for
OpenSSL.

If you really absolutely must support interleave and can't avoid it, I
think it being allowed everywhere except between CCS and Finished is
probably the closest you can get to coherent semantics. "Coherent" here is,
of course, all relative since renego is involved.

David


Matt
>
>
> > -Martin
> >
> >> On 30/09/15 11:06, Matt Caswell wrote:
> >>> Hi all
> >>>
> >>> I have a question on how to interpret RFC 5246 with regards to the
> >>> interleaving of app data and handshake records.
> >>>
> >>> RFC 5246 (and RFC 4346 before it) contains these words:
> >>>
> >>>    Note: Data of different TLS Record layer content types MAY be
> >>>    interleaved.  Application data is generally of lower precedence for
> >>>    transmission than other content types.  However, records MUST be
> >>>    delivered to the network in the same order as they are protected by
> >>>    the record layer.  Recipients MUST receive and process interleaved
> >>>    application layer traffic during handshakes subsequent to the first
> >>>    one on a connection.
> >>>
> >>> This wording seems to place no limits whatsoever on when it is valid to
> >>> receive app data in the handshake. By the wording in the RFC it would
> be
> >>> valid for app data to be received *after* the ChangeCipherSpec has been
> >>> received but *before* the Finished has been processed.
> >>>
> >>> There is also this wording:
> >>>
> >>>    Note: If a rehandshake occurs while data is flowing on a connection,
> >>>    the communicating parties may continue to send data using the old
> >>>    CipherSpec.  However, once the ChangeCipherSpec has been sent, the
> >>>    new CipherSpec MUST be used.  The first side to send the
> >>>    ChangeCipherSpec does not know that the other side has finished
> >>>    computing the new keying material (e.g., if it has to perform a
> >>>    time-consuming public key operation).  Thus, a small window of time,
> >>>    during which the recipient must buffer the data, MAY exist.  In
> >>>    practice, with modern machines this interval is likely to be fairly
> >>>    short.
> >>>
> >>> I think this means that as soon as the first party sends a CCS, they
> >>> must not send any app data until they have received a CCS back - they
> >>> must buffer it until the CCS is seen - but on reading it again I'm not
> >>> sure! If that were the case then the second party should never expect
> to
> >>> see app data between CCS and Finished. It doesn't tell you anything
> >>> about what the first party can expect though, i.e. is the second party
> >>> allowed to send app data between the CCS and Finished?
> >>>
> >>> Finally there is also this:
> >>>
> >>>    A Finished message is always sent immediately after a change
> >>>    cipher spec message to verify that the key exchange and
> >>>    authentication processes were successful.
> >>>
> >>> I suppose this trumps everything else, although as this section is
> >>> specifically talking about handshakes you could interpret "immediately"
> >>> as applying to the handshake sequence only without saying anything
> about
> >>> interleaved app data records.
> >>>
> >>> I believe the intention is that app data should not be sent between the
> >>> CCS and Finished but the RFC wording is not exactly crystal clear. This
> >>> is the interpretation I have taken whilst fixing this OpenSSL bug:
> >>>
> >>>
> https://rt.openssl.org/Ticket/Display.html?id=3712&user=guest&pass=guest
> >>>
> >>> Can some confirm my interpretation is correct?
> >>>
> >>> Thanks
> >>>
> >>> Matt
> >>>
> >>>
> >>
> >> _______________________________________________
> >> TLS mailing list
> >> TLS@ietf.org
> >> https://www.ietf.org/mailman/listinfo/tls
>
> _______________________________________________
> TLS mailing list
> TLS@ietf.org
> https://www.ietf.org/mailman/listinfo/tls
>
_______________________________________________
TLS mailing list
TLS@ietf.org
https://www.ietf.org/mailman/listinfo/tls

Reply via email to