Re: [Cfrg] New Version Notification for draft-nir-cfrg-chacha20-poly1305-05.txt

Yoav Nir <ynir.ietf@gmail.com> Mon, 30 June 2014 14:49 UTC

Return-Path: <ynir.ietf@gmail.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 1199A1A036E for <cfrg@ietfa.amsl.com>; Mon, 30 Jun 2014 07:49:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: 0
X-Spam-Level:
X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[BAYES_05=-0.5, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, J_CHICKENPOX_66=0.6, SPF_PASS=-0.001] 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 80NJw2lSpKLW for <cfrg@ietfa.amsl.com>; Mon, 30 Jun 2014 07:49:07 -0700 (PDT)
Received: from mail-we0-x234.google.com (mail-we0-x234.google.com [IPv6:2a00:1450:400c:c03::234]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2B26D1A036A for <cfrg@irtf.org>; Mon, 30 Jun 2014 07:49:07 -0700 (PDT)
Received: by mail-we0-f180.google.com with SMTP id x48so8239861wes.25 for <cfrg@irtf.org>; Mon, 30 Jun 2014 07:49:05 -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=2I1Tg1ZFX/Qw+C7/jFNvxx4SSe5CbYvsAdk0f4upcdk=; b=sKQNrfZLjx2ZPRtMpXoCuOLYAd9ncVIzhLkxdIQA6XSKSMmqyQKuBKO9DxwK/zp3C9 HGe6MMhPccelAvAxWJ6ZFT6ZVrD3TqCsVGpsbeV4SWtUqXOx/gQxXIXLUpukS9fNaKLo j8q+A0+dcYSU0WobvfrrK03geT5QEETIKS6TMQkzOiHGZLkbZ6rTU2bexEmGu51vjCOX mYT+Kgh8OQMTHwwUmzGz/RIRH68GUOpPem+DchHY3iZu6FeCL3Le5zCI/xsav17Y9GrL PCbW8/RnvgMnxI39ry9Z3wzww5PF5M6/+PTpFcLqqkd5JK+XBKNlVRSObs1iS2p5Ecqs tfHQ==
X-Received: by 10.194.92.115 with SMTP id cl19mr45481798wjb.29.1404139745799; Mon, 30 Jun 2014 07:49:05 -0700 (PDT)
Received: from [172.24.251.205] (dyn32-131.checkpoint.com. [194.29.32.131]) by mx.google.com with ESMTPSA id rw4sm41760423wjb.44.2014.06.30.07.49.04 for <multiple recipients> (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Jun 2014 07:49:05 -0700 (PDT)
Content-Type: text/plain; charset="windows-1252"
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\))
From: Yoav Nir <ynir.ietf@gmail.com>
In-Reply-To: <20140630105340.GA9473@LK-Perkele-VII>
Date: Mon, 30 Jun 2014 17:49:02 +0300
Content-Transfer-Encoding: quoted-printable
Message-Id: <59E62D41-ACAD-4B3D-8BA9-12E2B1A25E61@gmail.com>
References: <20140619125212.18717.66370.idtracker@ietfa.amsl.com> <65FDFAB8-F3EE-448B-A9B5-882DFC0A9A96@gmail.com> <20140630105340.GA9473@LK-Perkele-VII>
To: Ilari Liusvaara <ilari.liusvaara@elisanet.fi>
X-Mailer: Apple Mail (2.1878.2)
Archived-At: http://mailarchive.ietf.org/arch/msg/cfrg/X48abgiyRunsn8KV1s1sJfjjHS4
Cc: cfrg@irtf.org
Subject: Re: [Cfrg] New Version Notification for draft-nir-cfrg-chacha20-poly1305-05.txt
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: Mon, 30 Jun 2014 14:49:09 -0000

On Jun 30, 2014, at 1:53 PM, Ilari Liusvaara <ilari.liusvaara@elisanet.fi> wrote:

> On Thu, Jun 19, 2014 at 03:58:43PM +0300, Yoav Nir wrote:
>> Hi
>> 
>> This is version -05 of the document.  
>> 
>> Changes include:
>>  - Added some crypto papers as references for ChaCha (still looking for some for Poly1305)
>>  - Fixed some typos
>>  - Removed the TBD remarks about big vs little endianness, and lengths expressed in bits vs octets. Nobody seemed too interested in debating the  little+octets choices.
>> 
>> As before, we need reviews, especially for the Poly1305 key generations in section 2.6 ( http://tools.ietf.org/html/draft-nir-cfrg-chacha20-poly1305-05#section-2.6 )
> 
> Editorial:
> 
> Section 2.8.1: The Ciphertext dump is seemingly missing 0x7f byte in
> the ASCII version.
> 
> Section A.1 Test vector #4: Another ASCII 0x7f seems to be missing.
> 
> Section A.2 Test vector #3: Same as above, twice.
> 
> (for some odd reason, there are 0x7f bytes in other places, but those
> properly appear as '.' in the ASCII dump (0x7f is not printable)).
> 

Gah!  I actually fixed my hex dump code, but didn’t run some of the buffers again.  Will fix.

> 
> Other stuff:
> 
> I actually wrote an implementation (I haven't optimized it so it is
> slow).
> 
> 
> The Poly1305 test vectors: All the nontrivial ones test non-mod16
> lengths, which are not needed by the AEAD construction. Thus, if
> using dedicated poly1305 routines, the cases needed for test
> vectors may not be supported.
> 
> For this reason, whereas I run nearly every other test vector as
> self-test in my code, I haven't coded the Poly1305 tests.

I wrote those test vectors before version -04, when Poly1305 was not 16-byte aligned. Poly1305 might still find a use in a NULL_with_Poly1305 ciphersuite or in IPsec AH, so I’ll leave those test vectors in there.

And I will add yours as well in the next iteration.

Thanks!

> Also, I devised few edge cases that could happen in Poly1305 calculation,
> and devised test cases to provoke those. Some of those (#3 and #7) caught
> actual bugs where the two full AEAD test vectors didn't find one.
> 
> 
> 1) If one uses 130-bit partial reduction, does the code handle the
> case where partially reduced final result is not fully reduced?
> 
> R:
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data: 
> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> tag:
> 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> 
> 2) What happens if addition of s overflows modulo 2^128?
> 
> R:
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> S:
> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> data:
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> tag:
> 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> 
> 3) What happens if data limb is all ones and there is carry from lower
> limb?
> 
> R:
> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data:
> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> F0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> 11 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> tag:
> 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> 
> 4) What happens if final result from polynomial part is exactly 2^130-5?
> 
> R:
> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data:
> FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> FB FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE
> 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
> tag:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> 
> 5) What happens if final result from polynomial part is exactly 2^130-6?
> 
> R:
> 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data:
> FD FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> tag:
> FA FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
> 
> 
> 6) What happens if 5*H+L-type reduction producess 131-bit intermediate
> result?
> 
> R:
> 01 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data:
> E3 35 94 D7 50 5E 43 B9 00 00 00 00 00 00 00 00
> 33 94 D7 50 5E 43 79 CD 01 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> tag:
> 14 00 00 00 00 00 00 00 55 00 00 00 00 00 00 00
> 
> 
> 7) What happens if 5*H+L-type reduction produces 131-bit final result?
> 
> R:
> 01 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00
> S:
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> data:
> E3 35 94 D7 50 5E 43 B9 00 00 00 00 00 00 00 00
> 33 94 D7 50 5E 43 79 CD 01 00 00 00 00 00 00 00 
> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> tag:
> 13 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
> 
> 
> 
> -Ilari