Re: Proposal: Run QUIC over DTLS

Marten Seemann <martenseemann@gmail.com> Tue, 06 March 2018 10:10 UTC

Return-Path: <martenseemann@gmail.com>
X-Original-To: quic@ietfa.amsl.com
Delivered-To: quic@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 404E2126FDC for <quic@ietfa.amsl.com>; Tue, 6 Mar 2018 02:10:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.989
X-Spam-Level:
X-Spam-Status: No, score=-1.989 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_REMOTE_IMAGE=0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8GJy64Cc59W8 for <quic@ietfa.amsl.com>; Tue, 6 Mar 2018 02:10:22 -0800 (PST)
Received: from mail-ua0-x236.google.com (mail-ua0-x236.google.com [IPv6:2607:f8b0:400c:c08::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1429312EB19 for <quic@ietf.org>; Tue, 6 Mar 2018 02:10:22 -0800 (PST)
Received: by mail-ua0-x236.google.com with SMTP id n24so5326352ual.12 for <quic@ietf.org>; Tue, 06 Mar 2018 02:10:22 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6x/odzcROl1CJY4oyhhjdgfa9wc5JB0q4tFJa6xcJ/s=; b=Ta96N+025NxwYAaNwiiAq2QvXLD5P72T9to0OSXeBDm1B838wgX9UtFVO2TKjBHS7f XpyXMBSfLB3EDSxvdamVmQhAXyJNPcrLwXeTBMhmqI2vHG7SL5aP3H6NTX+n0YmeF43K pDC0rgCHWI3GGgSKakpf5u18+dXVssylk4lOWJo+IhtReqpPvDuJmN+ug/2ZW9lG0mQT FGqHPHupYlExpGpWE8NwGu+xzo0klNjpAtxTF4xpxO0qPqhqbR/SSXBMTMSUu9P8JbRr VKqfHHbZoBx2vVVpOg7we1gQrvIdtoDd+xvhYzznGHHyFBGXSaqtetRi1R+Fl7aQedva in8A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6x/odzcROl1CJY4oyhhjdgfa9wc5JB0q4tFJa6xcJ/s=; b=odjgpHEFd/2Lao9u5kuGmwfrDaRXoQshL0eu6em1d9ullp6rq6TF6qjWbPlzTuOuZ/ Yv8VTO4t2Bb3QhDyN7qaAWudzq4boZaI8MCQH8tB/9NbwkCKt7aTBy1xQzc0v+9DGssm MVfH/LRJrVWmWBX30KCveOsuPDojMunBPWbXS/FvDIn3S5z4ymZ5CeuNz+nvkxqBJdlj DIIME2fK5NBpUQCl5ddWffDvZqg2z+iBiz9Abmlv07MWjsbHrnRzhWot8ooQv6SppbaP v+MF2FqlgVQYEfyin/gn7Eawx2/+PpRGLE95mUxkkckXlc27yR4e3IZoENVv7EcLZUzl mgMw==
X-Gm-Message-State: APf1xPDNVZAZV8KTg9hS61ysNlPIjQk7PXtlMGWPD+IuvqdcRHmtDWBX LiKgTeF376L38Bxuh4PzRSO/inATVNzDXJxWj/o=
X-Google-Smtp-Source: AG47ELtRFD720kNV8E0avnm0/MlDl/VBB5p9mUkfAs+YYZX0nGf1Km1PXLCrO7koi8qbBUW71GHGJ6vl+kwLwrl8rpI=
X-Received: by 10.159.62.129 with SMTP id x1mr11882829uai.175.1520331020838; Tue, 06 Mar 2018 02:10:20 -0800 (PST)
MIME-Version: 1.0
References: <CABcZeBO9g5vnPK2aGYEUOYOkT-898Gc0-d4T=kDvxuE2Yg6kMQ@mail.gmail.com> <CANatvzyevZrZciO3fTWFspp9utjKv9Z+PQ5F=yHKNBabssEsNw@mail.gmail.com> <MWHPR15MB182183BE8E6E0C3A97795315B6D90@MWHPR15MB1821.namprd15.prod.outlook.com> <CANatvzzARjNdr6Rms0r0yVn41JwtU6p9uNueq_ZROVzU19-1+A@mail.gmail.com>
In-Reply-To: <CANatvzzARjNdr6Rms0r0yVn41JwtU6p9uNueq_ZROVzU19-1+A@mail.gmail.com>
From: Marten Seemann <martenseemann@gmail.com>
Date: Tue, 06 Mar 2018 10:10:09 +0000
Message-ID: <CAOYVs2p7Vyms_Z4cE+0c_2=kAus=0eS5uQ1x=ydc+eptF4jXOw@mail.gmail.com>
Subject: Re: Proposal: Run QUIC over DTLS
To: Kazuho Oku <kazuhooku@gmail.com>
Cc: Subodh Iyengar <subodh@fb.com>, Eric Rescorla <ekr@rtfm.com>, IETF QUIC WG <quic@ietf.org>
Content-Type: multipart/alternative; boundary="f403043e8038702d270566bba6a3"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/k6_NPPyRuD8cWegctnW2HgxBQQE>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: Main mailing list of the IETF QUIC working group <quic.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/quic>, <mailto:quic-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/quic/>
List-Post: <mailto:quic@ietf.org>
List-Help: <mailto:quic-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/quic>, <mailto:quic-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 06 Mar 2018 10:10:26 -0000

Thanks for writing this up. This is really interesting to think through.

Thinking about the crypto layer, I'm beginning to wonder if the decision to
move QUIC to TLS 1.3 was the right one in the first place. For quic-go, I
first implemented QUIC crypto from scratch and later integrated an existing
TLS 1.3 library. Implementing QUIC crypto was a lot easier, and the
resulting code is so much cleaner than dealing with the strong coupling
between QUIC and TLS. I'm not sure if moving to DTLS will significantly
reduce the overall coupling, although certainly the coupling points will be
very different.
If the working group is considering a change in the crypto layer at this
point, maybe we should keep QUIC crypto in mind as a third option.

On Tue, Mar 6, 2018 at 4:29 PM Kazuho Oku <kazuhooku@gmail.com> wrote:

> 2018-03-06 15:39 GMT+09:00 Subodh Iyengar <subodh@fb.com>:
>
>> While using DTLS is not unworkable, the WG has put a lot of work put into
>> the current header and packet format which shows that controlling the
>> header format has several advantages for the transport to accomplish its
>> goals. That being said, I think the spirit of ekr's proposal has several
>> salient ideas which we could incorporate into the existing QUIC drafts
>> irrespective of deciding to adopt this draft.
>>
>> One of the salient ideas is a more clear layering structure. I believe it
>> is possible to implement even QUIC as currently specified with a layered
>> API, even if the current drafts make no assumptions about layering of the
>> protocol.
>>
>>
>> Even though our implementation, mvfst, is not layered, I can imagine an
>> implementation creating a layering structure to be like
>>
>>
>> [ QUIC transport layer]
>>
>> [ QUIC encryption and "record" layer ]
>>
>> [ UDP ]
>>
>>
>> The roles of these layers are well defined (note that I have not
>> implemented this yet).
>>
>>
>> The transport layer
>>
>> --------------------------
>>
>> It maintains the transport state and gets signals from the encryption
>> layer on what type of data is appropriate to write, i.e. no data, 0rtt
>> data, or 1rtt data.
>>
>>
>> Record layer
>>
>> -------------------
>> The record layer would decide to encrypt the bytes with the appropriate
>> keys.
>>
>>
>> The record layer would also send packets for handshake data. Since the
>> transport and the record layer would share the same packet number space it
>> would be appropriate to give ownership of packet number counting to the
>> record layer. Before the transport layer constructs a packet it would ask
>> the record layer to assign it a packet number to use for its state
>> accounting.
>>
>> Receiving a packet
>>
>> ---------------------------
>> The handshake layer decrypts the packet and hands the transport layer a
>> packet number and the decrypted frame data. If the handshake layer has any
>> handshake packets outstanding it would go into a mode where it would read
>> all acks from all packets to make a decision on whether its handshake data
>> needs to be retransmitted. The handshake layer would only be responsible
>> for transmission of stream 0 data.
>>
>>
>> This allows acks for non handshake data to be used to re-transmit
>> handshake data even though they are in different "layers". If the transport
>> layer assumes that any gaps of data were transmitted by the handshake
>> layer, it would also allow acks for handshake packets to be used for loss
>> recovery of data packets as well by the transport layer.
>>
>> I could see the current draft adopt a more layered editorial structure,
>> or it might be simpler to have a separate draft that describes the layering
>> design of QUIC. I would be happy to work with ekr on this if this needs a
>> separate draft. The spec could incorporate some features to address the
>> issues ekr brought up. 3 changes that might bring us closer are:
>>
>>
>>
>>    - We could move crypto out of stream 0 and giving it it's own frame
>>    type. This separates the "channel" of communication of crypto data
>>    from "streams" which the transport has to maintain state for. In
>>    several implementations, including ours, crypto streams are treated special
>>    for everything anyway. The only resemblance to a stream is in the state
>>    needed.
>>    - Multiple QUIC packets in 1 UDP packet. There is already an open
>>    issue for this.
>>    - Getting rid of regular packet gaps so that multiple layers can use
>>    gaps to decide which layer handled the data. I believe we are on a path to
>>    doing this anyway.
>>
>>
>> I'm not sure how to resolve the issue on version negotiation though.
>>
>
> Honestly speaking, I do not understand why people are interested in doing
> QUIC v2 soon.
>
> If we want to extend QUIC v1, we can add new extensions to TLS to
> negotiate additional features.
>
> Regarding preventing ossification, I think that can be (and should be)
> achieved through greasing and obfuscation.
>
> If my assumptions listed here are correct, requiring additional round-trip
> is a non-issue. Assuming that a non-compatible change will come only once a
> decade, we can just do happy eyeballs with QUIC version N and version N+1.
>
>
>>
>>
>> Subodh
>>
>>
>>
>> ------------------------------
>> *IFrom:* QUIC <quic-bounces@ietf.org> on behalf of Kazuho Oku <
>> kazuhooku@gmail.com>
>> *Sent:* Monday, March 5, 2018 8:32:28 PM
>> *To:* Eric Rescorla
>> *Cc:* IETF QUIC WG
>> *Subject:* Re: Proposal: Run QUIC over DTLS
>>
>> 2018-03-06 8:05 GMT+09:00 Eric Rescorla <ekr@rtfm.com>:
>> > Hi folks,
>> >
>> > Sorry to be the one randomizing things again, but the asymmetric
>> > conn-id thing went well, so here goes....
>> >
>> > TL;DR.
>> > I'd like to discuss refactoring things to run QUIC over DTLS.
>>
>> EKR, Thank you for writing this. This is a very interesting proposal!
>>
>> I can see the point that the QUIC specification will become more
>> straightforward if we adopt the DTLS-based approach, while, as an
>> implementor of TLS 1.3 and QUIC, I do not think that the total cost of
>> maintaining crypto and transport would change a lot.
>>
>> One thing that I like about the proposed approach in particular is the
>> negotiation. As your draft points out, current approach has the
>> overhead of requiring additional round-trip when the server's
>> preferred version differs from that of the client.
>>
>> It makes sense to negotiate the QUIC version using the negotiation
>> scheme available in (D)TLS.
>>
>> That said, I feel uneasy about building QUIC **on top of** DTLS.
>>
>> My understanding is that the intent of the working group is to build a
>> transport. We have spent maybe about a half of our time discussing
>> things that need to be implemented below the crypto (e.g., connection
>> ID, stateless reset, path migration, etc.), while the other half being
>> above the crypto (e.g., streams and multiplexing).
>>
>> I think that that reflects the nature of what transport is, and that
>> the two need to be discussed together. In other words, I am afraid
>> that moving half of the design to TLSWG while retaining the other half
>> in QUICWG is likely to lead to the need for much more discussion
>> (would we holding interims for two workgroups?) as well as making the
>> decision process more complex.
>>
>> In my view, that increases the risk of QUIC standardization process
>> being either delayed or ultimately failing.
>>
>> Therefore, I am sorry to say that I am negative to the proposal. I
>> would feel safer if the proposal is adjusted to retain the sandboxing
>> approach (i.e. define the layers below and above the crypto layers in
>> QUIC WG while switching to DTLS).
>>
>> However, I also believe that the issues of the current approach that
>> have been pointed out by the proposal can be adjusted without
>> switching to DTLS, and I would prefer doing so unless we unanimously
>> agree to switch to DTLS.
>>
>> PS. If we decide to adopt the proposal, I am happy to implement DTLS
>> in picotls. It would not take a lot of time to do so.
>>
>> >
>> > DETAILS
>> > When we originally designed the interaction between TLS and QUIC,
>> > there seemed like a lot of advantages to embedding the crypto
>> > handshake on stream 0, in particular the ability to share a common
>> > reliability and congestion mechanism. However, as we've gotten further
>> > along in design and implementation, it's also become clear that it's
>> > archictecturally kind of crufty and this creates a bunch of problems,
>> > including:
>> >
>> >   * Stream 0 is unencrypted at the beginning of the connection, but
>> >     encrypted after the handshake completes, and you still need
>> >     to service it.
>> >
>> >   * Retransmission of stream 0 frames from lost packets needs special
>> >     handling to avoid accidentally encrypting them.
>> >
>> >   * Stream 0 is not subject to flow control; it can exceed limits and
>> >     goes into negative credit after the handshake completes.
>> >
>> >   * There are complicated rules about which packets can ACK other
>> >     packets, as both cleartext and ciphertext ACKs are possible.
>> >
>> >   * Very tight coupling between the crypto stack and the transport
>> >     stack, especially in terms of knowing where you are in the
>> >     crypto state machine.
>> >
>> > I've been looking at an alternative design in which we instead adopt a
>> > more natural layering of putting QUIC on top of DTLS. The basic
>> > intuition is that you do a DTLS handshake and just put QUIC frames
>> > directly in DTLS records (rather than QUIC packets). This
>> > significantly reduces the degree of entanglement between the two
>> > components and removes the corner cases above, as well as just
>> > generally being a more conventional architecture. Of course, no design
>> > is perfect, but on balance, I think this is a cleaner structure.
>> >
>> > I have a draft for this at:
>> >
>> https://urldefense.proofpoint.com/v2/url?u=https-3A__datatracker.ietf.org_doc_draft-2Drescorla-2Dquic-2Dover-2Ddtls_&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=h3Ju9EBS7mHtwg-wAyN7fQ&m=wmlFadUY1Jjjb0308-LqYpvNMl8SR01vRZd6V_CwVVA&s=jI8gErodUXMcWnUPIRvyAO-NCsnN779ZOxJukgJzqXg&e=
>> draft-rescorla-quic-over-dtls-00 - QUIC over DTLS
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__datatracker.ietf.org_doc_draft-2Drescorla-2Dquic-2Dover-2Ddtls_&d=DwIBaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=h3Ju9EBS7mHtwg-wAyN7fQ&m=wmlFadUY1Jjjb0308-LqYpvNMl8SR01vRZd6V_CwVVA&s=jI8gErodUXMcWnUPIRvyAO-NCsnN779ZOxJukgJzqXg&e=>
>> urldefense.proofpoint.com
>> QUIC over DTLS (Internet-Draft, 2018)
>>
>> >
>> > And a partial implementation of it in Minq at:
>> >
>> > Mint: https://github.com/ekr/mint/tree/dtls_for_quic
>> <https://github.com/ekr/mint/tree/dtls_for_quic>
>> ekr/mint <https://github.com/ekr/mint/tree/dtls_for_quic>
>> github.com
>> mint - A Minimal TLS 1.3 Implementation in Go
>>
>> > Minq: https://github.com/ekr/minq/tree/quic_over_dtls
>> >
>> >
>> > I can't speak for anyone else's implementation, but at least in my
>> > case, the result was considerable simplification.
>> >
>> > It's natural at this point to say that this is coming late in the
>> > process after we have a lot invested in the current design, as well as
>> > to worry that it will delay the process. That's not my intention, and
>> > as I say in the draft, many of the issues we have struggled over
>> > (headers especially) can be directly ported into this architecture (or
>> > perhaps just reused with QUIC-over-DTLS while letting ordinary DTLS do
>> > its thing) and this change would allow us to sidestep issued we are
>> > still fighting with, so on balance I believe we can keep the schedule
>> > impact contained.
>> >
>> > We are designing a protocol that will be used long into the future, so
>> > having the right architecture is especially important. Our goal has
>> > always been to guide this effort by implementation experience and we
>> > are learning about the deficiencies of the Stream 0 design as we go
>> > down our current path. If the primary concern to this proposal is
>> > schedule we should have an explicit discussion about those relative
>> > priorities in the context of the pros and cons of the proposal.
>> >
>> > The hackathon would be a good opportunity to have a face to face chat
>> > about this in addition to on-list discussion.
>> >
>> > Thanks in advance for taking a look,
>> > -Ekr
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Kazuho Oku
>>
>>
>
>
> --
> Kazuho Oku
>