Simple transform for improving PN ossification prevention

Praveen Balasubramanian <pravb@microsoft.com> Mon, 09 April 2018 20:48 UTC

Return-Path: <pravb@microsoft.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 AB17412D7EC for <quic@ietfa.amsl.com>; Mon, 9 Apr 2018 13:48:41 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.11
X-Spam-Level:
X-Spam-Status: No, score=-0.11 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_DKIMWL_WL_HIGH=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=microsoft.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 vksLhItlc89Q for <quic@ietfa.amsl.com>; Mon, 9 Apr 2018 13:48:39 -0700 (PDT)
Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0126.outbound.protection.outlook.com [104.47.42.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 142371204DA for <quic@ietf.org>; Mon, 9 Apr 2018 13:48:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=osCPzH58IYpU5i6YsQ1kFDftCvvEUIVD3lPpMajrYpk=; b=AnGJwVqfpEkrACZh2dawsXmY5z4LETgMSJ1iVdwLtRB3X3zkqfAZrZHBISEEx/QDa6Z6gWBE6KM9hk1HlLk8yMu4SgjOzUWxWgmH3hYs1qMwJi5QsBm72GSSE9RrpDwZD0TXd99U8i4rn4kh97EYv9xsarjoqUdFbPwckpoQBp4=
Received: from CY4PR21MB0630.namprd21.prod.outlook.com (10.175.115.20) by CY4PR21MB0118.namprd21.prod.outlook.com (10.173.189.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 20:48:38 +0000
Received: from CY4PR21MB0630.namprd21.prod.outlook.com ([fe80::fc65:cb01:17a1:639d]) by CY4PR21MB0630.namprd21.prod.outlook.com ([fe80::fc65:cb01:17a1:639d%3]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 20:48:37 +0000
From: Praveen Balasubramanian <pravb@microsoft.com>
To: IETF QUIC WG <quic@ietf.org>
Subject: Simple transform for improving PN ossification prevention
Thread-Topic: Simple transform for improving PN ossification prevention
Thread-Index: AdPQQ8p5pfJiY2+yR8ud9raMWX53bw==
Date: Mon, 09 Apr 2018 20:48:37 +0000
Message-ID: <CY4PR21MB063025EF8B5F228BB242920AB6BF0@CY4PR21MB0630.namprd21.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [2001:4898:80e8:9::712]
x-ms-publictraffictype: Email
x-microsoft-exchange-diagnostics: 1; CY4PR21MB0118; 7:Cp8K4wxXHds3u6R3e0Z1yITSA43c16AF0JdyLRa/ppTLZA2vqMthuOcEZaI2dKJRIMmuWSzK9YjR7NJEPZP7I/o7qUtyNZstnxqmfhcFZM7g3xKqNMD3fvp30+gyu8d8cYccOu57sTUPIaob1dO/kOmCXq+pJNsG61nI+6eK12+y+ZZWsie5gWA4/0+MdChP6UPRABieSARDtIMPcg2xTa9sUcaRy2nMCGlahaYgbSzJ9BuGwOlun6Ep8FT9HV0C; 20:ycK5qmH1pghEqQhTSD6hW4rcegRdHWJr+J1gXFjMMVwEeVFWrhNgmwrvDbpBvaz3IaD3YLvgN1kegZPQ3+PaVXPP2bZkYm6QPUfUvM1iB82HXWjH+SIZFrQO56XCbIGaIeXEJ/YeuZV67RsPHjD7po5akKASyh2g141XPSfC2jU=
x-ms-exchange-antispam-srfa-diagnostics: SOS;
x-ms-office365-filtering-ht: Tenant
X-MS-Office365-Filtering-Correlation-Id: d522d3f2-2f5e-48c2-8758-08d59e5b44d2
x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020); SRVR:CY4PR21MB0118;
x-ms-traffictypediagnostic: CY4PR21MB0118:
authentication-results: spf=none (sender IP is ) smtp.mailfrom=pravb@microsoft.com;
x-microsoft-antispam-prvs: <CY4PR21MB0118ACB8EE0272ADF1092DEFB6BF0@CY4PR21MB0118.namprd21.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(28532068793085)(21748063052155)(15185016700835);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(61426038)(61427038)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR21MB0118; BCL:0; PCL:0; RULEID:; SRVR:CY4PR21MB0118;
x-forefront-prvs: 0637FCE711
x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(346002)(39860400002)(396003)(366004)(376002)(39380400002)(199004)(189003)(2906002)(59450400001)(5250100002)(102836004)(6116002)(790700001)(106356001)(6506007)(10290500003)(3280700002)(6436002)(186003)(33656002)(8990500004)(68736007)(561944003)(486006)(97736004)(606006)(476003)(478600001)(2900100001)(7696005)(22452003)(86362001)(86612001)(14454004)(99286004)(966005)(7736002)(8676002)(81156014)(81166006)(8936002)(55016002)(236005)(3660700001)(9686003)(74316002)(10090500001)(6916009)(54896002)(6306002)(46003)(105586002)(53936002)(5660300001)(25786009)(316002); DIR:OUT; SFP:1102; SCL:1; SRVR:CY4PR21MB0118; H:CY4PR21MB0630.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1;
received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts)
x-microsoft-antispam-message-info: cA7iT6iY8cYVv8cZUyheaLjsNrZ2JtFsUEeTfB/vjVhrwffl0hj/OoUBKmXDDeS6nWk3ug5BR2vT5XI7f2LLcg4zIHQ8YO4Uo52+9K8q+JX+7lHUBAtAYtKRRk9WgKRUXCEaiBQNahYJBLiY2PdDlybtjP9B3hjX2OCwBcqgtkT2KWxEBch5XVyYTDPG9seoWkrYlKp8SbH31kev0nm74eeeQKr1OcVOlEAA6Q/CCaORG77cQQY9J2iVEFY4nLeHnSmrzuXxZOShh/ecJztUhNKjBMuy0D1cPxV38rmA0xVoEhBz8Dagr2QkdylGrpK6OU5jYGbNP6TRVg57HnOmcAeJLyeZmV92QAmRjONrI9ZEzOkMEHQnJ8PtESEr7YXA2nGtijMt+iX2ZprvoI8qpGjQwKA3I8SFuVvUvRibjRk=
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: multipart/alternative; boundary="_000_CY4PR21MB063025EF8B5F228BB242920AB6BF0CY4PR21MB0630namp_"
MIME-Version: 1.0
X-OriginatorOrg: microsoft.com
X-MS-Exchange-CrossTenant-Network-Message-Id: d522d3f2-2f5e-48c2-8758-08d59e5b44d2
X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 20:48:37.4934 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0118
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/M_3lQFp0CSQ8mI8l03H5GZDXV4U>
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: Mon, 09 Apr 2018 20:48:42 -0000

The current approach in the draft for preventing PN ossification is to use a random starting PN. Kazuho pointed out a problem with this approach where middleboxes could interpret the PN as a sequence number. And in an attempt to be "helpful", they could reorder the packets exacerbating the HoL blocking problem and may cause issues for unreliable semantics.

If the PN in the clear (the nonce value) didn't always monotonically increase then it will preclude such bad behavior by the middleboxes. Hence we need to find a simple transform that is not monotonically increasing and also not repeating.

Requirements for any PN transform in the single path case:

  1.  The actual PN must always increment by 1 and will be used for generating ACKs in ACK frames.
  2.  The transformed PN in the clear is a nonce and must not repeat over the connection lifetime.
  3.  Middleboxes must not be able to determine the actual PN. Only the QUIC receiver should be able to do so.

PNE is one possible transform that meets all these requirements but it is expensive CPU cost wise and has implications for hardware implementations.

Following is a proposal for an alternative simple transform with low CPU overhead which satisfies these three requirements. The goal is to produce a non-repeating shuffle of the original set of numbers. Since the PN space is very big and efficient shuffle algorithms have O(n) space requirement, we need to define a "reorder degree" or a "batch size" within which we will shuffle the packet numbers.

As an example consider that the starting random PN is 100. Per the current draft the actual PN increments as follows:
    100, 101, 102, 103, 104,    105, 106, 107, 108, 109, ... and so forth

Let's assume a "batch size" of 5. Then using one possible outcome of the shuffles we can generate the following as the cleartext nonces:
|  102, 104, 103, 101, 100, |  107, 105, 109, 108, 106 |   ,... and so forth
The bars | indicate batch boundaries.

Of course since we need the QUIC receiver to get the actual PN from the cleartext value, we need to communicate the offsets in the encrypted portion of the packet, which for this example would be:
|  +2,    +3,   +1,   -2,   -4,    |    -2,   +1,   -2,    0,     +3    |,  ....
Middleboxes will not be able to see the offset values in the clear. QUIC receiver will need to do a simple add of a signed number to get the original PN. This is very cheap operation CPU cost wise.

A QUIC sender implementation can pick any size for the reorder degree, the trade-off is the space complexity and packet space needed to communicate the offsets. A reorder degree within 128 numbers will need at most an extra byte in the encrypted header to communicate the signed offset values. The 128 batch size i.e. a 1 byte offset size should be more than enough entropy to discourage a middle box from "fixing reordering" and in practice we may need less.

One possible algorithm for the shuffle is the Fisher-Yates (Knuth) shuffle as documented here: https://en.wikipedia.org/wiki/Fisher-Yates_shuffle . Please see the "Modern method" section which is in-place. The random number generator doesn't have to be a secure variant.

One advantage of such a scheme is that packet loss can still be inferred by looking at each batch sized set of the nonce (packet numbers). For example if the batch size is 128, then missing numbers in this batch size (or a multiple) will show the extent of packet loss. The other advantage is that a QUIC diagnostic connection can trivially detect a bad middlebox that tries to reorder the nonce in sequence as it will be easily distinguishable from a random network reorder.