[openpgp] Re: WG: BSI view on KEM combiners

Phillip Hallam-Baker <phill@hallambaker.com> Sat, 14 September 2024 20:23 UTC

Return-Path: <hallam@gmail.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 244F6C151551 for <openpgp@ietfa.amsl.com>; Sat, 14 Sep 2024 13:23:08 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.65
X-Spam-Level:
X-Spam-Status: No, score=-1.65 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, LOTS_OF_MONEY=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=no autolearn_force=no
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 8Be5cQutst8r for <openpgp@ietfa.amsl.com>; Sat, 14 Sep 2024 13:23:04 -0700 (PDT)
Received: from mail-oo1-f54.google.com (mail-oo1-f54.google.com [209.85.161.54]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2DD45C151080 for <openpgp@ietf.org>; Sat, 14 Sep 2024 13:23:04 -0700 (PDT)
Received: by mail-oo1-f54.google.com with SMTP id 006d021491bc7-5dfad5a9c21so1686614eaf.0 for <openpgp@ietf.org>; Sat, 14 Sep 2024 13:23:04 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726345383; x=1726950183; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Udu6nH+D7E79fRuAO/4pYfSuxRNa+oMOnTZ3mxXVsrA=; b=q3qhmb3FOrILblKuZJR2QPE8lPNqZnL2hw4DX/DC9Pc7YZ7BJBBQAx4zE1c/y/N8Eh KUI9WM61CT3fN7Fa2f93kMyal+Pg6j/QrTSC3zhpZltimcU3QLspiZKPxyak4jV1hLa+ Bup+q9VaJL9G6zbgryxzq8vOXjMb0MmhvanNXStY+lIrY2GIyuxP7c25gT5zqTRrm3NM TnmZrUc8RQrPQPgUSgV/bgukFBba7/Rxp+Vw+8nXum4ERED3/G0r1kwp+4Buj1pqW3tg hrR38JFhws8kRA9FQ6hgsTjSqVS5HBeA8MyUR0hJJmIekrRzMbelBxtInzbqRN84lkoZ ghZg==
X-Gm-Message-State: AOJu0YxQAUTROXT5zEdXayQ71yN9p/WOZymTLPcS5/EwYUVeLJGgSrxC b81tK/nEXb0IeHDbc5hPw44SxiuKgdtmD+vFBm6y1zsCKfP5O4WgnlN196Dkl5o5cwGrjfLeqta ue6ejPyDuO2iDup+Kv++sRoiOc0grsdvoS6M=
X-Google-Smtp-Source: AGHT+IFQwpWV6QYXmnJvbmSzr+1HgZyZPe6qOjHCCHx+po4ZDHeaMsTvpJDCkFoCZb2OruGjAO3pa0NOsxpRCXtrKLc=
X-Received: by 2002:a05:6870:8190:b0:278:157:25bb with SMTP id 586e51a60fabf-27c3f41b154mr9067949fac.26.1726345383235; Sat, 14 Sep 2024 13:23:03 -0700 (PDT)
MIME-Version: 1.0
References: <CAMm+Lwj1+O1whL1Xf_ZypD9t8rQ5TAmG9Z4O9V3VWFk=dN7VGA@mail.gmail.com> <20240914182154.7219.qmail@cr.yp.to>
In-Reply-To: <20240914182154.7219.qmail@cr.yp.to>
From: Phillip Hallam-Baker <phill@hallambaker.com>
Date: Sat, 14 Sep 2024 16:22:52 -0400
Message-ID: <CAMm+LwiPLH0qrqDhXRrRMYFfUdDec_8YHdbjKcqGSFt4zg-=Mw@mail.gmail.com>
To: "D. J. Bernstein" <djb@cr.yp.to>
Content-Type: multipart/alternative; boundary="00000000000053d95906221a1b36"
Message-ID-Hash: 7YKHI3LMIHHW5G5FZK35EI3GVVFZLXCI
X-Message-ID-Hash: 7YKHI3LMIHHW5G5FZK35EI3GVVFZLXCI
X-MailFrom: hallam@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-openpgp.ietf.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: openpgp@ietf.org
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [openpgp] Re: WG: BSI view on KEM combiners
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/ApOwXWfyrEyk7mGm63UrSPhQnsA>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Owner: <mailto:openpgp-owner@ietf.org>
List-Post: <mailto:openpgp@ietf.org>
List-Subscribe: <mailto:openpgp-join@ietf.org>
List-Unsubscribe: <mailto:openpgp-leave@ietf.org>

On Sat, Sep 14, 2024 at 2:22 PM D. J. Bernstein <djb@cr.yp.to> wrote:

> Phillip Hallam-Baker writes:
> > What is it about combining KEM and ECC outputs that is supposed to be so
> > difficult that HKDF does not already address it?
>
> Sure, 99% of the real-world problem that combiners are supposed to
> address is solved by simply upgrading from "ECDH session key" to "hash
> of ECDH session key and KEM session key", with any of the usual hash
> functions. (Similarly, checking an ECC signature and a PQ signature
> deals with 99% of the problem for signatures.)
>

Ah, now that makes sense, thanks.

An issue folk might want to consider is that hybrid systems might not be
doing 1:1 ML-KEM/PQ encryptions. If I am running a CRM system, I don't get
much leverage from a KEM that doesn't support threshold because I have no
separation of roles. So my configuration is going to be primarily ECC based
with the ML-KEM scheme being limited to backup in the unlikely event
someone builds a CRQC*.


[*] yes, I am aware that $100m just went into startups promising to build a
trapped ion machine. The folk putting the money up are the same folk
managed to make $billions out of promising to transform finance through
blockchain and not doing it.



> However, there are security arguments for having an ECDH+KEM combiner
> hash the full transcript: not just the session keys but also the KEM
> ciphertext, the KEM public key, and both of the ECDH public keys.



> https://eprint.iacr.org/2021/708 and https://eprint.iacr.org/2021/1351
> include arguments for hashing at least a prefix of the public key.
> Having a KEM combiner that includes the ECDH public key and KEM public
> key as extra inputs means that people don't have to worry about the
> possibility of problems here. The arguments in these papers are weak,
> but the counterarguments are weak too.
>

Thanks, arguments may be weak, but cost of the control is minimal.

I am really not sold on the notion this is a combiner issue though, if it
matters at all, it likely matters whether you have one key or many.



> Once one has settled on what to hash, there are further engineering
> questions about the hashing details and about which system component
> should be responsible for each part of the hashing. As an example of
> why this is tricky:
>
>    * KEMs vary in whether they include their own hashing of ciphertexts
>      and of public keys.
>
>    * Kyber said that for "robustness" it was hashing "the entire
>      transcript" to make Kyber "as robust and misuse-resilient as
>      possible". However, NIST then (for unclear reasons) dropped Kyber's
>      ciphertext hashing.
>
>    * X-Wing uses a combiner that (for speed) omits ciphertext hashing.
>      But X-Wing also uses specifically Kyber-768, and has a security
>      analysis claiming that Kyber is still doing something _tantamount_
>      to ciphertext hashing, maybe at a 2^128 security level.
>
> This puts unnecessary load on security reviewers, and I think it'll turn
> out to be fragile. I would just have the combiner hash the transcript so
> that we don't have to worry about whether KEMs are aiming for something
> beyond IND-CCA2 and don't have to worry about whether protocols are
> secure with less hashing. But there's a specific claim that extra
> hashing would cost Google "millions of dollars/CO2 emissions/energy";
> there's a claim that failing outside the Kyber context is a positive
> feature; etc. One can't expect CFRG to have an easy decision here.
>

If people are doing ML-KEM they are already committed to a heck of a lot of
hashing. The fact that Google's operations are so extensive that any
marginal increase in CPU multiplied by billions of operations turns out to
be a lot doesn't seem to be a useful line of argument to me.

The difference between signing every entry in .com rather than just the
entries that had signatures was the difference between a few thousand
operations and hundreds of millions and a 600% increase in data volume.

Seems to me that we should be looking for a composable approach to getting
robust mechanisms for turning KEMs into KDF inputs.


I like to construct any protocol so that there is a digest function between
any quantity an attacker might manipulate and my crypto.

The way that I generate key identifiers in the Mesh is SHA-2-512 (
SubjectKeyIdentifier) so I have a 65 byte quantity (1st byte specifying
SHA-2-512) which is bound to the algorithm and public key. Dropping 70-ish
extra bytes into the KEM should not be a huge inconvenience. One more round
of hashing at most. Seems right for single key encryption.

Will have to think about the two key approach.