Re: [TLS] Consensus for AEAD IV

Yoav Nir <ynir.ietf@gmail.com> Mon, 27 April 2015 07:51 UTC

Return-Path: <ynir.ietf@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 694181B2EC9 for <tls@ietfa.amsl.com>; Mon, 27 Apr 2015 00:51:20 -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 moNDKxB-Tmin for <tls@ietfa.amsl.com>; Mon, 27 Apr 2015 00:51:18 -0700 (PDT)
Received: from mail-wi0-x22e.google.com (mail-wi0-x22e.google.com [IPv6:2a00:1450:400c:c05::22e]) (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 3BB271B2A48 for <tls@ietf.org>; Mon, 27 Apr 2015 00:51:18 -0700 (PDT)
Received: by wizk4 with SMTP id k4so88732051wiz.1 for <tls@ietf.org>; Mon, 27 Apr 2015 00:51:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=z2kKD2n2R0JE2y/Bs0q3WUy7VfDt7kKGaXDYJl1QW14=; b=xbhEPqo6Q0xSS8VPTx6V9WlKt0g1HOzGA10KbxJaM5SzcXvNaIqek5Zw2hhoewjORY e4+O+hK755vUmMvft++9fkDBBQ6HLX1sIXHRmMTDqQoigiGC8hJKuhQIrXG+uPDDdfoF bU98jURwqBRHW48Uk8lOkCINOZyBC+tAr1QnKLXz6Qraxozo0+698VziS2RRX1GqQQRi JMNQrsXM0YhjK/gG9IZXPGpovNOud+JGb9F5QRbKhQf2ElJzMRNHPWEi50G/N2hQ5V6O JVPSnxiH5BHJ6dcVzbD2ysl6LWYhmQyzzk/eMAtmoNP88tLztQJxGL3UueYmS/3qrVzG /v+A==
X-Received: by 10.195.17.196 with SMTP id gg4mr858524wjd.109.1430121076995; Mon, 27 Apr 2015 00:51:16 -0700 (PDT)
Received: from [172.24.248.247] (dyn32-131.checkpoint.com. [194.29.32.131]) by mx.google.com with ESMTPSA id z12sm28199755wjw.39.2015.04.27.00.51.15 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 27 Apr 2015 00:51:16 -0700 (PDT)
Content-Type: text/plain; charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\))
From: Yoav Nir <ynir.ietf@gmail.com>
In-Reply-To: <553D7397.9090000@nthpermutation.com>
Date: Mon, 27 Apr 2015 10:51:12 +0300
Content-Transfer-Encoding: quoted-printable
Message-Id: <25BAE048-8AF0-4F36-88FD-CFB4D577265E@gmail.com>
References: <CAOgPGoC14uhjrZAQvDHFQrJoyoVNELpNNd4+Hh==zwf9ipyY5g@mail.gmail.com> <CABkgnnU50pvH+LFsN3BL9LfvYhZOxmJV1JYzODeC=-JpZSh8Lw@mail.gmail.com> <CAOgPGoDNuhmnNpZ7ELCfBHS4rKuj+3j1+YiuxLkST+z1J+tOKQ@mail.gmail.com> <553C59B2.6050000@nthpermutation.com> <7E7D3069-2021-4691-AEA6-70DD1AB4476C@gmail.com> <553D27D0.7040209@nthpermutation.com> <20150426182025.GA3549@LK-Perkele-VII> <553D5898.3090902@nthpermutation.com> <3E5464E9-80BF-4D2E-A6C1-EF4E47A99268@gmail.com> <553D7397.9090000@nthpermutation.com>
To: Michael StJohns <msj@nthpermutation.com>
X-Mailer: Apple Mail (2.2098)
Archived-At: <http://mailarchive.ietf.org/arch/msg/tls/kGDmv9S4rGYC_O-3LbgnOa8E3lU>
Cc: tls@ietf.org
Subject: Re: [TLS] Consensus for AEAD IV
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: <http://www.ietf.org/mail-archive/web/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, 27 Apr 2015 07:51:20 -0000

> On Apr 27, 2015, at 2:24 AM, Michael StJohns <msj@nthpermutation.com> wrote:
> 
> On 4/26/2015 6:26 PM, Yoav Nir wrote:
>> Both CCM and GCM use a concatenation of the explicit IV (which is obviously not secret and allowed to be predictable) with a salt that is derived from the keying material. This concatenation forms the nonce which is input to the AEAD.
> 
> Which protocol are we talking about?

I thought it was clear from context that we were talking about how IPsec does it.

> CCM and GCM - as generic functions - use a per message Nonce.  CCM defines a block formatting function (Appendix A of the Nist Document)  that takes a nonce of 1-15 octets.  David Mc Grew's RFC on AEAD functions APIs fixes the length of that nonce to 12 bytes because that's the most common length for GCM.  That per message nonce (back to the generic again) can be created from the combination of a per-session nonce and a sequence number, randomly generated or derived from key material.
> 
> HSMs generally implement the generic interfaces described in the base CCM and GCM documents, and David Mc Grew's RFC on AEAD is a subset of those possibilities and is therefor usable with the generic interfaces.
> 
> 
>> 
>> RFC 4309 (CCM) says "The salt value need not be secret, but it MUST NOT be predictable prior to the beginning of the security association.”
>> RFC 4106 (GCM) says "The salt SHOULD be unpredictable (i.e., chosen at random) before it is selected, but need not be secret.”
> 
> In IPSEC GCM, the IV is explicitly included in each packet  (see section 3.1 of RFC4106) and hence is not secret in any way shape or form.
> 
> In IPSEC CCM, the IV is also explicitly included in each packet - see section 3 and 3.1 of RFC 4309.  Hence, also never secret in any way shape or form.

The IV is explicit. The nonce is not. In both cases the 96-bit nonce is composed of 32 implicit salt bits and 64 explicit IV bits.

>> The ChaCha20-Poly1305 for IPsec draft does the same thing, and in fact so does RFC 5288 (AES-GCM for TLS 1.2)
> 
> Citing your own draft as proof of your own argument is a bit.... well…

That WG draft is in WGLC now, so it it’s doing something that is wrong, now would be a good time to say why. It’s also doing the exact same thing that IPsec has been doing with AEADs since 4106 and TLS since 5288. All of these combined a 64-bit explicit IV with a 32-bit salt that is derived as part of the keying materials (KEYMAT for IPsec, key_block for TLS) and never ever transmitted.

> In any event, I note that your IPSEC draft doesn't actually describe the ESP payload format, so without that, I'd make the assumption that the IV is included before the payload as is described in the IPSEC ESP document.
> 
>> 
>> So no, that salt (and by extension, the proposed 96-bit value) need not be secret, but it’s never transmitted.
> In which of the above?  Maybe in the chacha20 draft... but not in the other two.
> 
> And RFC5288 does it the wrong way - getting IV (session nonce) material from the same key stream as key material.  That hopefully will be fixed with TLS1.3.  It would have been much more preferable to use a zero session nonce than extract it from the key stream.

You are saying that this is wrong. Why?

>>  This also shows that there is good precedent for generating such a doesn’t-really-need-to-be-secret value from the key_block or KEYMAT.
> 
> I'm pretty sure it doesn't.  It just shows a continuous misunderstanding of the problems with doing it this way.  

And those problems are…?

> There are ways to mitigate this a bit - but they require ensuring complete cryptographic isolation from key generation and a method of non-secret but not disclosed information that can still be used with the generic interfaces.
> 
> There was a good precedence for using RC4 and MD5 because they were fast and in wide use, but we've learned.
> 
> Later, Mike