Re: [openpgp] OpenPGP encryption block modes

"brian m. carlson" <sandals@crustytoothpaste.net> Fri, 12 August 2022 21:31 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 6F4A1C14CF1E for <openpgp@ietfa.amsl.com>; Fri, 12 Aug 2022 14:31:38 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.107
X-Spam-Level:
X-Spam-Status: No, score=-2.107 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_ZEN_BLOCKED_OPENDNS=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 ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id G26r4Ms75dpX for <openpgp@ietfa.amsl.com>; Fri, 12 Aug 2022 14:31:33 -0700 (PDT)
Received: from ring.crustytoothpaste.net (ring.crustytoothpaste.net [IPv6:2600:3c04::f03c:92ff:fe9e:c6d8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 11F0EC14CF17 for <openpgp@ietf.org>; Fri, 12 Aug 2022 14:31:32 -0700 (PDT)
Received: from tapette.crustytoothpaste.net (ipagstaticip-2d4b363b-56b8-9979-23b8-fd468af1db4c.sdsl.bell.ca [142.112.6.242]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by ring.crustytoothpaste.net (Postfix) with ESMTPSA id 9123F5A26C for <openpgp@ietf.org>; Fri, 12 Aug 2022 21:31:30 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1660339890; bh=JBvSStp2A5kQqGKG1PkqyAsyNPNxWnND7jid33VBQb8=; h=Date:From:To: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=lQ8JkjNm4Vffl1bI6TGYtrhyn7A+t62/ozkS65A51DqaMseBg4lijgg4maFXJHM1l QslASDsT8A4k6tkBJD6pXvBbOBqHE6LyHunH8XXyUPNODYHXCXzgsb4fRbYtku8428 OdyHLbJT4m4yRTh2lVuYI6ermtF7O1Fewx6FUM9dcmp3yv9bvPP+RJ9FXQFKTEiRq+ BuVAMlFGaqfF/1eRFWbRCqoDdiiPWfMFxnlkGj4mj7AiWhPJwDaewfT0lDiSv6me9H dyHktYcT9MQNSZUGhWtooC429fiizzc4ZRPDmw+uoQtdUa9DO5fKeQusSSGVFMEabZ btwae43cwgUEfSPeXaa4paO5RqMoOY0vH8ZxzYW5hNgWmLCiD9DwIwLhG4L++g0WGE wnv7VB6yedAvqD61dhMtWkDvgwLAFR2PRBYtUoSw8ad+RprgZkXOEwzqrNVgTK3+uy tI/3O1l4+RQC9mlX8YxCbz7cuAnDRnHJNefrUdcTZ68UO0gVwAs
Date: Fri, 12 Aug 2022 21:31:29 +0000
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: openpgp@ietf.org
Message-ID: <YvbGsQKpQVsprdp3@tapette.crustytoothpaste.net>
References: <YuKpxp0/Dy1DfC19@watt.59.ca> <875yjhjg2c.fsf@thinkbox> <87r124m64c.fsf@wheatstone.g10code.de> <YulX9jI1+wOCwLJq@ohm.59.ca> <Q6EUpbQm0e5f1OiU-77Old9p9FXyLCaFZ8pMm7PTt8VTLQJaXRQzWIDSwc3db6yI-56imyOaTNdt9TC8Zrm1jN_kPKxFYH4OqEu6o-Wfquo=@protonmail.com> <YuvlHdLz0Sfle7Ot@ohm.59.ca> <87a68ji1bv.fsf@wheatstone.g10code.de> <YvPGY8ArcKD7Hr1p@watt.59.ca> <YvQoC1g5rzKCfCVp@tapette.crustytoothpaste.net> <YvZ9txWreYSbzyBi@watt.59.ca>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="O6grE7cKqkGCcS8I"
Content-Disposition: inline
In-Reply-To: <YvZ9txWreYSbzyBi@watt.59.ca>
User-Agent: Mutt/2.2.6 (2022-06-05)
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/kj1qi5rWtQgKasy5eviPi9Arcss>
Subject: Re: [openpgp] OpenPGP encryption block modes
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.39
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: Fri, 12 Aug 2022 21:31:38 -0000

On 2022-08-12 at 16:20:07, Bruce Walzer wrote:
> On Wed, Aug 10, 2022 at 09:50:03PM +0000, brian m. carlson wrote:
> [...]
> > > That raises a question for me as I hold the position that OpenPGP does
> > > not need any more block cipher modes. I had the impression that
> > > SEIP-MDC (OCFB-MDC) would be relatively fast as the slow part is
> > > SHA1. SHA1 is one of the faster cryptographic hashes and is hardware
> > > accelerated on common platforms. I assumed that the slowness was
> > > because no one had ever bothered to optimize things. Is this true?
> > 
> > SHA-1 is no longer considered secure, and thus we can't assume that a
> > SHA-1 hash of the data intrinsically indicates that it hasn't been
> > changed.
> 
> I don't think this is correct as stated for normal OpenPGP usage. SHA1
> is only broken for collisions. The best an attacker can do is
> create two messages that when hashed with SHA1 will come out to the
> same value. So SHA1 does in fact prevent an entity other than the
> originator from making an undetected change. Fortunately this
> distinction is entirely irrelevant for SHA1 use in OCFB-MDC. The hash
> used only requires the property of irreversibility.

Yes, it's true that SHA-1 is only broken for collisions.  However, if
Mallory can send messages to Alice, who inspects them and then sends
them to Bob encrypted, then we still wouldn't want Mallory to be able to
modify the message after Alice had inspected it.  Perhaps Alice only
allows things looking like valid purchase orders to be sent, but Mallory
has a collision that turns the document into something else.

Now, with CFB and SHA-1, we don't presently think that Mallory can
modify both the message and the hash in this way, but CFB is vulnerable
to modification in predictable ways, and using SHA-1 for this leads us
to rely on the fact that Mallory cannot modify the CFB-encrypted
plaintext in a way that also converts the message into the other half of
a collision.

This is not a good assumption to make, and using SHA-1 in a modern
algorithm is to be avoided.  We absolutely do not want to make the
assumption that users will only be sending messages that are completely
trusted or which are not of a special form.  We also have to consider
the fact that in some organizations, SHA-1 cannot be used at all for
compliance or audit reasons and thus the entire approach is
unacceptable.

Peter mentioned SHA-1 with HMAC as well.  It's known that typically HMAC
relies on different assumptions than collision resistance.  However,
we've also tended to find that HMAC is vulnerable to distinguishing
attacks with MD4, MD5, SHA-0, and HAVAL, all of which have collisions.
Thus, a reasonable person might consider that HMAC-SHA-1 is not a great
idea, either.

It is much better when designing cryptosystems to use primitives that
are unambiguously secure, since attacks only get better.  OCFB-SHA-1 may
in fact end up being completely unbreakable, but it poses practical
problems and we have an opportunity to use options which are faster,
parallelizable, provably secure, and meet compliance and audit
requirements.  I also just don't want to design a system that uses
broken crypto, even if it happens to be secure, because explaining why
doing this is not presently a security problem again and again to
customers, security teams, and auditors is extremely tedious and boring
and I'd rather be doing more interesting things.

> I would be interested in a reference. It would be helpful here to know
> how well the workaround actually works in practice. Such a workaround
> is not required for OCFB-MDC as it is completely secure using regular
> SHA1.

The discussion of SHA-1-DC has happened earlier on the list, and I refer
you to the archives.  I believe Sequoia was the implementation thinking
about using SHA-1-DC, but I don't recall.  Typically an implementer
replaces their SHA-1 algorithm with SHA-1-DC, and they don't carry two
implementations, and thus, the performance matters.

As to the speed of SHA-1-DC, I can personally testify that it's limited
to about 50 MB/s, and that's information that a former colleague of mine
collected working on Git and which I've verified as a core Git
contributor.  The implementation is slower than every other well-known
hash algorithm except for MD2, which isn't a rousing endorsement.

> And that is the point we really should address here. We have a working
> and well standardized block cipher mode. It seems to make no sense to
> add three new block cipher modes for a total of five in the standard
> (OCFB still exists and is in current use). We have even had to create
> a preferences system just for the block cipher mode. Would any of
> this make any rational sense in any other context? Why does it make
> sense in this context?

I don't think having a preference here is a problem any more than having
a preference is a problem for cipher, hash, or compression algorithm.

I do think as people have mentioned there are approaches which offer
provable security behaviour, which OCFB-SHA-1 does not; which are 10 to
15 times faster and parallelizable, which OCFB-SHA-1 is not; meet
compliance needs for organizations working with the U.S. and Canadian
governments, which OCFB-SHA-1 does not; and don't get callouts from
cryptographers for bad design on Twitter, which OCFB-SHA-1 does.  The
performance alone is a compelling reason, and we have three other
reasons as well.

To summarize, I don't think there is consensus in the working group for
keeping OCFB-SHA-1 as the preferred encryption method and in fact there
is a great deal of consensus for replacing it with one (or possibly
more) AEADs.  I don't, therefore, think that continuing to defend it or
play devil's advocate is helpful or productive here, nor do I think it's
likely to change the product of the working group.  In the interests of
producing the crypto refresh RFC as expediently as possible, I think we
should stop giving serious consideration to proposals which are neither
in the charter nor have consensus in the working group.  As a result, I
will not be commenting further on your proposal.
-- 
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA