Re: Packet number encryption

Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com> Sat, 10 February 2018 11:35 UTC

Return-Path: <mikkelfj@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 738C012773A for <quic@ietfa.amsl.com>; Sat, 10 Feb 2018 03:35:49 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.697
X-Spam-Level:
X-Spam-Status: No, score=-2.697 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_LOW=-0.7, SPF_PASS=-0.001, UNPARSEABLE_RELAY=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 oZaRNInIoKeJ for <quic@ietfa.amsl.com>; Sat, 10 Feb 2018 03:35:47 -0800 (PST)
Received: from mail-it0-x230.google.com (mail-it0-x230.google.com [IPv6:2607:f8b0:4001:c0b::230]) (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 383A0126BFD for <quic@ietf.org>; Sat, 10 Feb 2018 03:35:47 -0800 (PST)
Received: by mail-it0-x230.google.com with SMTP id i144so1546522ita.3 for <quic@ietf.org>; Sat, 10 Feb 2018 03:35:47 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=zp9brfWHZTaPklOeTUinFniSTDgDAk09whG3yQ6x2YM=; b=f8896HFICLWlIwcLclkU0ZTWh9q31vPNBezGmr19F6j/DYyUbgNdsmIoq37nUmrRic eas1IoDx6YvKc+wNZki9CMuygQ9830Q52JzCjHcdU1rVkqFKpgeTDEsExN+LUAi5kpic 0YcOzpMApeVhah0RX+HD5/oe6TBks/we6d/PvAoLGVZdTfkt6aMmfStxmVZ4FS+gN2eh 9NGUro72u3Q8bUwgdwHUHZWWVixRzKh8hjRJUSez+77ns8+vb2KS+HTzl/oCkjesZVDP KtkcLq+DwkrQ1l1+IRtT+SLRKOKc7bof8CpXtXxjy7+/4Yq3OHifTlJsEVX9anNA1eTD rnBw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=zp9brfWHZTaPklOeTUinFniSTDgDAk09whG3yQ6x2YM=; b=LIu1bPhUw/U0pdUOv0kUzT8l/VDDeuDqdJFYdm7PfhUcE3hcTaHhKKrk9YMvB6Y1u7 5wIY0q5gT7JQRXMNb7HbAH0XkCI5V7+xhNiYAT6++NWq8LhJsOOIxK6OMZTPJ0WbGHw0 X4JM6ythsvYzko8fwhU29m84bRMRYrwz24yT8aAzgF96AMh7YOQq7XQqNMPsoVUcIo7s fpQY1NpqNeLwyTUDUgQ5OduqFq8f0OPrjjo0pihMJZ7r7E24PZv+pdltS43mYhN5c0+e 3U20FeMwCp6vQgu8qXHXr/WR3p2Kw0P91mLwbEbPWAT+BDP3I1ssxK/KCqNrebliBZ6e olEQ==
X-Gm-Message-State: APf1xPDbQAsE88wdHNF/9zYFyqn2aEjUoczichNCoQKHUh5TmYNPZUQK Jdll/tsZl+b+iKi8YJQ85aweaRGbxWeHa++y0S0=
X-Google-Smtp-Source: AH8x224UZ5Cdj5OImsIEEdEY7RfZ3qGI2P+ZfLnutCFeE1MkLoLDyTc1g3PB/eGH73n9f1YTgDtIFF52aaRnv7X7X90=
X-Received: by 10.36.10.207 with SMTP id 198mr7006461itw.42.1518262546640; Sat, 10 Feb 2018 03:35:46 -0800 (PST)
Received: from 1058052472880 named unknown by gmailapi.google.com with HTTPREST; Sat, 10 Feb 2018 03:35:45 -0800
From: Mikkel Fahnøe Jørgensen <mikkelfj@gmail.com>
In-Reply-To: <DB6PR10MB176692436653B08C1CA949C2ACF10@DB6PR10MB1766.EURPRD10.PROD.OUTLOOK.COM>
References: <CABkgnnVyo3MmWtVULiV=FJTnR528qfY8-OmKGWAs0bCvri-a_g@mail.gmail.com> <2102BDC2-62C0-4A76-8ADE-8167437E2D07@trammell.ch> <CAN1APde6o6=aCXuWajPFSU=jXv-ERdVHk=uyjM71uQ_uU-oMTg@mail.gmail.com> <8e833029-68b5-2787-3897-a0f7818a259f@tik.ee.ethz.ch> <1de39727-eeec-0e7a-1e8b-5ed50433c5bd@cs.tcd.ie> <MWHPR08MB2432D0216BC8FE1B0D9E3690DAFD0@MWHPR08MB2432.namprd08.prod.outlook.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> <CAAZdMad-vEBj4Zw-9=bM8hfSui68YBPTi88ZB434giYMXA1viQ@mail.gmail.com> <MWHPR21MB0144A36781B9AB9BEC7B99A8B6F30@MWHPR21MB0144.namprd21.prod.outlook.com> <CAAZdMaf_okyh1FHemPK90=RQp2Tb-p34SA_C77RLp68bwWSE2Q@mail.gmail.com> <CAN1APdchpj++3K5AcYZk-SMPBRDi3jvo7gjSMQwdYY_NuLNkgQ@mail.gmail.com> <CAAZdMaf-+q+3L9XPBLgDq6qGzVed4NaGOL63DqjGTcSm8g6oBA@mail.gmail.com> <DB6PR10MB176692436653B08C1CA949C2ACF10@DB6PR10MB1766.EURPRD10.PROD.OUTLOOK.COM>
X-Mailer: Airmail (420)
MIME-Version: 1.0
Date: Sat, 10 Feb 2018 03:35:45 -0800
Message-ID: <CAN1APddho1==P7x3PV-F2Rj5DJkfzGLx5UqsN4fxOBg-C30RDg@mail.gmail.com>
Subject: Re: Packet number encryption
To: Victor Vasiliev <vasilvv@google.com>
Cc: Praveen Balasubramanian <pravb@microsoft.com>, "quic@ietf.org" <quic@ietf.org>, Marten Seemann <martenseemann@gmail.com>, huitema <huitema@huitema.net>
Content-Type: multipart/alternative; boundary="001a1144b828c4b7580564da0ba7"
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/75Nk3ujkuP7O3fktgZPxx2CKhqA>
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: Sat, 10 Feb 2018 11:35:49 -0000

To put numbers into perspective using Intel 2015 data

https://software.intel.com/en-us/articles/improving-openssl-performance#_Toc416943490

A 64 byte message in AES-GCM AEAD in HW would use 1.03 cycles per byte or
66 cycles total, or 22ns on a 3GHz core.

For packet numbers we use the CBC encrypt numbers because here AES cannot
exploit block parallelism.
Here we see 4.44 cycles/byte in HW or 71 cycles per block. With a 3GHz
setup that would amount to about 24ns overhead for packet encryption.

Clearly it makes no sense that AES-GCM is faster than a single AES block
encryption, but these are only approximate numbers and CBC mode might have
a little overhead, so we clamp packet numbers to 22ns.

Taking the 98ns overhead by the Solarflare report we get a total
(simplified) processing time is 98ns non-crypto, 22ns for packet number,
and 22ns for AEAD totalling 142ns. So the packet number encryption overhead
would be 22/(98+22)*100% = 18%. The numbers ignore other QUIC bookkeeping,
but that can be done in other cores or outside the latency critical window.

This does not take into account that AEAD operation may operate less than
optimal because the packet number must be extracted first. On the other
hand, it is also not a disastrous overhead if no good alternative can be
found.

Earlier AES-NI I’ve seen from Intel doc suggests around 100cycles in HW for
a single AES-128 block which would be 33ns per packet number in the above
example.

On 10 February 2018 at 06.18.25, Mikkel Fahnøe Jørgensen (mikkelfj@gmail.com)
wrote:

98ns for 68 byte messages