[openpgp] Re: pure vs. pre-hash in FIPS 204 and 205

Daniel Huigens <d.huigens@protonmail.com> Thu, 29 August 2024 18:39 UTC

Return-Path: <d.huigens@protonmail.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 3ABEBC1CAE8A for <openpgp@ietfa.amsl.com>; Thu, 29 Aug 2024 11:39:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.104
X-Spam-Level:
X-Spam-Status: No, score=-2.104 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, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, 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=protonmail.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 FoZx5gZAtiKn for <openpgp@ietfa.amsl.com>; Thu, 29 Aug 2024 11:38:57 -0700 (PDT)
Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) (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 21AE4C1CAE8D for <openpgp@ietf.org>; Thu, 29 Aug 2024 11:38:57 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1724956734; x=1725215934; bh=h8YgjWf7/Lvsmre4VDm8XUpQfkFJiwiC/pntWTU8eQI=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=qqn13hBcQzI4ygoTv11M+JcQV5LeEKToCqFlJYtPxrY5jNHCbpDWE2EWxYXa1G11h RDM/i9fIb8hTrN00SMyuyDTUhHX/O7hEpaG38brMxQxN3lhn74yi/ItWRGyY23bO8k Og5TnK0ZFrFqZ33f1n7QU5gZ3ASPbo3Zm1LNm4Jd7dgUhKSS6tsjlZHBRzdHcNGDjL NlH+m8wQ3Dfrkj8IoiAbePHlOF1CLpWhfpxAqtvw8eOQfj3exv/TK4Btj+XuyZk2V7 DTKp98Z5baSTyF3bTZ+Xe8clc2xbjkZ9vnKfFoV+KnGGQ2kqSQzBmB2Wz0aa5WLDx3 jp5w1MgwEy3hA==
Date: Thu, 29 Aug 2024 18:38:49 +0000
To: Phillip Hallam-Baker <phill@hallambaker.com>
From: Daniel Huigens <d.huigens@protonmail.com>
Message-ID: <jn2Si8uxzH6v4ebOob3nsQVDyPxenr-t-JdBaOEw7NUdELRGGvFdylXzARDZBB2mPhgBhSMg_AMJVcHS7Gs3d3XVhxeP-yRQkKfMumR9cwo=@protonmail.com>
In-Reply-To: <CAMm+Lwg-n8EUkb1feKUYHd1RQx6y4149LsZMg8f3eNzQqO4j+w@mail.gmail.com>
References: <fb9f748b-2024-4de1-849a-e52880c9a241@mtg.de> <CAMm+Lwh-9yuEs7BYpsA-k9bKWZT8v7ws8BPMdtECj+DgOG6syw@mail.gmail.com> <2027BD57-D6E2-400B-9AA3-8E444FE5372A@andrewg.com> <CAMm+Lwg-n8EUkb1feKUYHd1RQx6y4149LsZMg8f3eNzQqO4j+w@mail.gmail.com>
Feedback-ID: 2934448:user:proton
X-Pm-Message-ID: 2ed49c96e2b1bd7c304f483a260c45434f64eb59
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="b1_9voluZAfiEFdnnBYI3MvfRt3ihLf8KhRP3b8FmRu56U"
Message-ID-Hash: CXYH62TFRMJ4RFZY62HFFYPXYBNHJ6JH
X-Message-ID-Hash: CXYH62TFRMJ4RFZY62HFFYPXYBNHJ6JH
X-MailFrom: d.huigens@protonmail.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: Andrew Gallagher <andrewg@andrewg.com>, Falko Strenzke <falko.strenzke@mtg.de>, "openpgp@ietf.org" <openpgp@ietf.org>
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [openpgp] Re: pure vs. pre-hash in FIPS 204 and 205
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/0SOkWa8O2u0S9pItVfw8wFqROtQ>
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>

Hi Phillip,

On Thursday, August 29th, 2024 at 20:18, Phillip Hallam-Baker wrote:

> So we don't need to define manifests for ML-DSA, just use Prehash and specify the OID of the algorithm you used to prevent the downgrade attack, it is what it is designed for.

This still seems contradictory to the text in FIPS 204 I've been quoting that says that:

> 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. (... and, earlier:)
> In general, the “pure” ML-DSA version is preferred.

...right? Of course I understand that your proposal is also possible but from my reading of the text it seems that using the pure version is recommended in our situation.

> Simplest distance between the two points is to use the Context input to specify e.g. "OpenPGP v4.2 with SHA-3-512".

That sounds like a reasonable solution to me (or e.g. we could put part of the signature packet header there, including the hash algorithm ID?)

Best,
Daniel