[openpgp] Re: Fwd: [pqc-forum] Question regarding pure vs. pre-hash ML-DSA
Simo Sorce <simo@redhat.com> Fri, 30 August 2024 19:06 UTC
Return-Path: <simo@redhat.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 09093C15199C for <openpgp@ietfa.amsl.com>; Fri, 30 Aug 2024 12:06:43 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.25
X-Spam-Level:
X-Spam-Status: No, score=-2.25 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.148, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_NONE=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=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 HoPZvrP_tCKG for <openpgp@ietfa.amsl.com>; Fri, 30 Aug 2024 12:06:38 -0700 (PDT)
Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id AC4A6C151980 for <openpgp@ietf.org>; Fri, 30 Aug 2024 12:06:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725044797; 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=5iBpCdEKEtsd/Z4yPfh9XpePHraEkewhTJVQXVzmuNo=; b=O5secRzXqgljMMXdcRHsJHf053drgA+puk9yMFwvvP+p6wLP0KQmrjfw8us1cjRjm7wGvk bdUcUkRCotgYCKZrxnQJWPH6MkfruNV1GciOg+/Y1CrisWdL22KqVdECQoOkB0IRo7pzsC n57WIZR4j8B6BewdmuutMc9Zk1O1zpI=
Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-202-kQFvEZqANeOAQsLf68njAw-1; Fri, 30 Aug 2024 15:06:34 -0400
X-MC-Unique: kQFvEZqANeOAQsLf68njAw-1
Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4574542503fso1117051cf.0 for <openpgp@ietf.org>; Fri, 30 Aug 2024 12:06:33 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725044791; x=1725649591; h=mime-version:user-agent:content-transfer-encoding:organization :references:in-reply-to:date:cc:to:from:subject:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=P3feApvC1Vrmv5gJCXpNBWtIG5LbwoJ1Gm8RSnFfQaY=; b=Odwbx0gcNrXUbOELStdykTFVV5vjOh+LHFGa0XCFVxEk4ve7YW9VdeDEr/xoFOlbBY F+ROQvSr+JMQjO17/ciA4x5//gYbSMLIc6InXWgWQl22NPCwrr0qTXSS4ETqBdWZaQC4 CWgaAiBLhWI2oqKla4wpolzn+lgH0ZeJ8MJA1jBu6gskrZxA5+P68UqKl2112OzyuYZk Dez5Fb+iq9AXgDJ+C1kX1TbJis/ORAx6nuQr+KGKqZaOHrFARKodRP0BewH+whDT22gq /fjEpk/OpmMCAeK4zaa0MEMh3ptCHLt8uotIV5qSh/6sIBzTF0PXHhLjWghZ6xIrFFBh +kug==
X-Forwarded-Encrypted: i=1; AJvYcCUW83FGNCCzNhnRImVO2S8l/OV1zD2tPTcLg+n4x9JaZrkovd7muJDklsY4Lw0eQl3F8a0R/seO@ietf.org
X-Gm-Message-State: AOJu0YwMUsQCn7cXv44WqSUgcG9FmLRmYjQP9nfzuhHUSRlHD5Z2J+bM OCK/lJZs5+PH4Gfq0J++fNGeNCLnU/55zsGfmlyf1nMuZdIpH/D2iJNtXjrhm8L4mBBjuU3SDMZ GbNheEqI8kgsLODb1GOjORQdhuU8jL9J/hfigXJOeBtwXrg==
X-Received: by 2002:a05:620a:4444:b0:7a1:c426:d875 with SMTP id af79cd13be357-7a89324b3b1mr72285885a.39.1725044790818; Fri, 30 Aug 2024 12:06:30 -0700 (PDT)
X-Google-Smtp-Source: AGHT+IHJogS6LhCxOfsLPO5pNJiUuudy9dWAAS6rwddw44pBS7MrJadkIbKZQ/3T4oE5BaBKRdFgPg==
X-Received: by 2002:a05:620a:4444:b0:7a1:c426:d875 with SMTP id af79cd13be357-7a89324b3b1mr72280985a.39.1725044790179; Fri, 30 Aug 2024 12:06:30 -0700 (PDT)
Received: from m8.users.ipa.redhat.com ([2603:7000:9400:fe80::318]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a806c0109fsm170141285a.14.2024.08.30.12.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 12:06:29 -0700 (PDT)
Message-ID: <e5eccd432d55049302f646c8d9687487c02d5a53.camel@redhat.com>
From: Simo Sorce <simo@redhat.com>
To: "David A. Cooper" <david.cooper@nist.gov>, Falko Strenzke <falko.strenzke@mtg.de>
Date: Fri, 30 Aug 2024 15:06:29 -0400
In-Reply-To: <d9b5779c-d5f4-4d42-b102-85b81704c130@nist.gov>
References: <0555d567-e161-488f-a4eb-30a015f8c0d0@mtg.de> <9f26a754-0268-4fc7-abcc-7eeebe38eb88@mtg.de> <d9b5779c-d5f4-4d42-b102-85b81704c130@nist.gov>
Organization: Red Hat
User-Agent: Evolution 3.52.4 (3.52.4-1.fc40)
MIME-Version: 1.0
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Message-ID-Hash: 3VYWHPH6VV57WQDTJ4S6AZR76RCJ4O4X
X-Message-ID-Hash: 3VYWHPH6VV57WQDTJ4S6AZR76RCJ4O4X
X-MailFrom: simo@redhat.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: pqc-forum <pqc-forum@list.nist.gov>, "openpgp@ietf.org" <openpgp@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [openpgp] Re: Fwd: [pqc-forum] Question regarding pure vs. pre-hash ML-DSA
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/XqhHW582DqOM2Im-hxjlnYS8TKU>
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>
Hello David, your response mentions that both "pure" and "pre-hash" variants would be ok for openpgp. The spec expresses a recommendation to use Pure ML-DSA (quoting: `In general, the “pure” ML-DSA version is preferred.`) and this has been taken, by some, to mean that applications should prefer the use of ML- DSA even when the content being signed is pre-hashed. Can you clarify if NIST would recommend the use of HashML-DSA when the message is pre-hashed, all else equal? Or would NIST recommend to use the pure ML-DSA, regardless of what form the message takes and relegates HashML-DSA just to cases where there is a technical deficiency in the Crypto module implementation that makes pure ML-DSA impractical for large messages ? Thank you, Simo. On Thu, 2024-08-29 at 12:05 -0700, 'David A. Cooper' via pqc-forum wrote: > Hello Falko, > > The text in Section 5.4 of FIPS 204 and Section 10.2 of FIPS 205 just > attempts to explain the reason that both "pure" and "pre-hash" versions. > I'm not familiar with OpenPGP, but it seems like this is a case where > either version could be used. > > From my reading of Section 5.2.4 of RFC 9580, the content that is > signed is what is referred to as a trailer. In the case of RSA and > ECDSA, the trailer is signed directly. The text may describe hashing the > trailer first and then generating a signature from that hash, but the > result is the same as just signing the trailer. Section 6.1.1 of > https://www.ietf.org/archive/id/draft-ehlen-openpgp-nist-bp-comp-00.html > notes that an ECDSA signature is created by computing a hash of M and > then performing ECDSA.Sign() on that hash, but "excluding Step 1: H = > Hash(M) in [the FIPS 186-5 ECDSA] algorithm specification." So, the > result is the same as signing M with ECDSA using the specified hash > algorithm. The description for RSA in RFC 9580 is essentially the same. > > With EdDSA, however, Section 12.7 of RFC 9580 states to use PureEdDSA to > sign the hash of the trailer. So, unlike with RSA and ECDSA, from the > signature algorithm's point of view it is the hash of the trailer that > is signed. HashEdDSA could have been used to sign the trailer, but that > was not the decision that was made. (Perhaps the reason is that with > HashEdDSA, RFC 8032 would have dictated which hash function to use.) > > With ML-DSA and SLH-DSA, you could either create a pre-hash signature of > the trailer (which would align with how RSA and ECDSA work in RFC 9580) > or a pure signature of the hash of the trailer (which would align with > how EdDSA works in RFC 9580). Phillip noted that the pre-hash version > signs the identifier of the hash function, preventing a potential hash > algorithm substitution attack. However, the trailer seems to already > include an identifier for the hash function, so a pure signature of the > hash of the trailer would already be protected from such an attack. > > On 8/29/24 1:08 AM, Falko Strenzke wrote: > > > > Hi Dustin, > > > > > > in that case let me formulate the most relevant question that we are > > facing in OpenPGP currently, that was my main motivation for > > understanding the quoted paragraphs: > > > > > > OpenPGP is committed to the hash-and-sign paradigm. RFC 9580, the > > current specification, throughout describes how data is first hashed > > and then signed. When introducing ML-DSA and SLH-DSA to OpenPGP, we > > are bound to this approach. The question now is: In such a case, is it > > a NIST approved solution, to use the pure variants of both PQC schemes > > to sign the hash value? > > > > > > Best regards, > > Falko > > > > > > Am 28.08.24 um 18:00 schrieb Moody, Dustin (Fed): > > > Falko, > > > > > > We're trying to answer your question, but we don't quite get the > > > point you're making, which makes it hard to respond. Can you try > > > explaining it to me again, as clearly as possible so we understand? > > > The text seems pretty straightforward to us. > > > > > > Dustin > > > > > > > > > ------------------------------------------------------------------------ > > > *From:* pqc-forum@list.nist.gov on behalf of Falko Strenzke > > > *Sent:* Wednesday, August 28, 2024 12:41 AM > > > *To:* Phillip Hallam-Baker > > > *Cc:* pqc-forum > > > *Subject:* Re: [pqc-forum] Question regarding pure vs. pre-hash ML-DSA > > > > > > Thanks for the pointer. If I see it correctly you are suggesting a > > > pre-image attack on a hash algorithm that is accepted by the > > > recipient. Pre-image attacks are not a known threat for any hash > > > algorithm still potentially in use, not even MD5, as far as I know, > > > but it's certainly a valid concern to hedge against this possibility. > > > This would be the reason why the pre-hash variant hashes the hash OID > > > internally. This is all the more showing how important correct use of > > > the two variants is and is thus reinforcing my question. > > > > > > My question to NIST actually isn't about technical matters regarding > > > the security properties of hash algorithms, I am asking how NIST > > > intends the quoted text is to be understood that is part of their > > > guidance on using the pre-hash variant. > > > > > > The meaning of the sentence following in the next paragraph is also > > > not clear to me: "/In order to maintain the same level of security > > > strength when the content is hashed at the application level or using > > > HashML-DSA [...]/" This seems to suggest that the content may be > > > hashed at the application level and then the hash signed with the > > > pure variant. (That is implied by the "or" connecting the two > > > clauses.) Possibly here it is referred to a case like that of CMS > > > where the signedAttrs may be signed and where the message digest is > > > contained in that object. But I think that doesn't become clear. My > > > recent experience in a discussion is that this paragraph can be > > > understood to counter the clear statement at the beginning of section > > > 5.4: > > > > > > /For some use cases, this may be addressed by signing a digest of the > > > message along with some domain separation information rather than > > > signing the message directly. This version of ML-DSA is known as > > > “pre-hash” ML-DSA or HashML-DSA./ > > > > > > Best regards, > > > Falko > > > > > > Am 27.08.24 um 17:29 schrieb Phillip Hallam-Baker: > > > > > > You can indeed pass the digest directly into pure. The issue > > > being that it is unsafe to do so, an attacker can perform a > > > digest substitution attack on it. > > > > > > Consider the case where the application supports a hash which has > > > been broken to the extent that they can create any digest output > > > they like - MD-BORKED > > > > > > Queen Alice decides to knight Bob, writes out a declaration to > > > that effect, hashes it with SHA-2-512 and posts it to the gazette. > > > > > > Mallet takes the signature, writes out a death warrant for Bob > > > and uses the MD-BORKED manipulation code to create a digest that > > > matches that of the original message. Instead of arriving to find > > > the Queen holding a sword to confer the accolade, Bob finds the > > > headsman holding an axe. > > > > > > > > > That is why it is always necessary to bind the digest type into > > > the signature if a pre-hash is used. > > > > > > Pure should only be used on the message content itself or on a > > > manifest structure which includes the digest value. > > > > > > So for example, a DARE signature on a chunk appended to a > > > sequence typically contains the following information: > > > > > > * Digest algorithm used to digest the content > > > * Digest value over the content > > > * Digest algorithm used to create the Merkle Tree > > > * Apex value of the Merkle tree > > > * Witness value showing demonstrating the signer knew the > > > encryption key > > > * Application context identifier > > > > > > Those values are carried in a separate JSON manifest which once I > > > have finished the code will be signed with ML-DSA pure and with > > > Ed448 pure with the context string 'DARE manifest'. > > > > > > > > > > > > On Tue, Aug 27, 2024 at 7:04 AM Falko Strenzke > > > <falko.strenzke@mtg.de <mailto:falko.strenzke@mtg.de>> wrote: > > > > > > Dear NIST team, > > > > > > in FIPS 204, Section 5.4, I read > > > > > > /If the content to be signed is large, hashing of the content > > > is often performed at the application level. > > > For example, in the Cryptographic Message Syntax [29 ], a > > > digest of the content may be computed, and > > > that digest is signed along with other attributes. If the > > > content is not hashed at the application level, the > > > pre-hash version of ML-DSA signing may be used./ > > > > > > How is the last sentence to be understood? If the content is > > > not hashed at the application level, that sounds to me as if > > > it can be fed into the pure signature generation or > > > verification routine directly. After all, ML-DSA signature > > > generation and verification is single-pass over the message, > > > if I am not mistaken. > > > > > > On the contrary, my understanding of the pre-hash variant is > > > that it is specifically for those cases, where the protocol > > > is bound to compute a hash before it can access (or decide > > > on) the signature generation or verification function. The > > > last sentence of the quote, however, seems to suggest that > > > the pre-hash variant is merely a convenience function to > > > combine the hash computation with the signature computation. > > > > > > Can you please clarify? > > > > > > Best regards, > > > Falko > > > > > > -- > > > > > > *MTG AG* > > > Dr. Falko Strenzke > > > > > > Phone: > > > +49 6151 8000 24 > > > E-Mail: > > > falko.strenzke@mtg.de <mailto:falko.strenzke@mtg.de> > > > Web: > > > mtg.de > > > <https://www.mtg.de/> > > > Follow us > > > ------------------------------------------------------------------------ > > > > > > MTG AG - Dolivostr. 11 - 64293 Darmstadt, Germany > > > Commercial register: HRB 8901 > > > Register Court: Amtsgericht Darmstadt > > > Management Board: Jürgen Ruf (CEO), Tamer Kemeröz > > > Chairman of the Supervisory Board: Dr. Thomas Milde > > > > > > This email may contain confidential and/or privileged > > > information. If you are not the correct recipient or have > > > received this email in error, > > > please inform the sender immediately and delete this > > > email.Unauthorised copying or distribution of this email is > > > not permitted. > > > > > > Data protection information: Privacy policy > > > <https://www.mtg.de/en/privacy-policy> > > > > > > -- > > > You received this message because you are subscribed to the > > > Google Groups "pqc-forum" group. > > > To unsubscribe from this group and stop receiving emails from > > > it, send an email to pqc-forum+unsubscribe@list.nist.gov > > > <mailto:pqc-forum+unsubscribe@list.nist.gov>. > > > To view this discussion on the web visit > > > https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/e619b550-178a-4816-8605-8ffb3d0e9c06%40mtg.de > > > <https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/e619b550-178a-4816-8605-8ffb3d0e9c06%40mtg.de?utm_medium=email&utm_source=footer>. > > > > > > > -- Simo Sorce Distinguished Engineer RHEL Crypto Team Red Hat, Inc
- [openpgp] Fwd: [pqc-forum] Question regarding pur… Falko Strenzke
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… David A. Cooper
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… Falko Strenzke
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… Simo Sorce
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… David A. Cooper
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… Daniel Huigens
- [openpgp] Re: Fwd: [pqc-forum] Question regarding… Simo Sorce