Re: [Cfrg] draft-irtf-cfrg-eddsa -- one final proposal for domain separation (context labels) for ed25519

Ilari Liusvaara <ilariliusvaara@welho.com> Thu, 21 April 2016 19:50 UTC

Return-Path: <ilariliusvaara@welho.com>
X-Original-To: cfrg@ietfa.amsl.com
Delivered-To: cfrg@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C0AC112DF6E; Thu, 21 Apr 2016 12:50:29 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.896
X-Spam-Level:
X-Spam-Status: No, score=-2.896 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RP_MATCHES_RCVD=-0.996] autolearn=ham autolearn_force=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 9wShNMEIBsyp; Thu, 21 Apr 2016 12:50:19 -0700 (PDT)
Received: from welho-filter3.welho.com (welho-filter3.welho.com [83.102.41.25]) by ietfa.amsl.com (Postfix) with ESMTP id 079AB12DB98; Thu, 21 Apr 2016 12:50:19 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by welho-filter3.welho.com (Postfix) with ESMTP id EA58431B2; Thu, 21 Apr 2016 22:50:17 +0300 (EEST)
X-Virus-Scanned: Debian amavisd-new at pp.htv.fi
Received: from welho-smtp2.welho.com ([IPv6:::ffff:83.102.41.85]) by localhost (welho-filter3.welho.com [::ffff:83.102.41.25]) (amavisd-new, port 10024) with ESMTP id A75kdi1HlfXt; Thu, 21 Apr 2016 22:50:17 +0300 (EEST)
Received: from LK-Perkele-V2 (87-100-143-35.bb.dnainternet.fi [87.100.143.35]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by welho-smtp2.welho.com (Postfix) with ESMTPSA id 9D85321C; Thu, 21 Apr 2016 22:50:17 +0300 (EEST)
Date: Thu, 21 Apr 2016 22:50:14 +0300
From: Ilari Liusvaara <ilariliusvaara@welho.com>
To: Benjamin Kaduk <kaduk@MIT.EDU>
Message-ID: <20160421195014.GA26169@LK-Perkele-V2.elisa-laajakaista.fi>
References: <87bn543id1.fsf@alice.fifthhorseman.net> <D33CFF00.6A70D%kenny.paterson@rhul.ac.uk> <11c960b5f1fa42aaaf4cd0a6961332ec@usma1ex-dag1mb1.msg.corp.akamai.com> <87ziso1m0l.fsf@alice.fifthhorseman.net> <20160420142953.GA23528@LK-Perkele-V2.elisa-laajakaista.fi> <87potk1de7.fsf@alice.fifthhorseman.net> <20160420182617.GA23652@LK-Perkele-V2.elisa-laajakaista.fi> <87bn540xh3.fsf@alice.fifthhorseman.net> <20160421043947.GA24394@LK-Perkele-V2.elisa-laajakaista.fi> <alpine.GSO.1.10.1604211349530.26829@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Disposition: inline
In-Reply-To: <alpine.GSO.1.10.1604211349530.26829@multics.mit.edu>
User-Agent: Mutt/1.5.24 (2015-08-30)
Sender: ilariliusvaara@welho.com
Archived-At: <http://mailarchive.ietf.org/arch/msg/cfrg/qP-bjWvoj30JLW8YneCSN3ZZ6OM>
Cc: Ondřej Surý <ondrej@sury.org>, "draft-irtf-cfrg-eddsa.all@ietf.org" <draft-irtf-cfrg-eddsa.all@ietf.org>, "Kaduk, Ben" <bkaduk@akamai.com>, "cfrg@ietf.org" <cfrg@ietf.org>
Subject: Re: [Cfrg] draft-irtf-cfrg-eddsa -- one final proposal for domain separation (context labels) for ed25519
X-BeenThere: cfrg@irtf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
List-Unsubscribe: <https://www.irtf.org/mailman/options/cfrg>, <mailto:cfrg-request@irtf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg/>
List-Post: <mailto:cfrg@irtf.org>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Subscribe: <https://www.irtf.org/mailman/listinfo/cfrg>, <mailto:cfrg-request@irtf.org?subject=subscribe>
X-List-Received-Date: Thu, 21 Apr 2016 19:50:29 -0000

On Thu, Apr 21, 2016 at 02:30:50PM -0400, Benjamin Kaduk wrote:
> On Thu, 21 Apr 2016, Ilari Liusvaara wrote:
> 
> > On Wed, Apr 20, 2016 at 05:41:28PM -0400, Daniel Kahn Gillmor wrote:
> >
> > H(x)=SHA-512(context||x) without any lengths or separators does not behave
> > that way. It does not have trivially computable collisions (but easily
> > computed ones might still exist, or worse, a way to extract the private key).
> >
> > That is, signature for ('abc','def') is not expected to validate for
> > ('abcd','ef').
> 
> I think I'm confused.  Surely if I set chunk = { 'a', 'b', 'c', 'd', 'e',
> 'f'} containing six octets, then SHA-512(chunk) is the same, whether I
> construct chunk from 'abc','def' or 'abcd','ef'.  So you must be talking
> about something else, but I'm not sure what.

I actually implemented the scheme (modifying the python reference
implementation in the draft (modifying H(x) to be SHA512(context|x)).

- Modified and base scheme generate identical signatures and validate
  identical signatures for empty context (as expected).
- Signature of ('abc','def') is different from signature of ('abcd','ef')
  and does not cross-validate. Nor does either cross-validate with
  ('',abcdef).

> > It is also not possible to compute the result using stock Ed25519 code
> > with any non-empty context.
> 
> Can you be more specific?  Is the complaint just that one would need to
> use a temporary buffer and copy the data to be signed in order to put in
> the prefix?

No. I am saying you can't put in the prefix unless you have Ed25519
implementation modified to support it. Buffering the message won't
help.

> > > With a context label, for every domain that defines a sane context
> > > (e.g. the guidance i suggested of printable-ascii followed by '\0'), we
> > > can rule out inter-domain replay as a successful forgery because no
> > > context will be a prefix of any other context.
> >
> > Also, contexts cause large amount of API problems. And it is very easy
> > to use in spec without understanding the problems, resulting spec that
> > is very annoying to implement.
> 
> >From where I am sitting, it seems like there are two options: does the
> signing API include a context input?  If yes, use that input; if no,
> prepend the context to the message to be signed in my own code.  What am I
> missing?

This does not work.


-Ilari