Re: [openpgp] AEAD mode chunk size

"brian m. carlson" <sandals@crustytoothpaste.net> Sun, 01 July 2018 17:12 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 E4FC1130DED for <openpgp@ietfa.amsl.com>; Sun, 1 Jul 2018 10:12:45 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.001
X-Spam-Level:
X-Spam-Status: No, score=-2.001 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001] autolearn=unavailable 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 kGwrXTLA7v0J for <openpgp@ietfa.amsl.com>; Sun, 1 Jul 2018 10:12:44 -0700 (PDT)
Received: from injection.crustytoothpaste.net (injection.crustytoothpaste.net [192.241.140.119]) (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 8A2EC126CC7 for <openpgp@ietf.org>; Sun, 1 Jul 2018 10:12:44 -0700 (PDT)
Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:7872:b1da:4747:5087]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id DCA186073C; Sun, 1 Jul 2018 17:12:12 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1530465133; bh=YNl8h+QEXO/IZ8OCVH+Q+25mxtKEjxahqfoYsz4M9II=; h=Date:From:To:Cc:Subject:References:Content-Type: Content-Disposition:In-Reply-To:From:Reply-To:Subject:Date:To:CC: Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To:References: Content-Type:Content-Disposition; b=Mj0hSkkQKtVTy7AvsCviJE4hRM6bKICVJQX0LWmi5dXfx6YQZlNrj3jExRtp9XjGK bh7V+6DITXOi6qKzbpY9pUfWkqmNQulqjFHa6aJqiwPA5+ESbb5lG22c1Qc0IUSGN8 YAoZm+hMM0m5BNUe7UfGw38TMtBRRdJuFuB0VrrV4mXVsNhA7lS/u9Kxr5JQRDn9Bi xQD4pfLG2ykH8XOnGZsMPko5Duq+rq29xjRIHAR/kP2KGDVOxIhW//cPF8ucWpTlmp CevE6u+wAu9UXG+ExlcRltNCyt9YBdGBb4cAZ0xUN5emiS06lX38rxY3x44WYIs4Gj 7AAQgnXWZUsYypOqmESRP1IuZ/KgPHUSISxWMzdYFYRY2QELIJn7XmC35fTLRpTkdc BBMyqlxQrJ99H+xSNHxK8fRwOFLH0ec03YhOvIZhKe+KpsVmcFtqw9pa5iC1UHkLai F2uTvcgbgspSOCYUN1g8kbL8J1CfZgxzyzj6IFoemexAKfJDHkc
Date: Sun, 01 Jul 2018 17:12:08 +0000
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Marcus Brinkmann <marcus.brinkmann=40ruhr-uni-bochum.de@dmarc.ietf.org>
Cc: IETF OpenPGP <openpgp@ietf.org>
Message-ID: <20180701171208.GB7965@genre.crustytoothpaste.net>
References: <b82fee80-d265-5659-fad0-8cc47cce2703@ruhr-uni-bochum.de>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="hHWLQfXTYDoKhP50"
Content-Disposition: inline
In-Reply-To: <b82fee80-d265-5659-fad0-8cc47cce2703@ruhr-uni-bochum.de>
X-Machine: Running on genre using GNU/Linux on x86_64 (Linux kernel 4.16.0-2-amd64)
User-Agent: Mutt/1.10.0 (2018-05-17)
X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/3aXLDzV07UnJkdd1AtZ1Ui7dsfI>
Subject: Re: [openpgp] AEAD mode chunk size
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.26
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: Sun, 01 Jul 2018 17:12:46 -0000

On Sat, Jun 30, 2018 at 06:00:40PM +0200, Marcus Brinkmann wrote:
> Hi,
> 
> RFC4880bis contains this segment:
> 
>    The chunk size octet specifies the size of chunks using the following
>    formula (in C), where c is the chunk size octet:
> 
>        chunk_size = ((uint64_t)1 << (c + 6))
> 
>    An implementation MUST support chunk size octets with values from 0
>    to 56.  Chunk size octets with other values are reserved for future
>    extensions.
> 
> This allows chunk size up to 2^(6+56) = 4 EiB. It is impossible to
> implement AEAD correctly with chunk sizes larger than can be buffered in
> RAM. A large chunk size would require output of unverified plaintext,
> enabling attacks like EFAIL but also others.

I agree with this.  The original specification I submitted limited the
value to something smaller for this reason.

> To implement AEAD correctly, chunk size must be limited to reasonable
> sizes. TLS uses a chunk size up to 2^14 (16 KiB), but any reasonable
> limit will do, for example 64 KiB. I suggest to change the text to this:
> 
>    The chunk size octet specifies the size of chunks using the following
>    formula (in C), where c is the chunk size octet:
> 
>        chunk_size = ((uint64_t)1 << c)
> 
>    An implementation MUST support chunk size octets with values from 0
>    to 16.  Chunk size octets with other values are reserved for future
>    extensions.

The reason I specified a lower bound of 64 bytes per chunk is that it
doesn't make sense to have chunks that are, for example, 1 byte long.
That's a great way to be wasteful and potentially DoS a recipient, since
each AEAD chunk involves some block cipher overhead.

Of course, trailing chunks may be smaller, and that's okay; the document
anticipates that.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204