Re: Packet number encryption

Ian Swett <ianswett@google.com> Fri, 09 February 2018 14:15 UTC

Return-Path: <ianswett@google.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 CCE63127698 for <quic@ietfa.amsl.com>; Fri, 9 Feb 2018 06:15:03 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.7
X-Spam-Level:
X-Spam-Status: No, score=-2.7 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_KAM_HTML_FONT_INVALID=0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=google.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 Vr_ypFw_Linz for <quic@ietfa.amsl.com>; Fri, 9 Feb 2018 06:15:01 -0800 (PST)
Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) (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 D5371124205 for <quic@ietf.org>; Fri, 9 Feb 2018 06:15:00 -0800 (PST)
Received: by mail-io0-x22e.google.com with SMTP id n7so9786601iob.0 for <quic@ietf.org>; Fri, 09 Feb 2018 06:15:00 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5zNDOtdQVhF8aOyDBdOXBUCS5LKrnUDvZP2KShO2c+w=; b=trwoMW9l6zAp+IOGJarvs33c8nGB6NCyzbB55q//6kkJsc0bpAQ5EKj6rS/4LqM6G9 dwO8ulJ55MqUF9526Bew7/vbRNiuh06IUnli7eU9XdekFyFke+lU0imNkRCTcI9irS4P 1McB8zZiL3bu+3w+ZsWfYA9nCsbZ2+W8mUFFfgCCvmM98s0xEg44ifFybNQk8aUh29Ax s/aAxP39mO56fRZE4Ksd6VZ9aerq4EoYfI3Rc5iEe9k33QWLynI2Q6m40u7jMEc/JwCQ D8mQhWFqWb8Ie80GN9CLMkNzEPu9XKXHAWhhiA7H+BT4TtKxM03P5F9A25WFQdrFSLK1 xEGQ==
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:cc; bh=5zNDOtdQVhF8aOyDBdOXBUCS5LKrnUDvZP2KShO2c+w=; b=Gx7rISRcdtjY9lT0kktHFhJGyFmDD04kUorll7e/nzJDhQiCHUAeAseQube+CueuCS 524djxd8uVtwkHlLQ9TRWmXRmQHcKNcjouBYWsu8VjDyEL9egU7aXIUheO8+6hSr/sjy 2tdGLhbF/F5ouaGEgSaY/aftMIVLKYc4UjQ0Co6B/ujcAypjc7dCMv7VfzfkllMv8T39 +czx4d+iFQV2LRg+NAzn5B1qaLvRLnP9Ak2mVhV3zBuD9HAWSuMTDhqVArg6TKjysren ZdjlETbVIXtGjQndh3NJrK8WkIwKbYmb6v4tQObxacuHpR9Rw3x5pTDEd6cqHaxTqH2n KQ2A==
X-Gm-Message-State: APf1xPD4wtGc8SlCpk19Y+yrbnvWtJr1hqKwO09ID15iZxkYMexi1T7t ymftx5cLbOituw0GDAHO4BmhnzMfmdY1plNG5jkFpRGw
X-Google-Smtp-Source: AH8x224j8ivNucBmCBrQAzyQL6LowFPsH2JsH+wIUoMW5imPPnrm2i3CBcI6hJCWJqnOGBZ3hqlX0ucOugZ0NXWwQoY=
X-Received: by 10.107.89.11 with SMTP id n11mr3247918iob.154.1518185700015; Fri, 09 Feb 2018 06:15:00 -0800 (PST)
MIME-Version: 1.0
Received: by 10.107.222.4 with HTTP; Fri, 9 Feb 2018 06:14:39 -0800 (PST)
In-Reply-To: <CABcZeBNeTT79nd+d7h-KFPpFYxpr5wt1KgwPY=M0_UQpCkKq1w@mail.gmail.com>
References: <CABkgnnVyo3MmWtVULiV=FJTnR528qfY8-OmKGWAs0bCvri-a_g@mail.gmail.com> <CAGD1bZauKbucs_5n7RQbK8H2HiyfiqpGVEcKreGA6umhMBSFgg@mail.gmail.com> <CABcZeBPNrc-9vANSH02r++p53s6gN4pVB8DMd80nUxOhKTp3dA@mail.gmail.com> <CAKcm_gMvHSBhpUvsQCCkV2_o+d_wchF3R3L6H8mp6nKNaaRmSw@mail.gmail.com> <CY4PR21MB0133CCAA6807469BA983D00BB6FC0@CY4PR21MB0133.namprd21.prod.outlook.com> <CABkgnnW4xr_YzpsvCxaJJgcQdBTuX=Yv735_sdd4VoMfji8mbA@mail.gmail.com> <CY4PR21MB0133C759D4A08A4988B641B2B6FC0@CY4PR21MB0133.namprd21.prod.outlook.com> <bdf88936-8edc-d56e-ee59-c9d597058edd@huitema.net> <CY4PR21MB01337C8A700E58B49D90B712B6FC0@CY4PR21MB0133.namprd21.prod.outlook.com> <119b3276-5799-1cc3-8982-7479171bbf27@huitema.net> <CAOYVs2pi8-NVuS+crNMfjsP-n5upK3=5tPeQ8OSGpOvL6RTrjA@mail.gmail.com> <CY4PR21MB0133A1117B2733BBCF049C5FB6FC0@CY4PR21MB0133.namprd21.prod.outlook.com> <MWHPR08MB24327A7BB5AE1AE70FE5CDB1DAF30@MWHPR08MB2432.namprd08.prod.outlook.com> <533a0a2e-3a87-b55f-84ce-c52bc03cd81c@huitema.net> <MWHPR21MB0144C68102972A668611E1FCB6F20@MWHPR21MB0144.namprd21.prod.outlook.com> <CY4PR21MB01332141C3563ABBA240C566B6F20@CY4PR21MB0133.namprd21.prod.outlook.com> <CABcZeBNeTT79nd+d7h-KFPpFYxpr5wt1KgwPY=M0_UQpCkKq1w@mail.gmail.com>
From: Ian Swett <ianswett@google.com>
Date: Fri, 09 Feb 2018 09:14:39 -0500
Message-ID: <CAKcm_gOsv49oWVee6WO8cG_K+gNjAoxfpRGbHpkDSm5-vm1LdA@mail.gmail.com>
Subject: Re: Packet number encryption
To: Eric Rescorla <ekr@rtfm.com>
Cc: Praveen Balasubramanian <pravb@microsoft.com>, "quic@ietf.org" <quic@ietf.org>, huitema <huitema@huitema.net>
Content-Type: multipart/alternative; boundary="f4f5e80671985acf250564c82775"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/sycVuYM5FjAHxY0Js5A-uR2ycO4>
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: Fri, 09 Feb 2018 14:15:04 -0000

On Fri, Feb 9, 2018 at 8:51 AM, Eric Rescorla <ekr@rtfm.com> wrote:

>
>
> On Thu, Feb 8, 2018 at 9:40 PM, Praveen Balasubramanian <
> pravb@microsoft.com> wrote:
>
>> Actually taking a step back what if we don’t we overloaded packet number
>> as the nonce?
>>
>>
>>
>> Can we:
>>
>>    1. Put packet number as a separate variable length field in the
>>    encrypted portion of the header. This allows for growth beyond 64 bits in
>>    future and completely avoids ossification. For short lived flows variable
>>    length encoding leads to minimal space overhead.
>>    2. Put a separate plaintext nonce which starts out as a secure random
>>    number and monotonically increases as short random jumps (every packet or
>>    every few packets) and could then rollover. This will prevent linkability
>>    and scales to multi-path as well. No major compute overhead. We can also
>>    make the nonce optional for crypto algorithms that do not need a nonce
>>    saving more space.
>>
>>
> I'm not sure how to do #2 safely and efficiently. The primary concern is
> that short random jumps don't actually prevent linkability because the high
> order bits don't change and long random jumps are effectively randomly
> sampling out of the nonce space, and you start to run into birthday
> problems. Additionally, the cheapest PRNGs are basically ciphers in counter
> mode, so at best you're going to get a small amount of overhead reduction
> by getting multiple jump computations out of a single block, though if you
> use 96-bit jumps, you only get 25% savings...
>
> -Ekr
>
>
>
> Some MSB of the nonce could be used for signaling reorder to the network
>> if needed. I don’t have the historical context for overloading of PN as the
>> nonce so pardon me if un-overloading option was discussed and ruled out
>> before.
>>
>>
>>
>> *From:* QUIC [mailto:quic-bounces@ietf.org] *On Behalf Of *Praveen
>> Balasubramanian
>> *Sent:* Thursday, February 8, 2018 5:51 PM
>> *To:* huitema <huitema@huitema.net>; quic@ietf.org
>> *Subject:* RE: Packet number encryption
>>
>>
>>
>> >> and using separate packet sequences for each path
>>
>> This alone prevents linkability right?
>>
>>
>>
>> >> The packet number on each path will start at 1 (or maybe 0 ;-).
>>
>> Is supporting multiple paths at the same time a goal? If yes, then yes
>> all paths will need to have separate tracking and ACK state and congestion
>> control etc. I thought this is not part of V1 RFC. If its just one
>> additional path for connection migration scenario then all you need is a
>> (random) jump to a offset in packet number space for the new path so that
>> the few packets in the old path can continue for a little bit. This works
>> with just one ACK space so no implementation complexity.
>>
>>
>>
>> >> 2) Or, leaving the packet number in the clear but using different
>> encryption contexts for each path, and using separate packet sequences for
>> each path.
>> In addition if the value in the clear was obfuscated with an XOR
>> transform it will help prevent ossification. The obfuscation is not meant
>> to guard against later analysis that reveals the packet numbers - why do we
>> care about that. It is meant to grease the space and not make the numbers
>> serial so middleboxes cannot assume ordering etc.
>>
>>
>>
>> All said if I am alone in being concerned about the perf hit then I’d say
>> go on with option 1.
>>
>>
>>
>> *From:* QUIC [mailto:quic-bounces@ietf.org <quic-bounces@ietf.org>] *On
>> Behalf Of *Christian Huitema
>> *Sent:* Thursday, February 8, 2018 3:54 PM
>> *To:* quic@ietf.org
>> *Subject:* Re: Packet number encryption
>>
>>
>>
>> On 2/8/2018 1:13 PM, Mike Bishop wrote:
>>
>> #2 won’t work.  The packet number is an input to the AEAD nonce, so you
>> have to get to the packet number before you can decrypt the payload.  It
>> can’t be based on anything internal to the encrypted packet.
>>
>>
>>
>> In Martin’s proposal, it’s using a combination of the encrypted payload
>> (which requires nothing to access) and some stored state on each endpoint,
>> which requires only the Connection ID to look up.  You want the thing you
>> XOR by to be constantly changing, or it becomes easier to look at sequences
>> of obfuscated packet numbers and start drawing inferences about what the
>> XOR value is.  If overhead is the primary concern, I think there are a
>> couple approaches that might allow you to precompute values and amortize
>> the cost of doing the encryption step.  (At the cost of keeping the table
>> of precomputed values, of course.)
>>
>>
>>
>> I still think Jana’s pushing in the right direction here:  Let’s agree on
>> goals, and then see if we can craft a design that meets those goals.  I
>> hear you saying that low overhead is a goal, which I think we can all agree
>> on.  I also think I hear you saying that 1-1.5% overhead is too high, but
>> it sounds like there’s less agreement on that.  You also raise an
>> interesting point that some clients will care less about linkability
>> because they will never intentionally migrate.
>>
>>
>> I think Victor said it best, "Obfuscation is just encryption done
>> poorly." Either we encrypt, or we don't. But there is no such thing as an
>> obfuscation middle-ground. Obfuscation would just be a speed bump, easily
>> broken. It won't provide privacy, and it won't prevent linkability.
>>
>> As far as I am concerned, there are only two designs that prevent
>> linkability:
>>
>> 1) Martin's PR, in which the packet number is encrypted using sensible
>> crypto;
>>
>> 2) Or, leaving the packet number in the clear but using different
>> encryption contexts for each path, and using separate packet sequences for
>> each path.
>>
> I don't believe the second is necessary if we want to leave the PN in the
clear.  Avoiding nonce reuse is relatively easy.  Avoiding linkability is
more annoying, but doable.

On net, I think encryption may be the best approach, but I don't think not
doing encryption demands the complexity you indicate.


> The second option requires more computation when explicitly setting up a
>> new path. The connection ID would be used as part of the "salt" when
>> deriving connection contexts. The packet number on each path will start at
>> 1 (or maybe 0 ;-). This requires maintaining separate SACK dashboards for
>> each path/Connection-ID, and constraining ACK to be per/path, or
>> alternatively adding a PATH-ACK frame that indicates the path for which
>> packets are acked.
>>
>> The pros and cons of the two options are easy to get:
>>
>> 1) Option 2 does not require the cost of encrypting every packet, thus
>> per packet processing will be maybe 1% faster than option 1.
>>
>> 2) Option 2 requires computing encryption contexts for each path, which
>> is more complex than option 1, but the cost will be amortized over the
>> duration of the path.
>>
>> 3) Option 2 requires more complex data structures and ACK management,
>> thus increasing the chances that something goes wrong.
>>
>> 4) Option 2 does nothing against packet number ossification. The packet
>> number effectively becomes part of the invariants.
>>
>> In short, the only advantage of option 2 is to avoid a single symmetric
>> encryption operation per packet, while making the code significantly more
>> complex, and at the cost of not protecting against PN ossification. The way
>> I see that, there is hardly any debate.
>>
>> -- Christian Huitema
>>
>
>