Re: [openpgp] AEAD Chunk Size

Bart Butler <bartbutler@protonmail.com> Wed, 27 February 2019 23:00 UTC

Return-Path: <bartbutler@protonmail.com>
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 CAC8A1311AF for <openpgp@ietfa.amsl.com>; Wed, 27 Feb 2019 15:00:25 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=protonmail.com
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 fOgWBoBP7yaY for <openpgp@ietfa.amsl.com>; Wed, 27 Feb 2019 15:00:22 -0800 (PST)
Received: from mail1.protonmail.ch (mail1.protonmail.ch [185.70.40.18]) (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 E81FF130EDA for <openpgp@ietf.org>; Wed, 27 Feb 2019 15:00:21 -0800 (PST)
Date: Wed, 27 Feb 2019 23:00:13 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=default; t=1551308419; bh=RSBgNFpHPgXQA/JhqoC8OfAr96q0h3zPkHTB4CUdY9g=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References: Feedback-ID:From; b=BXLZOY7a0ZfcW5isolROLM3hQdUI8gCAqMr/7BIHljN59rlqXiiGIVh/f/Zt8qHIk eaTbxokLgk1DNKM9JySGokWlPdkgDp4dGFs0Ju2ix6G1oHy8bvv0dA7QAhkBij04Us erkjfyV/om0tYivZyumhO6z7zXzC4zzw9joAlnS8=
To: Jon Callas <joncallas@icloud.com>
From: Bart Butler <bartbutler@protonmail.com>
Cc: Vincent Breitmoser <look@my.amazin.horse>, "openpgp@ietf.org" <openpgp@ietf.org>, "Neal H. Walfield" <neal@walfield.org>
Reply-To: Bart Butler <bartbutler@protonmail.com>
Message-ID: <HBifY5kv2OqoajWurbHh_-NyZaBUZGabUpbxfhLlw8lTEuJVAiaHr-hhL_v5jKI-uqfeTIKD2S8VbEKvImC2sxhSlxD3GsT8LBzXKaOeHLI=@protonmail.com>
In-Reply-To: <CAB941EE-6961-4CAB-9632-DFF738980467@icloud.com>
References: <87mumh33nc.wl-neal@walfield.org> <F9VLV9HZWH.3RYL3UM3BN873@my.amazin.horse> <3WZ7-hy9V7TOy53p1gP5EXELzHJIqjouV9x0YTN3PWsBZedKkqvVCRm-2XzGZy-FYAYdTqP1-7YV4wbTWMWAYhSujQA6NmrnIuXfZLRHkdQ=@protonmail.com> <CAB941EE-6961-4CAB-9632-DFF738980467@icloud.com>
Feedback-ID: XShtE-_o2KLy9dSshc6ANALRnvTQ9U24aqXW2ympbGschdpHbU6GYCTUCtfmGhY9HmOyP1Uweyandwh1AVDFrQ==:Ext:ProtonMail
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pgp-signature"; micalg=pgp-sha512; boundary="---------------------da08421dbe4b7742f26d29181b853236"; charset=UTF-8
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/3eRlxDtBZuwroDWSBu_wFD5TGeM>
Subject: Re: [openpgp] AEAD Chunk Size
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
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: Wed, 27 Feb 2019 23:00:26 -0000

Hi Jon,

Do I understand correctly that you oppose shrinking the allowable range with MUST at all too? I think the argument for this is fairly convincing from a usage perspective to ensure that someone decrypting a large message is not obligated to download a huge amount of data before finding out that it is corrupted or otherwise has been tampered with. Likewise, we had to address unanticipated performance issues in OpenPGP.js with very small chunks which could have allowed a bad actor to essentially DoS the library with a strangely-constructed message.

In other words, I'm not really swayed by the implementation simplification argument but I do think that very small or very large chunk size, in addition to *probably* being useless, pose a real threat in terms of abuse.

So I think having a MUST for the range, maybe 16kiB to 256 kiB, or 16 kiB to 1024 kiB is a reasonable thing to do. And as long as we keep the size byte, we can always increase the upper limit of the range in the future if needed.

Bart


‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On Wednesday, February 27, 2019 2:37 PM, Jon Callas <joncallas@icloud.com> wrote:

> 

> 

> > On Feb 27, 2019, at 1:34 PM, Bart Butler bartbutler=40protonmail.com@dmarc.ietf.org wrote:
> > Hi all,
> > We (Sunny Rajan and I) definitely agree with reducing the range of allowed sizes, because both 4 exabyte chunks and large messages composed of 64-byte chunks are clearly not optimal.
> > In our AEAD implementation for OpenPGP.js we settled on a default `c` of 12 rather than 8 after some performance benchmarking showed that 256 kiB chunks were more performant for the most common message sizes. Our result was specific to the web crypto API, and therefore specific to OpenPGP.js, but in general libraries may want to use different default sizes depending on implementation details like this.
> > So ideally we’d prefer to keep the size byte, but to shrink its range in both directions. For example, the RFC could state that the chunk SHOULD be 16 kiB (or 256 kiB, hint hint), but decryption MUST be available for `c` values between 8-12 inclusive. This would also allow us to be backwards-compatible with messages that have already been created following the current version of the draft, which do exist given the benefit that AEAD provides and that OpenPGP.js has supported the current draft in experimental mode for most of the last year.
> 

> I think this is a reasonable way to have it to put an upper limit with a SHOULD.
> 

> I believe that if we limit it to 16K, we will regret that, for performance or other reasons. And while some of the upper sizes are presently absurdly large, one never knows what happens a couple decades from now.
> 

> Moreover, forbidding it says that we state now that no one could ever have a reasonable use; my experience is that categorical statements like that are just asking the fates to bite us in an uncomfortable place. Amazon S3 increased their max object size to 5TB a few years ago. I’m not saying it should be that large, but I think this is a pretty convincing argument that 16K is too small.
> 

> So I think that a SHOULD is the right way to put it. I care less about what the SHOULD limit should be, but a small hard limit sounds like a bad idea.
> 

> Jon