Re: Removing packet number gaps

Martin Thomson <martin.thomson@gmail.com> Tue, 09 January 2018 06:36 UTC

Return-Path: <martin.thomson@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 6CE7F12025C for <quic@ietfa.amsl.com>; Mon, 8 Jan 2018 22:36:26 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] 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 QOnWv-hOKpXn for <quic@ietfa.amsl.com>; Mon, 8 Jan 2018 22:36:24 -0800 (PST)
Received: from mail-ot0-x234.google.com (mail-ot0-x234.google.com [IPv6:2607:f8b0:4003:c0f::234]) (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 89F9A126C22 for <quic@ietf.org>; Mon, 8 Jan 2018 22:36:24 -0800 (PST)
Received: by mail-ot0-x234.google.com with SMTP id p16so7868376otf.1 for <quic@ietf.org>; Mon, 08 Jan 2018 22:36:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=7qiYTbOupvzAXRiKqoxrKu10JfkKTbYgMmhidGMUb6g=; b=of2F+DQOgY4T6TLuQ/9g1PeGbz91OBgqvCnghwW4yFZczNSJHBK5KrSh148kbnZMOz vUGoCaUhoyitpdpb2NSnsOV+zAd+vvbCbH37t0aj9Zcexl8JcXR3tViA/nmhgv9eY7tH e1oaoEoMfY7ZHg/8dq8YT7gzxvCqfT/wNqHV27LQ4rlOh3aY2+umt2vCW+xZOAuclRI7 na0a1NjLBW1qAV341ioBjCjcsDPIIeEv2yICWwTP/4AqYW0d1YZJR+9zYhD8WFQqd9Ct qEZrXkkoj1HUMtl2LakbKJejF13eS7j7NO2EbOLRy52DKoLusNCgcDqgAbh9S0GvEwy4 lqpw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=7qiYTbOupvzAXRiKqoxrKu10JfkKTbYgMmhidGMUb6g=; b=FYPi/UBxWDFij2Age17o1V4U4dxn7AQj4GQ2MymVnU8dfoj3/6gEtlqMi+OQXKKgQl Mv34TmL9wQVr50uCIXYWzfJMGVeamCB0DHs44o4svr5K0F3ksaFPa4mTz7HehxzeQoZq GkLfahndmrPDCu93KdT8apLqcsT37NyBoJBF5vpGLcXvyInAayHt1akX0CNzQhCFv+PT CIf1yO6BiuA2gb33Nkw94rACXYXr15VU3DYGzOt1BCABtHpye9m/5p862xOvzJWUtJMv iLNnGciE9N/zUJagkXemVBHn9xp91jg/tL+/X0s58l5tgRPDmRfvJoZSAr9A6GkBPGVK rSbQ==
X-Gm-Message-State: AKwxytdzKKMtqXA1duRYdEmRW80CyC5NQkGfHvQV1UZ7fj0rzKz5+RjH RrbFOSSeNZMkxINNYwWCc2rZ/c2i7ZsbaK5O3cCRr+RX
X-Google-Smtp-Source: ACJfBov6YgCzKcu/EZRm0pR0GJDcmfaaYYIuqFSGFeuAh86rkBDCQXcGXNFiPhuzE5knxW3h89FPx+LrfkUNh/h7mJA=
X-Received: by 10.157.85.233 with SMTP id z38mr8550559oti.16.1515479783589; Mon, 08 Jan 2018 22:36:23 -0800 (PST)
MIME-Version: 1.0
Received: by 10.157.39.16 with HTTP; Mon, 8 Jan 2018 22:36:21 -0800 (PST)
In-Reply-To: <CABkgnnW89B+5Qo0u_+Wr5K0wCRZ3Wp-+CTWJbHRGGwD06hn-zw@mail.gmail.com>
References: <CABkgnnW89B+5Qo0u_+Wr5K0wCRZ3Wp-+CTWJbHRGGwD06hn-zw@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
Date: Tue, 9 Jan 2018 17:36:21 +1100
Message-ID: <CABkgnnUcLOv0H8MmTEJ5BvqAsOkir_ySU5_DG3r0MBcQ2C9i5g@mail.gmail.com>
Subject: Re: Removing packet number gaps
To: QUIC WG <quic@ietf.org>
Content-Type: text/plain; charset="UTF-8"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/d2-8qWF0Z3-Wg22JydQzRa0sV6M>
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, 09 Jan 2018 06:36:26 -0000

PR here: https://github.com/quicwg/base-drafts/pull/1043

On Tue, Jan 2, 2018 at 12:57 PM, Martin Thomson
<martin.thomson@gmail.com> wrote:
> There are number of problems with packet number gaps that I think we
> need to address.  Most are minor.  For instance, the initial packet
> number is not close to zero, which inflates the size of ACK frames
> from the very beginning of a connection.
>
> However, Christian just identified one that I think makes this more
> important to address: when using a new connection ID, the gap is the
> same size on both client and server.  This makes flows linkable.  The
> gaps between the last packet on the old flow and the first packet on
> the new flow can be calculated in both directions.  Flows can be
> linked by finding flows where client-to-server packets have the same
> (or very close) gaps as server-to-client packets.
>
> With a few small tweaks to the current design, I think that we get a
> much better solution.  Here is what I propose:
>
> Firstly, packet numbers start at zero and always increase
> monotonically, with no gaps.  A side benefit of this is that the first
> ACK frame will have a small encoding for largest_acknowledged (1 octet
> rather than 8 in most cases).
>
> Packet numbers are never encoded directly onto the wire, they are
> XORed with a masking value.  This value will change for different
> packet protection keys, and for different connection IDs.  Client and
> server will use different values so that gaps are hard to detect.
>
> Thus, we will have a third key derivation:
>
>    key = QHKDF-Expand(S, "key", key_length)
>    iv  = QHKDF-Expand(S, "iv", iv_length)
>    pnmask = QHKDF-Expand(S, "pnmask", 4)
>
> To make this work seamlessly, I'm proposing a tweak to QHKDF-Expand
> that includes the connection ID.  For that, the "Context" field that
> we currently do not use seems like a good choice.
>
> This will mean changes to the other uses of QHKDF-Expand:
>
> * the handshake secret can be changed to be a fixed rather than a
> derived value, so that we don't need to use the function (connection
> ID will be added during expansion into the separate keys)
>
> * during a key update, a zero-length or fixed connection ID will need
> to be used so that there is no confusion about which connection ID was
> in use at the time the update was made (editorially, I'm not certain
> how to manage this one, I might just go back to using
> HKDF-Expand-Label directly for that)
>
> Finally, we need to be very clear that even if the connection ID is
> omitted, those packets still use the implied connection ID in key
> derivation.  We will probably want to recommend that endpoints include
> a connection ID if they intend to support NEW_CONNECTION_ID or any of
> the related functions, at least around the time when a connection ID
> change is in place or the recipient of their packets could have
> difficulty picking the right keys.  This is already a problem of
> course, but this change would make it worse.