Re: [lamps] CMS Kyber: include PK and CT in the KDF?

Russ Housley <housley@vigilsec.com> Thu, 11 April 2024 21:31 UTC

Return-Path: <housley@vigilsec.com>
X-Original-To: spasm@ietfa.amsl.com
Delivered-To: spasm@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1E17EC14F6F4 for <spasm@ietfa.amsl.com>; Thu, 11 Apr 2024 14:31:13 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.096
X-Spam-Level:
X-Spam-Status: No, score=-2.096 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, HTML_MESSAGE=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=vigilsec.com
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 putDpaVZ0XRQ for <spasm@ietfa.amsl.com>; Thu, 11 Apr 2024 14:31:08 -0700 (PDT)
Received: from mail3.g24.pair.com (mail3.g24.pair.com [66.39.134.11]) (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 863FCC14F68C for <spasm@ietf.org>; Thu, 11 Apr 2024 14:31:08 -0700 (PDT)
Received: from mail3.g24.pair.com (localhost [127.0.0.1]) by mail3.g24.pair.com (Postfix) with ESMTP id 92C3A14878E; Thu, 11 Apr 2024 17:31:07 -0400 (EDT)
Received: from smtpclient.apple (pfs.iad.rg.net [198.180.150.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail3.g24.pair.com (Postfix) with ESMTPSA id 755D5147D73; Thu, 11 Apr 2024 17:31:07 -0400 (EDT)
From: Russ Housley <housley@vigilsec.com>
Message-Id: <A31C1C09-297F-4C4A-837E-FD2A703AD96F@vigilsec.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_D5107C9C-7DD8-4A5A-97BD-2CA28BA61153"
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\))
Date: Thu, 11 Apr 2024 17:30:57 -0400
In-Reply-To: <CAFR824w0rBfxGzCJrSZ3f45Lyn7SEVLZK6cM9ZaZVHVPujs-5g@mail.gmail.com>
Cc: LAMPS <spasm@ietf.org>
To: Deirdre Connolly <durumcrustulum@gmail.com>
References: <CAFR824w0rBfxGzCJrSZ3f45Lyn7SEVLZK6cM9ZaZVHVPujs-5g@mail.gmail.com>
X-Mailer: Apple Mail (2.3731.700.6.1.1)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vigilsec.com; h=from:message-id:content-type:mime-version:subject:date:in-reply-to:cc:to:references; s=pair-202402141609; bh=aOCDaXbheo+YT0zp/5aGDtoS84l5DkDk4YxNylmPpM4=; b=uF5GVApXnHSkpVh+Nkq+BOIOzmUmjYAp0ocPsMMDJEPxBKV5qb584QXI4AI2Ggr2JxkjpPEWUYl3+WPAfVNOeymdlHX9z8y/h/Cf0tmokuOse7BotfdnPhKUR7n3ciHt0KvE4tLF5xi2pCIIp2fivI/g/wsCFp0BfGl/dsnpAVZmO+hOD1ilHLrJHrbBOnAudQgXumeuiGNKd9DPOnJKnzegVLN8FTMqj/RHzGTu5H68xJmxCMS2aU4OsPyrHj9OR9OTQrjOpKJ2mSVCojYi42QPSRJ+EcJgn/7IMqzBzCKjbDiBS0orJGfqMr4LZ4d2TBZwDjIDFPWlnDjhmomafA==
X-Scanned-By: mailmunge 3.11 on 66.39.134.11
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/GXxqGijcCjZsPRyWuXsuMg9UBNA>
Subject: Re: [lamps] CMS Kyber: include PK and CT in the KDF?
X-BeenThere: spasm@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: This is the mail list for the LAMPS Working Group <spasm.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/spasm>, <mailto:spasm-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm/>
List-Post: <mailto:spasm@ietf.org>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/spasm>, <mailto:spasm-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 11 Apr 2024 21:31:13 -0000

Deirdre:

There was a discussion of this a few months ago.  Inside ML-KEM, the public key is included in the KDF that computes the shared secret.  There was discussion ot addint a hash of the ciphertext to the KDF computation, but no one thought that should be done in cms-kemri since that would be an algorithm-specific detail at a algorithm agile layer.

If there is consensus to do so, the CMS kyber draft could address this in the algorithm-specific layer.

It is _very_ important to me that one ML-KEM labrary be able to support CMS, JOSE, COSE, and so on.  so, whateve happen in one WG needs to be aligned with others.

Russ


> On Apr 11, 2024, at 10:30 AM, Deirdre Connolly <durumcrustulum@gmail.com> wrote:
> 
> Looking again at CMS Kyber <https://www.ietf.org/id/draft-ietf-lamps-cms-kyber-03.html>, it seems to not bind the encapsulation key or the KEM ciphertext anywhere in the CMS scheme or the KDF. To mitigate the less-than-ideal binding properties <https://eprint.iacr.org/2023/1933.pdf> of ML-KEM, I would consider including the encapsulation key and ciphertext along with the shared secret `ss` as input to the KDF. 
> 
> ML-KEM, as currently drafted as FIPS 203 IPD <https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.203.ipd.pdf>, is LEAK-BIND-K-PK and LEAK-BIND-K-CT at best <https://eprint.iacr.org/2024/523>. To safely use the shared secret output from ML-KEM without opening it up to re-encapsulation attacks <https://cryspen.com/post/pqxdh/>, including the PK and CT concatted with the `ss` as the preimage to the KDF is a secure and easy way to maximally bind the resulting KEK to the KEM public values. This construction is also a secure solution for any KEM with even the weakest of binding properties, so it would be a safe pattern for other KEMs:
> 
> - KEK = KDF(ss)
> + KEK = KDF(ss || ct || pk)
> 
> The ML-KEM standard may change between the current draft and the final one later this summer/year, but even if so, this change would be basically bulletproof either way in terms of security.
> 
> Cheers,
> Deirdre