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

Benjamin Kaduk <bkaduk@akamai.com> Mon, 02 December 2019 07:54 UTC

Return-Path: <bkaduk@akamai.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 377A712021C for <tls@ietfa.amsl.com>; Sun, 1 Dec 2019 23:54:57 -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, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_LOW=-0.7, 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=akamai.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 dxDhfD0hwepE for <tls@ietfa.amsl.com>; Sun, 1 Dec 2019 23:54:55 -0800 (PST)
Received: from mx0b-00190b01.pphosted.com (mx0b-00190b01.pphosted.com [IPv6:2620:100:9005:57f::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2D990120154 for <tls@ietf.org>; Sun, 1 Dec 2019 23:54:54 -0800 (PST)
Received: from pps.filterd (m0050096.ppops.net [127.0.0.1]) by m0050096.ppops.net-00190b01. (8.16.0.42/8.16.0.42) with SMTP id xB27sqsw025049; Mon, 2 Dec 2019 07:54:52 GMT
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akamai.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=jan2016.eng; bh=KSZVdfYphfLAcn4ihHwS6EpZ+XmVPKleud2gmBeamFA=; b=VLwkH3nZ6PuBvVsBxwIOA1Wj3205rehvU2rIb3KNLFUBxz7qsh7luogswIr+5ClYh3UQ S5m31TJcAAXYDOLx3b1BTqqSoXFoPpePoHdZw5DCv2+UyFyuFMrSjCxb73wq02TefDv+ 6y/9kv+JXQq6/+BJtORVDIgExxGMPvFL3bZ91Mz9oxfIZphgSiEkrvyLo4fmMJ/NE8Ks EP6w7gzN7SV4uXm7aFvI+vlafWirbVgUsXdjZ+XYlFdzgXeanvBPWrniSIFU81DI2kDN dNdq5CakMetVI88oaggtfS2gh0ckx8oyDt6jaHC27yN8f3vRUUykH4hI2WATvkTTRKNM 8Q==
Received: from prod-mail-ppoint2 (prod-mail-ppoint2.akamai.com [184.51.33.19] (may be forged)) by m0050096.ppops.net-00190b01. with ESMTP id 2wkhqdhrqv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Dec 2019 07:54:52 +0000
Received: from pps.filterd (prod-mail-ppoint2.akamai.com [127.0.0.1]) by prod-mail-ppoint2.akamai.com (8.16.0.27/8.16.0.27) with SMTP id xB27l3CH008154; Mon, 2 Dec 2019 02:54:47 -0500
Received: from prod-mail-relay10.akamai.com ([172.27.118.251]) by prod-mail-ppoint2.akamai.com with ESMTP id 2wkmmxym6n-1; Mon, 02 Dec 2019 02:54:47 -0500
Received: from bos-lpczi.kendall.corp.akamai.com (bos-lpczi.kendall.corp.akamai.com [172.19.17.86]) by prod-mail-relay10.akamai.com (Postfix) with ESMTP id E300A1FC95; Mon, 2 Dec 2019 07:54:46 +0000 (GMT)
Received: from bkaduk by bos-lpczi.kendall.corp.akamai.com with local (Exim 4.86_2) (envelope-from <bkaduk@akamai.com>) id 1ibgXd-0004Tg-Hv; Sun, 01 Dec 2019 23:54:45 -0800
Date: Sun, 01 Dec 2019 23:54:45 -0800
From: Benjamin Kaduk <bkaduk@akamai.com>
To: Xuan k <kxuanobj@gmail.com>
Cc: Eric Rescorla <ekr@rtfm.com>, "<tls@ietf.org>" <tls@ietf.org>
Message-ID: <20191202075444.GI3397@akamai.com>
References: <CAAnY7J27g1Df0XBe1U66z98ThQgRaom1YBF9k2UGTi4YL9i+Ng@mail.gmail.com> <CABcZeBOuJ3bOKOt6vFRJzOZbwkXzZK0jUJNyAxeAmkpxQJCzzA@mail.gmail.com> <CAAnY7J0z_btrQYzGtZavQqJwrEJ6H-+tho7xqhy9Y6RM6atv+Q@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAAnY7J0z_btrQYzGtZavQqJwrEJ6H-+tho7xqhy9Y6RM6atv+Q@mail.gmail.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-12-01_04:, , signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912020070
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-01_04:2019-11-29,2019-12-01 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 priorityscore=1501 bulkscore=0 impostorscore=0 spamscore=0 suspectscore=0 clxscore=1011 mlxscore=0 lowpriorityscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912020071
Archived-At: <https://mailarchive.ietf.org/arch/msg/tls/lSdjUOj2HMphBfcjsD_aT8mCGzA>
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 07:54:57 -0000

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