Re: KEYS_READY

Martin Thomson <mt@lowentropy.net> Thu, 14 February 2019 05:05 UTC

Return-Path: <mt@lowentropy.net>
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 CA81B12D4F3 for <quic@ietfa.amsl.com>; Wed, 13 Feb 2019 21:05:36 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.701
X-Spam-Level:
X-Spam-Status: No, score=-2.701 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=lowentropy.net header.b=N/fI6mB2; dkim=pass (2048-bit key) header.d=messagingengine.com header.b=T+bjz+3r
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 UoGXz5S31tay for <quic@ietfa.amsl.com>; Wed, 13 Feb 2019 21:05:35 -0800 (PST)
Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 1808F130E09 for <quic@ietf.org>; Wed, 13 Feb 2019 21:05:35 -0800 (PST)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 2A4B624614; Thu, 14 Feb 2019 00:05:34 -0500 (EST)
Received: from web3 ([10.202.2.213]) by compute1.internal (MEProxy); Thu, 14 Feb 2019 00:05:34 -0500
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lowentropy.net; h=message-id:from:to:cc:mime-version:content-transfer-encoding :content-type:subject:date:in-reply-to:references; s=fm1; bh=Opo lvEEK+wgnTLLynEIS7Nr89UTuKbGAejaDKStdo0I=; b=N/fI6mB2bmm2S+Q1n8X 7m0GR3Ske/vqwSKYx5qVrGAXPPZZZmEerZ1ylSksHeqOoz+IS8k0Bi6kmLRxmw9O daaz7vbjDmD4CIjtvwldn7Sp8lpbhrTxmzhLai5V/0rw3oXRymJhbOwmiXimGCP9 siQNyomTMskUSV08C6F73eGp2wVvuAGZtCBpnV6hAdNjqHbXIkKkt9D9Lgw/H46d WapxqD1Ff5SNuEVv5dualdra1aoHCnHaEYFsRnWq8mk8HrCooZvVfW9jDDnh4NKK c6pnAnIGv9sGT/97aJiZ3FARTh5KB7ncFQ7Zhp/rDwzXarWHf0nYQMNmY+A6rQQE BhQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=OpolvEEK+wgnTLLynEIS7Nr89UTuKbGAejaDKStdo 0I=; b=T+bjz+3rSe1xMdjCMi/XXc7y/N7IziWciR9+HTpL3E0N172JN5NTjlukU 18MHvI7Cyo8FVsHYnd+4eqsiR+vDjaadzZP/HXk9Z7z4gqQEhN5+q8WA+OyFKi/4 ZbXD4d0SKCYV8cRsgJVahNbs8X6XSckpBQqK2a5WnkoLBorkZ91W2C1ge4biIp+B rd8TVs5RnLlgV09eNiYsQ+aJaMOlR/egtdmePqmNXtLA+pLkp9qDp1MtRZP4Kn8m 1GIECaTZSgnhoelC9aG1xGj0q14Rwfp48457N2PgaOWjraSBh0gK5aan8VEm8jzn FruX5OXFsBMXAMguoulHSTssWNk6w==
X-ME-Sender: <xms:HfdkXNegdC2jeM7P2IxjZC2iIU6W6CYSfXWAda2tWynQJV1IV4awAA>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledruddtgedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfquhhtnecuuegrihhlohhuthemucef tddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefkhffvggfgtg foufffjghfsehtjeertdertdejnecuhfhrohhmpeforghrthhinhcuvfhhohhmshhonhcu oehmtheslhhofigvnhhtrhhophihrdhnvghtqeenucfrrghrrghmpehmrghilhhfrhhomh epmhhtsehlohifvghnthhrohhphidrnhgvthenucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy: <xmx:HfdkXHAtr-8Naw7DK7anT_Vs1C5SwIXfYsV0NUCd92MOw2G2kZ32mg> <xmx:HfdkXMA2L1MDf99dpmblSJEZaJFG2wiXDDEWWGrQ_0qrgkds9A2jGw> <xmx:HfdkXJbrRkWmZApUqrsAO7ZZriI6OTZ-67X01g5q4p6hZALxKIBCkQ> <xmx:HvdkXIZVEnq5iNj7L62ArhK7KgtPHl0hxupxtai8NKRKV9uhQ2Opgg>
Received: by mailuser.nyi.internal (Postfix, from userid 99) id 690119E54B; Thu, 14 Feb 2019 00:05:33 -0500 (EST)
Message-Id: <1550120733.954579.1657700168.72A8F92A@webmail.messagingengine.com>
From: Martin Thomson <mt@lowentropy.net>
To: Jana Iyengar <jri.ietf@gmail.com>
Cc: QUIC WG <quic@ietf.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="utf-8"
X-Mailer: MessagingEngine.com Webmail Interface - ajax-e97eb308
Subject: Re: KEYS_READY
Date: Thu, 14 Feb 2019 16:05:33 +1100
In-Reply-To: <CACpbDcfbEcg70RwpFrCQ2X6WA0Dd7ygd=Q0w7iwKc-ZgZQbZ0w@mail.gmail.com>
References: <1550022355.557617.1656828112.4DD1CEE6@webmail.messagingengine.com> <CANatvzy_juza_meGR_-KuBV9FA=F754mv54aawxMb8hYWxb1gA@mail.gmail.com> <CAN1APdcVYKWuapZ3XHxXa_nVACwkRD-xeF3ub-5ROttE7QVrmQ@mail.gmail.com> <CAOYVs2ooxAuwu_zr2XZ-y9UqUP5kTbjoFrckAOi40bF9vODGOg@mail.gmail.com> <CAKcm_gNk=jKrnXM4Ht4yF0RX25wtVifjxz0c1gay0uie7PMw6A@mail.gmail.com> <CANatvzxBYzEaDZ1Ftt=o1zT5zVcVTd1EwtGiJOC-mkrNUWzVAQ@mail.gmail.com> <CAN1APdfzepc9DE98UsWw=hB4dM38qKLxdAjpsYuddDBatcscDA@mail.gmail.com> <739AFC55-DD02-47AA-A29E-B9C34ED7D6F9@gmail.com> <CAN1APddWLdmRo+ZZDnmvrBEFQk4TTcS3UK_9AU4KqAeSkiBvJQ@mail.gmail.com> <375A63C5-7120-4688-8873-EEA90693332E@huitema.net> <CANatvzxoOFzpkcH_4VpQscpZq8ak0QL0D6REvyJVjE+ga97SVQ@mail.gmail.com> <1550111606.3717440.1657643080.033E200B@webmail.messagingengine.com> <ae018a6d-4c9a-acc7-4213-21d1670f9dad@huitema.net> <1550117510.928793.1657684264.41D049FA@webmail.messagingengine.com> <CACpbDcfbEcg70RwpFrCQ2X6WA0Dd7ygd=Q0w7iwKc-ZgZQbZ0w@mail.gmail.com>
Archived-At: <https://mailarchive.ietf.org/arch/msg/quic/RdtOEOy-5N0iPt31htHz0aYUeQU>
X-BeenThere: quic@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 14 Feb 2019 05:05:37 -0000

On Thu, Feb 14, 2019, at 15:24, Jana Iyengar wrote:
> (I've left this comment on the PR as well, but seeing that this discussion
> is happening here as well, echoing it here)
> If the peer hasn't acked the previous KEYS_ACTIVE, it may not have seen it
> yet. It is possible that it simultaneously did a key update and sent a
> KEYS_ACTIVE however. Under this condition, the endpoint wouldn't be able to
> update its keys again, since the peer may close the connection, right?

This is not a problem, but it requires thinking the process through.

An endpoint can only initiate a key update if it has received KEYS_ACTIVE.  It can only send KEYS_ACTIVE if it has received a key update (and is either responding, or initiated that).

Take the example where an ACK is lost, so a key update occurs when one peer is retransmitting KEYS_ACTIVE:

C: Update to Key Phase 1.
S: Update to Key Phase 1.  Send KEYS_ACTIVE.
C: Send packet containing ACK for the server packet containing KEYS_ACTIVE, plus KEYS_ACTIVE.  That packet is lost.
C: Update to Key Phase 0.
S: Update to Key Phase 0. Send KEYS_ACTIVE.

The server might believe that its KEYS_ACTIVE hasn't been acknowledged, but it has to be prepared for a key update as soon as it sends the frame.

If there is a simultanous update it looks like this:

C: Update to Key Phase 1.
S: Update to Key Phase 1.  (Concurrent with previous.)
C: Receive packet with KP1.  Send KEYS_ACTIVE.  Lost.
S: Receive packet with KP1.  Send KEYS_ACTIVE.

At this point, both peers are fine, they are on the same keys, and a key update can be triggered by the client.  The server can't update until the client repairs the lost KEYS_ACTIVE frame.  This continues:

C: Update to Key Phase 0.
S: Receive KP0.  Update to Key Phase 0.  Send KEYS_ACTIVE.

As you can see, the client stops sending when it updates again, but that's OK.

It's also safe if the KEYS_ACTIVE frames get through, but acknowledgments for them don't.