Re: [TLS] [DTLS1.3]About the retransmission of Handshake records

Xuan k <kxuanobj@gmail.com> Mon, 02 December 2019 11:18 UTC

Return-Path: <kxuanobj@gmail.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C436B120047 for <tls@ietfa.amsl.com>; Mon, 2 Dec 2019 03:18:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 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_NONE=-0.0001, SPF_HELO_NONE=0.001, 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 yLDUZZc0Z_Jt for <tls@ietfa.amsl.com>; Mon, 2 Dec 2019 03:18:10 -0800 (PST)
Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) (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 EC068120020 for <tls@ietf.org>; Mon, 2 Dec 2019 03:18:09 -0800 (PST)
Received: by mail-vs1-xe2a.google.com with SMTP id l24so1856863vsr.12 for <tls@ietf.org>; Mon, 02 Dec 2019 03:18:09 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UN7oviwrLt1HzQVeqS36fa8Z3983yiF1hM8VKIpPH2g=; b=RitbTE/Io8p34JaqhTjAqoDgJ+xOVn4W+eHa7vkrmM2HtD6AxfaSBrjns5xKPBSQ/R vYlXlU/y/HN74/czSgAnq63lvhzLRbZJ3uSoZhNveETZ8NWghu8NM0SGmROPK5s6DLL4 0rnp07M1yokkBygVNmvgyDTe3tSxzNL6nnp/LaiObWmArX24vXEdpS7jtYkWA+qrXGjV AzTz/gxLotXJAjSbxXXtmuv0wPNuCZnftHFSrYyY2JmP5m+LCA+rh+pO7LXAT/CbA69u 5dHbymtXjXzTrMXbMi81YCQQnokgUHJGF+BFRybXv9zCocfhczFb0S8SPT1d5hTiNzR4 WtDQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UN7oviwrLt1HzQVeqS36fa8Z3983yiF1hM8VKIpPH2g=; b=lY6omhbOp7mHinvjRYESNzmlgd8Zmp0eo8QUnVKC+s9Nxo9dWfwXSR9EktKCVO9vlw esnI7uSXkWELGZiW1hf5UBxK1rJQ3cv6ZXPF+zCDG5x+Axhv4LK4dBxO5A1VSg0SFgCx r0GSStK/t0hWmNRn5xxA0730Czy0okJV8p1OJiB7mseuRgpbR9sSmUzDyegcwukr5E9w IXYmA3d3a5iKOtetFEzCqCNtYhj2qKO2TnZ8XWzSFs2l3QPw+mJnXIUSVtuKTHR77dHG Uf2qtJSS8oIebmY0rhkU+ZIUEkb/1H9HN+eJwfIAZKmVqeWB/W/+d5dFIp7lePm8S9FW /yow==
X-Gm-Message-State: APjAAAUh7bfVXlER+qNHrb+cQUBgMXV6XKpoM/n+3EHxt3BGPyopjjTL enqDpl+lHdw3s6gD91bpQJZTz82/ZdM7ATuStBtgTKEuSNM=
X-Google-Smtp-Source: APXvYqwOtkMN1q8XtWLxEz67/ICa7wGJnZgbUTE9oWtXhBafRZ75h2GmPbjcuoVm/P1xxHHqgTN5YAGVeeAxKUBo53g=
X-Received: by 2002:a67:7d17:: with SMTP id y23mr4743531vsc.162.1575285488744; Mon, 02 Dec 2019 03:18:08 -0800 (PST)
MIME-Version: 1.0
References: <CAAnY7J27g1Df0XBe1U66z98ThQgRaom1YBF9k2UGTi4YL9i+Ng@mail.gmail.com> <CABcZeBOuJ3bOKOt6vFRJzOZbwkXzZK0jUJNyAxeAmkpxQJCzzA@mail.gmail.com> <CAAnY7J0z_btrQYzGtZavQqJwrEJ6H-+tho7xqhy9Y6RM6atv+Q@mail.gmail.com> <20191202075444.GI3397@akamai.com>
In-Reply-To: <20191202075444.GI3397@akamai.com>
From: Xuan k <kxuanobj@gmail.com>
Date: Mon, 2 Dec 2019 19:17:32 +0800
Message-ID: <CAAnY7J0842L2qVptNz7dVpV-Jt3Tdttt8Y2YeUPHhVq+e6dbfQ@mail.gmail.com>
To: Benjamin Kaduk <bkaduk@akamai.com>
Cc: Eric Rescorla <ekr@rtfm.com>, "<tls@ietf.org>" <tls@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000f9fda30598b6bbc4"
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/KanPwpsBim4gt4na8ili2HIKLZ4>
Subject: Re: [TLS] [DTLS1.3]About the retransmission of Handshake records
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "This is the mailing list for the Transport Layer Security working group of the IETF." <tls.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/tls>, <mailto:tls-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/tls/>
List-Post: <mailto:tls@ietf.org>
List-Help: <mailto:tls-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/tls>, <mailto:tls-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Dec 2019 11:18:13 -0000

Hi Ben,

Thanks for your reply. But we understand may not be the same.

Since ACK messages are not retransmitted, I think they should not consume
message_seqs.
If an ACK really use a message_seq and it is lost in network, new handshake
records will
always use a larger message_seq than the peer expected (next_receive_seq).
The peer will unable to continue the handshake process.

And I think the ServerHello in the figure should start with 1, as the
figure shows.
The message_seq = 0 is used by HelloVerifyRequest, which is also been
processed by client
and been fed into its transcript hash function.

So I think the HelloVerifyRequest should be counted and new ServerHello in
the figure
should start with message_seq = 1.

Thanks,

Zhai Zhaoxuan

On Mon, Dec 2, 2019 at 3:54 PM Benjamin Kaduk <bkaduk@akamai.com>; wrote:

> That might be an artifact from Ack having at one point (the -00) been
> a handshake message.  Though, it seems that the Server's message_seq
> space should also start at 0 with ServerHello, if I am understanding
> correctly.
>
> -Ben
>
> On Thu, Nov 28, 2019 at 03:15:38PM +0800, Xuan k wrote:
> >  Hi Ekr,
> >
> > Thanks for your help.
> >
> > I have another question about the "message_seq" in section "6. Example of
> > Handshake with Timeout and Retransmission".
> > Could you please explain it?
> >
> > In the secion 6, the Client send message_seq = 0 in Record 0 and
> > message_seq = 2,3,4 in Record 2.
> >
> > Why message_seq = 1 is skipped by Client?
> > I think the ClientHello in the figure should begin with message_seq=1.
> The
> > message_seq = 0 is used by the first ClientHello which is the one without
> > cookies.
> >
> >
> > Thanks,
> > Zhai Zhaoxuan
> >
> > On 11/28/19 5:37 AM, Eric Rescorla wrote:
> >
> >
> >
> > On Tue, Nov 26, 2019 at 10:05 PM Xuan k <kxuanobj@gmail.com>; wrote:
> >
> > > Hi all,
> > >
> > > I'm trying to implement a DTLS1.3 library for embedded devices. But It
> > > seems something weird about retransmissions and ACKs.
> > >
> > > In the section "5.2. DTLS Handshake Message Format":
> > >
> > >    The first message each side transmits in each association always has
> > >    message_seq = 0.  Whenever a new message is generated, the
> > >    message_seq value is incremented by one.  When a message is
> > >    retransmitted, the old *message_seq value is re-used*, i.e., not
> > >    incremented.  From the perspective of the DTLS record layer, the
> > >    retransmission is a new record.  This record will have a *new*
> > > *   DTLSPlaintext.sequence_number* value.
> > >
> > >
> > > In the section "7. ACK Message", the ACK message use the record_numbers
> > > (corresponds to *DTLSPlaintext.sequence_number*).
> > >
> > > For my understanding, the "message_seq" belongs to "Handshake" and the
> > > "sequence_number" or "record_numbers" belongs to
> > > record layer.
> > >
> >
> > Yes.
> >
> > The retransmission detection is done by "Handshake" using "message_seq",
> > > but the "acknowledge" is done by "record layer" using "record_numbers".
> > > It is so weird.
> > >
> >
> > Hmm... I don't think that this is particularly weird. This is, for
> > instance, how QUIC stream acknowledgement and retransmission works.
> >
> >
> > The retransmission, retransmission detection and acknowledge should be
> done
> > > in handshake process, but we need the record layer passing the
> > > record_numebrs to the handshake process.
> > >
> > > Since a new "sequence_number" is used for retransmission, we have to
> > > maintain a "record_numbers" to "message_seq" map with dynamic size.
> > > Each retransmission attempt creates a new relationship between a new
> > > "record_numbers" to an old "message_seq".
> > >
> >
> > Yes, that's how it works in NSS.
> >
> >
> > Since ACK is only used with Handshake messages, is it possible that we
> use
> > > "message_seq" in ACK messages?
> > >
> > Or we use *old* "sequence_number" for retransmission,
> > >
> >
> > Both of these give you strictly less information about the network. One
> of
> > the cool innovations in QUIC is to label each packet separately so you
> can
> > determine whether an ACK is an ACK of the original packet or a
> retransmit.
> > We are trying to inherit tha there
> >
> > -Ekr
> >
> > so we do not need maintain the dynamic map. And if replay detection is
> > > implemented, the retransmitted
> > > record can be dropped by record layer (by replay detection), the
> > > "Handshake Protocol" do not need to do retransmission detection.
> > >
> > > Thanks
> > > Zhai Zhaoxuan
> > > _______________________________________________
> > > TLS mailing list
> > > TLS@ietf.org
> > > https://www.ietf.org/mailman/listinfo/tls
> > >
>
> > _______________________________________________
> > TLS mailing list
> > TLS@ietf.org
> > https://www.ietf.org/mailman/listinfo/tls
>
>