Re: [TLS] open issues for draft-ietf-tls-chacha20-poly1305-00

Martin Thomson <martin.thomson@gmail.com> Thu, 06 August 2015 18:02 UTC

Return-Path: <martin.thomson@gmail.com>
X-Original-To: tls@ietfa.amsl.com
Delivered-To: tls@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 19D571B3CC8 for <tls@ietfa.amsl.com>; Thu, 6 Aug 2015 11:02:25 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 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, SPF_PASS=-0.001] autolearn=ham
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 lzdETbN7UKVz for <tls@ietfa.amsl.com>; Thu, 6 Aug 2015 11:02:23 -0700 (PDT)
Received: from mail-la0-x229.google.com (mail-la0-x229.google.com [IPv6:2a00:1450:4010:c03::229]) (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 5B7BB1B3CC4 for <tls@ietf.org>; Thu, 6 Aug 2015 11:02:23 -0700 (PDT)
Received: by labow3 with SMTP id ow3so54191543lab.1 for <tls@ietf.org>; Thu, 06 Aug 2015 11:02:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=nBapgLErZuUvNjRdr1PQ+m5IDqt4uxEZFMEPNtzt6xw=; b=vABfERquhQRpA/on1QbfyGqRUI/dHQ+YSFut4GKJorU4jK5KhUme19/7wLkhRTHxb0 6/X6UhVrKyJYbZOzJNpCddoAmwSBKYjVykGWQX/fYXf+6NXQlVYiNS+gitmAYZVF63mu KnrmM6pDCXpOaVglB5Wg8qFnm/zNlLAztxV8BUURy67qVVceQGczlfTDvCbvRxgAnUe/ K7dgSrqoIm8/nF1GDayU4Oz66PQR4tkmOL7/CmRD/yAzr5W6CQvnslts0KDHf5ft0D/M 1qWHcuZGea8EDlPoWW/os5LCal4Hc0V7qw0fNaq/LmQ8JWzBzpIHzu+xB9n34MU5T4xX SC0A==
MIME-Version: 1.0
X-Received: by 10.112.55.105 with SMTP id r9mr3652832lbp.89.1438884141808; Thu, 06 Aug 2015 11:02:21 -0700 (PDT)
Received: by 10.25.197.87 with HTTP; Thu, 6 Aug 2015 11:02:21 -0700 (PDT)
In-Reply-To: <CALTJjxF5t5XsKSNULBwEftp=nt_RGRAMMspbO_1wS2Epyb2w4Q@mail.gmail.com>
References: <1438691824.10777.9.camel@redhat.com> <CABkgnnVLahWvJ1ONUW7RLTuUVj1nrGVwgxBGsh2A58r1Gjf3aw@mail.gmail.com> <CALTJjxFpKCSbzBB=kFF7FUMvDyR0ZiNGgyvBz4EG3UpVotUAvg@mail.gmail.com> <CABkgnnUZFrHBqM7w24hNEzckaWaJKLKGnNiSh4zExBtmnerCZw@mail.gmail.com> <CALTJjxF5t5XsKSNULBwEftp=nt_RGRAMMspbO_1wS2Epyb2w4Q@mail.gmail.com>
Date: Thu, 6 Aug 2015 11:02:21 -0700
Message-ID: <CABkgnnUxQAj_vCue2TZLYyj4WDy4FsYiL6NmDDL8-sMPvuxbtw@mail.gmail.com>
From: Martin Thomson <martin.thomson@gmail.com>
To: Wan-Teh Chang <wtc@google.com>
Content-Type: text/plain; charset=UTF-8
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/YYf1qV8rau0Jkm0Gc2X7bs62dQw>
Cc: "tls@ietf.org" <tls@ietf.org>
Subject: Re: [TLS] open issues for draft-ietf-tls-chacha20-poly1305-00
X-BeenThere: tls@ietf.org
X-Mailman-Version: 2.1.15
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: Thu, 06 Aug 2015 18:02:25 -0000

On 5 August 2015 at 11:13, Wan-Teh Chang <wtc@google.com> wrote:
> Then, define the ChaChaNonce struct as described in the draft-TLS 1.3.
>
>        struct {
>            opaque nonce[12];
>        } ChaChaNonce;
>
>       1. The 64-bit record sequence number is padded to the left with
>          zeroes to 96 bits (12 octets).
>       2. The padded sequence number is XORed with either the
>          client_write_IV (when the client is sending) or the
>          server_write_IV (when the server is sending)
>       3. Store the XOR result in ChaChaNonce.nonce.


This looks fine.  Note that the general construction in TLS 1.3 should
be, more formally:

assert(N_MAX > 64bits)
nonce = {client|server|_{read|write}_IV[0..N_MAX] XOR lpad0(seq_num)

Of course, ChaChaX sets N_MAX to 96 bits, so what you described was correct.

--Martin