Re: [Cfrg] ChaCha20 and Poly1305 for IPsec

Yoav Nir <ynir@checkpoint.com> Tue, 21 January 2014 20:58 UTC

Return-Path: <ynir@checkpoint.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D36E11A035F for <cfrg@ietfa.amsl.com>; Tue, 21 Jan 2014 12:58:59 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -9.436
X-Spam-Level:
X-Spam-Status: No, score=-9.436 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, GB_I_LETTER=-2, RCVD_IN_DNSWL_HI=-5, RP_MATCHES_RCVD=-0.535, 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 4UrNhKiXEjyJ for <cfrg@ietfa.amsl.com>; Tue, 21 Jan 2014 12:58:58 -0800 (PST)
Received: from smtp.checkpoint.com (smtp.checkpoint.com [194.29.34.68]) by ietfa.amsl.com (Postfix) with ESMTP id 0AEF81A0352 for <cfrg@irtf.org>; Tue, 21 Jan 2014 12:58:50 -0800 (PST)
Received: from IL-EX10.ad.checkpoint.com ([194.29.34.147]) by smtp.checkpoint.com (8.13.8/8.13.8) with ESMTP id s0LKwgM4015723; Tue, 21 Jan 2014 22:58:42 +0200
X-CheckPoint: {52DED97E-2-1B221DC2-1FFFF}
Received: from DAG-EX10.ad.checkpoint.com ([169.254.3.110]) by IL-EX10.ad.checkpoint.com ([169.254.2.228]) with mapi id 14.03.0123.003; Tue, 21 Jan 2014 22:58:42 +0200
From: Yoav Nir <ynir@checkpoint.com>
To: Adam Langley <agl@google.com>
Thread-Topic: [Cfrg] ChaCha20 and Poly1305 for IPsec
Thread-Index: AQHPCjHEk17DdD0mQkqxUhltboUzx5p33c2AgABIH4CAAApZgIAADBaAgAAKHoCAA5kvAIATe2+AgAAV8gCAADAqgA==
Date: Tue, 21 Jan 2014 20:58:41 +0000
Message-ID: <301290EC-B31A-4B83-9F29-D00469EC6CB8@checkpoint.com>
References: <180998C7-B6E5-489E-9C79-80D9CAC0DE68@checkpoint.com> <CAL9PXLy9hrq+i_neP96FbTJRvRLbLEXnMYdBdwSeHunFAwF+jQ@mail.gmail.com> <A867BB8E-4556-44B1-A0AF-16771626BF5C@checkpoint.com> <52CB358D.3050603@cisco.com> <A6BDE08D-1F7D-4813-A9C4-61AF8C14412B@checkpoint.com> <52CB482D.6090807@cisco.com> <09031D92-9A14-4CF0-A000-123E71D4F784@checkpoint.com> <3861F1D4-B412-42BE-AE6C-FF5DE213854C@checkpoint.com> <CAL9PXLzgo5a2dk0JM-kWvawPhO1arpurcYSuqcffTWGdrCGY7A@mail.gmail.com>
In-Reply-To: <CAL9PXLzgo5a2dk0JM-kWvawPhO1arpurcYSuqcffTWGdrCGY7A@mail.gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [172.31.20.162]
x-kse-antivirus-interceptor-info: protection disabled
Content-Type: text/plain; charset="us-ascii"
Content-ID: <19A7FDB400F96C43B7B00676DE84E9E9@ad.checkpoint.com>
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: David McGrew <mcgrew@cisco.com>, "cfrg@irtf.org" <cfrg@irtf.org>
Subject: Re: [Cfrg] ChaCha20 and Poly1305 for IPsec
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <http://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <http://www.irtf.org/mail-archive/web/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <http://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Jan 2014 20:59:00 -0000

On Jan 21, 2014, at 8:06 PM, Adam Langley <agl@google.com> wrote:

> On Tue, Jan 21, 2014 at 11:47 AM, Yoav Nir <ynir@checkpoint.com> wrote:
>> Reviews and comments would be greatly appreciated, as well as anyone checking my examples.
> 
> In the introduction: I think ChaCha20+Poly1305 are useful for software
> implementations, beyond their use as a backup to AES. AES in not
> suitable for pure, software implementations and they tend to be be
> slow and have side-channels. (AES-GCM even more so.)

I agree that a pure C-language implementation of AES is slower than either ChaCha20 or RC4, although it is still much faster than 3DES. Processor vendors have been adding hardware implementation of common tasks to so-called general purpose processors for years. So we got floating point in the late 80s, and "multi-media extension" 128-bit registers in the 90s, then vector processors, and now encryption functions. Is software that uses the AESENC opcode software or hardware? I think by now the line is blurred. For IPsec, AES has been the fastest algorithm even in pure C implementations.  I'll add something about being fast in software implementation to the next iteration.

> "The ChaCha20 block function"...
> 
> I asked DJB and he said that ChaCha is the name of the cipher and
> ChaCha20 is the specific variant with 20 rounds.

Yeah, that's how I used it.

> 
> "The 14th word is the least significant 32 bits of the input nonce
> (nonce | 0xffffffff)"
> 
> AND not OR, I think.

Oops. You're right, of course.

> You've changed the AEAD by switching the length values from uint64le
> to uint32be. Seems unnecessary.

I'll change it back. For some reason I thought AES-GCM for IPsec was like that, but looking again, I see that it isn't.

> 
> "for a particular key. counters"
> 
> nit: missing capital letter.

Will fix. Thanks.

> I'm not suitable to evaluate the higher-level integration into IPSec.
> 

I've posted this to ipsec as well. They said that we need a better normative reference for the functions. DJB's papers discuss security properties and link to source code, but don't have a good definition.

Yoav