[CFRG] Re: RGLC on draft-irtf-cfrg-aead-limits

"D. J. Bernstein" <djb@cr.yp.to> Thu, 06 March 2025 14:33 UTC

Return-Path: <djb-dsn2-1406711340.7506@cr.yp.to>
X-Original-To: cfrg@mail2.ietf.org
Delivered-To: cfrg@mail2.ietf.org
Received: from localhost (localhost [127.0.0.1]) by mail2.ietf.org (Postfix) with ESMTP id 00A26841FD9 for <cfrg@mail2.ietf.org>; Thu, 6 Mar 2025 06:33:04 -0800 (PST)
X-Virus-Scanned: amavisd-new at ietf.org
X-Spam-Flag: NO
X-Spam-Score: -3.959
X-Spam-Level:
X-Spam-Status: No, score=-3.959 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.238, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001] autolearn=ham autolearn_force=no
Received: from mail2.ietf.org ([166.84.6.31]) by localhost (mail2.ietf.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U_Z_Olkssdb4 for <cfrg@mail2.ietf.org>; Thu, 6 Mar 2025 06:33:02 -0800 (PST)
Received: from salsa.cs.uic.edu (salsa.cs.uic.edu [131.193.32.108]) by mail2.ietf.org (Postfix) with SMTP id 87C71841FD4 for <cfrg@irtf.org>; Thu, 6 Mar 2025 06:33:02 -0800 (PST)
Received: (qmail 15837 invoked by uid 1010); 6 Mar 2025 14:33:01 -0000
Received: from unknown (unknown) by unknown with QMTP; 6 Mar 2025 14:33:01 -0000
Received: (qmail 85843 invoked by uid 1000); 6 Mar 2025 14:32:47 -0000
Date: Thu, 06 Mar 2025 14:32:47 -0000
Message-ID: <20250306143247.85841.qmail@cr.yp.to>
From: "D. J. Bernstein" <djb@cr.yp.to>
To: cfrg@irtf.org
Mail-Followup-To: cfrg@irtf.org
In-Reply-To: <AS5PR07MB9675B4B72C3E7956A5DCA1D089CA2@AS5PR07MB9675.eurprd07.prod.outlook.com>
Message-ID-Hash: CNGSQW3ODAYJBSPSBBFWM5726L7IBIXG
X-Message-ID-Hash: CNGSQW3ODAYJBSPSBBFWM5726L7IBIXG
X-MailFrom: djb-dsn2-1406711340.7506@cr.yp.to
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-cfrg.irtf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
X-Mailman-Version: 3.3.9rc6
Precedence: list
Subject: [CFRG] Re: RGLC on draft-irtf-cfrg-aead-limits
List-Id: Crypto Forum Research Group <cfrg.irtf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/cfrg/sag5kdDFf73s6oUhMmJkzKz7T7M>
List-Archive: <https://mailarchive.ietf.org/arch/browse/cfrg>
List-Help: <mailto:cfrg-request@irtf.org?subject=help>
List-Owner: <mailto:cfrg-owner@irtf.org>
List-Post: <mailto:cfrg@irtf.org>
List-Subscribe: <mailto:cfrg-join@irtf.org>
List-Unsubscribe: <mailto:cfrg-leave@irtf.org>

John Mattsson writes:
> Attackers will go for most bang-for-the-buck and will do whatever
> gives most benefit for the least amount of cost. Single--key is a
> theoretical simplification. Rekeying based on single-key advantages
> turn the system into multi-key and may easily lower security instead
> of increasing security.

Yes, this last point is what makes single-key analyses dangerous. The
"tightness" section of https://eprint.iacr.org/2019/1336 surveys various
examples of attacks exploiting looseness, including multi-key looseness.

It's safe to compensate by requiring the single-key success probability
to be at most p/T, implying success probability at most p for a T-target
attack. Unfortunately, single-key analyses typically fail to include
this division by T. Section 5 of this document doesn't include this
division by T, so Table 2 is flawed.

Section 6 looks like it's fixing this, but is unnecessarily hard to use
because Table 3 isn't concrete. Obviously formulas are useful (and a
Python script would be even more useful), but they aren't a substitute
for presenting concrete numbers. When applications vary in parameters
such as B, there should be at least two illustrative tables with
concrete numbers for different choices of those parameters.

> For a PRP in counter mode an attacker cannot recover
> more than ≈ σ2 / 2b bits of the plaintext.

That depends on the plaintext structure used by the application.

For example, consider an attacker looking at a two-block ciphertext
(c,d), where the attacker knows that the plaintext was either (4,4) or
(4,5) and is trying to determine that one secret bit.

With a permutation P in counter mode, (4,4) is encrypted as (c,d) =
(4+P(0),4+P(1)) so d-c is P(1)-P(0), while (4,5) is encrypted as (c,d) =
(4+P(0),5+P(1)) so d-c is 1+P(1)-P(0).

The attacker knows that P(1)-P(0) is nonzero, so if the attacker sees
that d-c = 0 then the attacker knows that the plaintext is (4,5), and if
the attacker sees that d-c = 1 then the attacker knows that the
plaintext is (4,4).

Is this limiting the attacker to recovering only 1/2^b bits of plaintext
for a b-bit block size? No. With probability 1/2^b (the chance of
P(1)-P(0) being the right value), the ciphertext is telling the attacker
the _entire_ plaintext, reducing 1 secret bit to 0 secret bits.

The _average_ number of bits leaked here is 1/2^b, but this misses the
variation between the attacker being certain about the secret in some
cases while not learning anything about the secret in other cases.

Of course, 1/2^b is very small, but practical attacks against CTR (such
as https://sweet32.info demonstrating low-cost attacks for b = 64) use
more blocks to scale up, typically triggering applications to use
plaintext structures that give away secrets.

---D. J. Bernstein