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

Wan-Teh Chang <wtc@google.com> Wed, 05 August 2015 18:13 UTC

Return-Path: <wtc@google.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 A76261A8704 for <tls@ietfa.amsl.com>; Wed, 5 Aug 2015 11:13:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.389
X-Spam-Level:
X-Spam-Status: No, score=-1.389 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FM_FORGED_GMAIL=0.622, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=no
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 8Ea0EjqaCxBS for <tls@ietfa.amsl.com>; Wed, 5 Aug 2015 11:13:46 -0700 (PDT)
Received: from mail-wi0-x231.google.com (mail-wi0-x231.google.com [IPv6:2a00:1450:400c:c05::231]) (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 76A871A88DC for <tls@ietf.org>; Wed, 5 Aug 2015 11:13:46 -0700 (PDT)
Received: by wicgj17 with SMTP id gj17so203269962wic.1 for <tls@ietf.org>; Wed, 05 Aug 2015 11:13:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=UT7MMcEvQlAHzWGRG0oa8OS1mvogvRYFIFzqrMHf8U8=; b=e2X9YDCmCBcBfnIHslDZ5KEdwpGn98zdWxH+yiPpEKjgb/fo+domQCwPmdS+aFfX+A r/iV6Gzcxj58hnVwsZZIWbZ2gXXMvwQ5M7H4H11OEHvISgPoLtoXiZ7eWs2/OpFKp+Xy +jYClEBhShi5NTx5clfi9VSEwd/bwcSCgX4II2Hrmt4BIRJnByX5xFnDEJvbYI1kMNq+ KuACGTMMrx22LUksBWv7J2rD9eb7UgqCxyAeLwTd8VXnbkMSuO71dlnUu3extKBacB1u l8jn/guekW6gBuNBQd9RnxEKfpaXYOA/84tmF63cPiNMMrlTzBXFUiMlDObWcqVte9FH mTKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=UT7MMcEvQlAHzWGRG0oa8OS1mvogvRYFIFzqrMHf8U8=; b=PgLZX8Rzbd/mmFFp6OP+uu93MIU0X3UIAJn8tOspxAuaGBoCdpax36k+PGmM9NWv0X Cmv9XDhqyxZi1SOR3WAdnK4Sn1ll4d245NHlhC9KVChan/lJ2/YPBWd8XT0yTIjhs5iY xAssTMxGi0BQHvSUcg+GpsCKryeaHWzlMoUTN5qjTnZ2OkzSZA2dzq5FAYuCnXGdcvH8 OFnkOSVq1t+JxrS5rnmXXWf75ZM0YdsJsKEPi1Jsl1osuoDq7moOX2+tOByuvPQ3GhrY Cb2L/4bYk4jymdJlUv6vEVJLUQYoLErLFQkvJm0HVhHePvFq84npyAM2TEjPPPyF/T3K jRPA==
X-Gm-Message-State: ALoCoQmDQrjCxWGgaREf+TUCa3O4z4yZbnbrm/1cQTRpVaWGt7aN1ZLc5UhGagmrTc65H3Cl8mn9
MIME-Version: 1.0
X-Received: by 10.194.6.37 with SMTP id x5mr24497990wjx.73.1438798425139; Wed, 05 Aug 2015 11:13:45 -0700 (PDT)
Received: by 10.28.63.198 with HTTP; Wed, 5 Aug 2015 11:13:45 -0700 (PDT)
In-Reply-To: <CABkgnnUZFrHBqM7w24hNEzckaWaJKLKGnNiSh4zExBtmnerCZw@mail.gmail.com>
References: <1438691824.10777.9.camel@redhat.com> <CABkgnnVLahWvJ1ONUW7RLTuUVj1nrGVwgxBGsh2A58r1Gjf3aw@mail.gmail.com> <CALTJjxFpKCSbzBB=kFF7FUMvDyR0ZiNGgyvBz4EG3UpVotUAvg@mail.gmail.com> <CABkgnnUZFrHBqM7w24hNEzckaWaJKLKGnNiSh4zExBtmnerCZw@mail.gmail.com>
Date: Wed, 5 Aug 2015 11:13:45 -0700
Message-ID: <CALTJjxF5t5XsKSNULBwEftp=nt_RGRAMMspbO_1wS2Epyb2w4Q@mail.gmail.com>
From: Wan-Teh Chang <wtc@google.com>
To: Martin Thomson <martin.thomson@gmail.com>
Content-Type: text/plain; charset=UTF-8
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/2q8g3w8UF9uKzgOqZqJxrVZYNw4>
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: Wed, 05 Aug 2015 18:13:47 -0000

On Tue, Aug 4, 2015 at 10:35 AM, Martin Thomson
<martin.thomson@gmail.com> wrote:
> On 4 August 2015 at 10:24, Wan-Teh Chang <wtc@google.com> wrote:
>> The consistency you want to see seems to be
>> consistency with the AES GCM cipher suites, rather than with TLS 1.2.
>
> Yes, this is correct.
>
> RFC 5288:
>              struct {
>                 opaque salt[4];
>                 opaque nonce_explicit[8];
>              } GCMNonce;
>
> RFC 6655:
>                        struct {
>              opaque salt[4];
>              opaque nonce_explicit[8];
>                        } CCMNonce;
>
> Interestingly, RFC 6655 removes the explicit nonce for DTLS, but DTLS
> only (if I'm reading it correctly).

I don't see that special handling for DTLS in RFC 6655. The only
DTLS-specific statement in RFC 6655 is the clarification on how
to build a 64-bit seq_num:

   In DTLS, the 64-bit seq_num is the 16-bit epoch concatenated with the
   48-bit seq_num.

So I am afraid that you read it incorrectly.

It doesn't seem useful to be consistent with the AES GCM and CCM
cipher suites. In my experience implementing both ChaCha20+Poly1305
and AES GCM cipher suites in TLS 1.2, the lengths of the explicit
nonce can be easily parameterized.

I am now inclined to support adopting the draft-TLS 1.3 nonce
mechanism for TLS 1.2. Specifically, this means in TLS 1.2,
ChaCha20+Poly1305 has these parameters:

SecurityParameters.record_iv_length = 0  // zero-length explicit nonce.
                                         // No change from
                                         // draft-ietf-tls-chacha20-poly1305-00.

SecurityParameters.fixed_iv_length = 12  // increased from the value 4 used in
                                         // draft-ietf-tls-chacha20-poly1305-00.

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.

Wan-Teh