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

Hubert Kario <hkario@redhat.com> Fri, 12 April 2024 09:46 UTC

Return-Path: <hkario@redhat.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 B240DC14F683 for <spasm@ietfa.amsl.com>; Fri, 12 Apr 2024 02:46:48 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.644
X-Spam-Level:
X-Spam-Status: No, score=-7.644 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-2.049, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SORBS_WEB=1.5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.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 fULnfH6T8cIG for <spasm@ietfa.amsl.com>; Fri, 12 Apr 2024 02:46:44 -0700 (PDT)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6A990C14F5F3 for <spasm@ietf.org>; Fri, 12 Apr 2024 02:46:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712915203; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yWg5uUKwQfo1X85O4y7/q2y8evxHY2N47o/2WzEHs3s=; b=Qhi8c/exgtmZvwibuv5qWy/dZGjUgJurZC8i/rHwBDA57bLS6jOkStI2ajmLMyEqycw3fy ehkn/9W3rYaoHn8lkP/uqpWIkk+cz043Snl/qKYrREKQNuxI78etvRuVsTw8KW7o8NCR1h AIWzX8izmI7hvob+yyLettbT8+jMcgU=
Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-179-G-3X7hiKPw-iRVYRb1LtWQ-1; Fri, 12 Apr 2024 05:46:41 -0400
X-MC-Unique: G-3X7hiKPw-iRVYRb1LtWQ-1
Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4369017f176so7438391cf.1 for <spasm@ietf.org>; Fri, 12 Apr 2024 02:46:41 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712915201; x=1713520001; h=content-transfer-encoding:user-agent:organization:references :in-reply-to:message-id:mime-version:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Uq27sFcoPGHXabmiU5rPghe9pzvYoG8Hf4QBFMtgjRc=; b=Ukj1yWveIGcJ/xZDFO4ZCfRr7w/Nz9q0Dd9CmGJNBG0QKYLKOjL36WZvZuPUGjhjaw hiStF9YPU6MF6Vv5HyWq3Pxk2WZ/0pn3y0Hw3NnoReuqlmVyd5tW7hnmuEvnJhsh0j4L 8VhR/c/l9hr7YKBntRUkOsjX3Ekp9zCh9cAiUXuNpiwX6p2QeifeLjrSUwpzb9tZB+7E 5O8uLezlSSwNEBlIfL99kOisHRtIfZUe62eCibjarHNA/E8VbPf9xGLTo0Jy9CokbQKc BL+mdzbQw6Bc9cL0zqfdlF/vOTnAHR/v92FNbYCtPrN3hRwQy6kxlRJIXm5c1U5TTyV+ pWVw==
X-Forwarded-Encrypted: i=1; AJvYcCW2oOhwZN/g2hw/DSFIjdVpO95PNm+IDJWPj5FmYFH8vWHMufaJGaY9DfuGN+tYXoOAaaMPYCjcASfsiJszeA==
X-Gm-Message-State: AOJu0YzHgQtCoMl/twCBzzM/RGLZ0aggEIoqf+sj3eFy5tgxT9iANOJa eSv1vTCNd8FqJfIzlqduqpy5jTt0pvOipCAhmawhFdpEhxsgBlXOR/hLozkxT8YbXREKuy2YkFZ aV92C7PmRsmdUaQrvoCfk8959EOANwljFyXjSXS7rd9I=
X-Received: by 2002:ac8:5d88:0:b0:436:7ba0:3a08 with SMTP id d8-20020ac85d88000000b004367ba03a08mr3599595qtx.24.1712915201076; Fri, 12 Apr 2024 02:46:41 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IF7xZSJvnZEm4dPXmovSJFSZwAlc2Z8vRuuUDNLFVQP2v7k+4fj5GEx2266HqEh5YwNcfuMow==
X-Received: by 2002:ac8:5d88:0:b0:436:7ba0:3a08 with SMTP id d8-20020ac85d88000000b004367ba03a08mr3599578qtx.24.1712915200769; Fri, 12 Apr 2024 02:46:40 -0700 (PDT)
Received: from localhost (ip-94-112-165-231.bb.vodafone.cz. [94.112.165.231]) by smtp.gmail.com with ESMTPSA id j9-20020ac84409000000b00434ce53c664sm2019564qtn.80.2024.04.12.02.46.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 02:46:40 -0700 (PDT)
From: Hubert Kario <hkario@redhat.com>
To: Watson Ladd <watsonbladd@gmail.com>
Cc: Russ Housley <housley@vigilsec.com>, Deirdre Connolly <durumcrustulum@gmail.com>, LAMPS <spasm@ietf.org>
Date: Fri, 12 Apr 2024 11:46:37 +0200
MIME-Version: 1.0
Message-ID: <9d26ab5f-6034-477e-b02f-e04915da9513@redhat.com>
In-Reply-To: <CACsn0c=9CDufOjLP98Rwj1BSO_eK=STsg2CObLSnmr+MrpyYUA@mail.gmail.com>
References: <CAFR824w0rBfxGzCJrSZ3f45Lyn7SEVLZK6cM9ZaZVHVPujs-5g@mail.gmail.com> <A31C1C09-297F-4C4A-837E-FD2A703AD96F@vigilsec.com> <CACsn0c=9CDufOjLP98Rwj1BSO_eK=STsg2CObLSnmr+MrpyYUA@mail.gmail.com>
Organization: Red Hat
User-Agent: Trojita/0.7-git; Qt/5.15.11; xcb; Linux; Fedora release 38 (Thirty Eight)
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/ZomMvovxrBADrRIQIyrQZRSHUZ4>
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: Fri, 12 Apr 2024 09:46:48 -0000

On Friday, 12 April 2024 05:48:25 CEST, Watson Ladd wrote:
> On Thu, Apr 11, 2024 at 2:31 PM Russ Housley <housley@vigilsec.com> wrote:
>> 
>> 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.
>
> Huh? CMS and TLS handle ECDH very differently today.
>> 
>> 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.
>
> That library exposes Ecapsulate, Decapsulate, and Kegen functions. It
> will function just fine even if a protocol layers a combiner on top.

Sure, but the point is to allow for code reuse across protocols.
So, having a common higher level operation that's used verbatim
in CMS, JOSE, COSE, XMLenc, etc. is Good™. No need to have functionally
the same code in each and every implementation of the higher level formats.

>> Russ
>> 
>> 
>> On Apr 11, 2024, at 10:30 AM, Deirdre Connolly 
>> <durumcrustulum@gmail.com> wrote:
>> 
>> Looking again at CMS Kyber, 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 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, is 
>> LEAK-BIND-K-PK and LEAK-BIND-K-CT at best. To safely use the 
>> shared secret output from ML-KEM without opening it up to 
>> re-encapsulation attacks, 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 ...
>
>
>

-- 
Regards,
Hubert Kario
Principal Quality Engineer, RHEL Crypto team
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkyňova 115, 612 00, Brno, Czech Republic