Re: [openpgp] Pull request for AEAD encrypted data packet with GCM

"brian m. carlson" <sandals@crustytoothpaste.net> Tue, 14 February 2017 02:26 UTC

Return-Path: <sandals@crustytoothpaste.net>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9AC4912945E for <openpgp@ietfa.amsl.com>; Mon, 13 Feb 2017 18:26:55 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.002
X-Spam-Level:
X-Spam-Status: No, score=-2.002 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (3072-bit key) header.d=crustytoothpaste.net
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 xBXVtFflFzuh for <openpgp@ietfa.amsl.com>; Mon, 13 Feb 2017 18:26:54 -0800 (PST)
Received: from castro.crustytoothpaste.net (castro.crustytoothpaste.net [75.10.60.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 030D412945C for <openpgp@ietf.org>; Mon, 13 Feb 2017 18:26:54 -0800 (PST)
Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:254c:7dd1:74c7:cde0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by castro.crustytoothpaste.net (Postfix) with ESMTPSA id D4395280AD; Tue, 14 Feb 2017 02:26:51 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=crustytoothpaste.net; s=default; t=1487039211; bh=W+uKOon6yQ/MTukEv4RifzP2wssY0C0Spu6Un6IZN68=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F1MvH5v+s1gzFRZa9pG7/etoXD7lPXWk/2WqbTCs7kBNGDIoAXV7MWBeWgsZRYLqF R845d8whOxXq/Ty8znIHEoOcTsJ6PZGVjjb3q737rDHiJQyahO0LGdeIhjRVExpg5E iESpjgaukZH1Zcbkq17kAMRT6TMJk3b/FN6meuF2tYsa5Bf77AHN4Hm9BRyc+beeFu GOCdt9EXp0mVQQehjMrOd0HC6IlsH8OMFQ4D954fu7K8y9jvn8yLILw/4dhYM56Tv4 IuBv2cYUBTn/TR0rW9LVeQhLhmFddRvdzACT+lWzAzqky9BD/PAVG11QKHsT3pJ0cd sS5yX/3YjpXS1WmJbAsOEObkLgatYoQSi2CIpcXILPoRP8hVa2z3v5X2bSTUfLVKrm s935lcZn6aA8zvbboukkUNwynanefCYXNWwUTzLuB/i8TAz6YF705HD74GvclCng/I WxaA2RRhEWd94q9Vze7Q8XbUjKrR7317VMYiuGvul86m3lmzEaz
Date: Tue, 14 Feb 2017 02:26:45 +0000
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Jon Callas <joncallas@icloud.com>
Message-ID: <20170214022645.htrsigltdubrly37@genre.crustytoothpaste.net>
References: <20170213010658.xmzo7yfgki2hqw42@genre.crustytoothpaste.net> <CE43260E-D723-4B00-9E81-B5F81142121F@icloud.com> <20170214012816.w5tyv3jmwmjb6rtp@genre.crustytoothpaste.net> <2DD2082E-905A-44F3-AF7B-E6262C71593E@icloud.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="agazaxkeichqll3z"
Content-Disposition: inline
In-Reply-To: <2DD2082E-905A-44F3-AF7B-E6262C71593E@icloud.com>
X-Machine: Running on genre using GNU/Linux on x86_64 (Linux kernel 4.9.0-1-amd64)
User-Agent: NeoMutt/20170113 (1.7.2)
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/H4regRt2uM4XHMzIYb7QQfXWI9c>
Cc: openpgp@ietf.org
Subject: Re: [openpgp] Pull request for AEAD encrypted data packet with GCM
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.17
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 14 Feb 2017 02:26:55 -0000

On Mon, Feb 13, 2017 at 06:05:34PM -0800, Jon Callas wrote:
> 
> > On Feb 13, 2017, at 5:28 PM, brian m. carlson <sandals@crustytoothpaste.net> wrote:
> > 
> > That's why my proposal (which I will send a patch to the list for
> > shortly) proposed an octet for AEAD algorithm.  We can implement
> > ChaCha20 as a cipher and Poly1305 as an AEAD algorithm.  I support doing
> > this, but doing just ChaCha20-Poly1305 excludes a secure implementation
> > of all the block ciphers that we currently have.  We need something that
> > works with AES.
> 
> Forgive my being out of the loop on this and behind in document reading.
> 
> 4880 uses CFB implicitly with two flavors (regular and with MDC). Historically, OpenPGP leaves lots of parameterization around which is great for experimentation, but hell on test matrixes. One could parameterize a new packet in which there was a cipher parameter and an integrity parameter. Thus, one could have a the matrix [AES(key size), Twofish(key size), ...., whatever; CCM, SIV, HMAC, ...]. (The clever reader might note that HMAC leads to its own parameter.) Or one could have a parameter for a full thing like AES128-SIV, or AES256-HMAC-SHA512. I recommend the latter, myself. 
> 
> In that case, just pick decent parameters on ChaCha20+Poly1305 and be done. This is slightly important because this would be the first time OpenPGP used a stream cipher per se.

My patch implements exactly that: a cipher byte, and an AEAD algorithm
byte (it uses GCM, but it sounds like we want to change that).  I feel
like this provides us the flexibility we need without providing too many
options, especially since I get the impression we may want both block
and stream ciphers).

If we did CTR+HMAC, I'd propose CTR+HMAC-SHA512 and CTR+HMAC-SHA-3-512
as the AEAD algorithms (just hardcoding those as AEAD algorithm bytes).
If we did EAX or SIV, that would logically be the AEAD algorithm.  If we
additionally did ChaCha20, I'd define Poly1305 as the AEAD algorithm in
the TLS way.

I was not considering allowing further parameterization beyond that
point, as that's a great way to let people pick bad options.

We do need to preserve the existing cipher byte values for AES Key Wrap
in coordination with ECDH, though.

> Historic note: OpenPGP dates from a time when there were a lot of good arguments for a lot of options. Okay, there were better arguments than there are now. :) You know, should we use IDEA, CAST5, or Blowfish? Should we allow DSA to be used RIPEMD-160 because SHA-1 was created by the NSA and some people think it's backdoored. We also in those days wanted maximum consensus on getting 2440 done as fast as possible. That led to a lot of parameters and then contraction of those parameters later when people never implemented the algorithm they really wanted. I think this is an opportunity to collapse option explosion by just having AE suite parameters. This would allow some generosity in parameters without total option explosion.

I think we're in agreement.

> >> * CTR+HMAC. Like you, I mention it for completeness. But while I think that any of the above would be better, I think it is again better than GCM. It's not sexy but it works, and it's harder to screw up than many things.
> > 
> > That's why I like it.  Assuming you have a constant time AES
> > implementation, you can implement CTR and HMAC in constant time in
> > almost any language.  Those algorithms are also implemented in most
> > libraries.
> 
> This is also an argument in favor of CCM, SIV, and perhaps others.

I think the two-pass nature of CCM is undesirable, but I'd be fine with
EAX or SIV.  I feel confident I could implement those in a constant time
manner in a variety of languages given a constant-time AES-ECB and
AES-CTR.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204