[lamps] Re: [pqc-forum] Pre-hash options for SLH-DSA

"Markku-Juhani O. Saarinen" <mjos.crypto@gmail.com> Tue, 30 July 2024 18:51 UTC

Return-Path: <mjos.crypto@gmail.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 CC740C14F71C for <spasm@ietfa.amsl.com>; Tue, 30 Jul 2024 11:51:36 -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_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=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 mi0WDs8oCznE for <spasm@ietfa.amsl.com>; Tue, 30 Jul 2024 11:51:33 -0700 (PDT)
Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) (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 2D9E7C14F5E7 for <spasm@ietf.org>; Tue, 30 Jul 2024 11:51:33 -0700 (PDT)
Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-70f5ef740b7so959424b3a.2 for <spasm@ietf.org>; Tue, 30 Jul 2024 11:51:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722365492; x=1722970292; darn=ietf.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=tQzVogv7V1t/3wNUyDoJmTbEVzSaqWQj5nLk4xUQXeM=; b=iBCPTgunFy7KrbZZ1ORWgSy95uwK4h/rbKyt/FEfduhGYVv2FhkmbqUUHn1htY5hPd gqTveCTqRbF3yuNqxzpVRBvHqCsB5USzlSfnMrZAdos8FvmsguDkXhy5vPcQzwmUVdMM zZ28sEk4OLLaHJunlashjf5mHchNZcuMxHwD/8DUktes9wBxv8t45RR4o6NYHD2eC244 hRDwNJxPeem9kikpJBh5RkJwrBh+zfrBnuZPelZaN7YVSwVBMSlPbVDEyIvIoDndSCU5 ydYZhd5HV55DV96wRuKfwiJ2XMJo9Tiwayj6C1Uoh8YLKIZZT0W1y+tFtpBRGvlEms1G AseA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722365492; x=1722970292; 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=tQzVogv7V1t/3wNUyDoJmTbEVzSaqWQj5nLk4xUQXeM=; b=H6SOl07rcfh5nZWYrjTDuwtt+sKSrKR9ocX/iAcPxvijxkT8bSdEFc4sxBvgc3Oas8 Q2DMOnzYwqT7pynUdWAMZJGJ2anyvRu3JGXGyXOJ6jsAi1UaOccl8qGsV3z8FDhgQtOI 78xHsjZRXwNDbofMzTaC2QCiT5WZ5Unj/N875cBK/+oawhj9cBdy2KyXRx4Ge/V0gJ/2 pl5/ZgtC1IYvNTEwO/eaoFsnDhxXR9fh9+6qA0TrX9d1MpQUnWmrQP2KRvUnxG+8mef7 oiOhdbydMfMBevDYmHEuGYY8gbwGUXUw/F2w1jYz90HAaAN3NF5XYhGm39fglAnonmoa obcg==
X-Forwarded-Encrypted: i=1; AJvYcCWquR7h10kiMXFSqgd9njGG/B6TLsj7RGRhcBAUiGhBKQd4wzntTERRvDekaJ7H7p3opDN3aCoqGAFXfMu/Mg==
X-Gm-Message-State: AOJu0Ywcqwa1QIpVuLrfjF2PSwtzxgNIwUenEGiNoKXNAfKokMgeqAnL Swp5x0VQxIKnX5y7nl+aYiCTkUAMEbpoo78AH7wJmRKcLQnilwm3vPzwXThPZ/bZcQ0Kgwj4iwx 6dlIvYDhZr1Hn3uklaAznIvhsNoQ=
X-Google-Smtp-Source: AGHT+IFusjtVpvb5yIfeg+cHj/oMIl6yONjbd7pMaBTp2wyA1wj6QiuP0CTpkBOong+0pBk0qly0DVXZ/rYlRu/bg04=
X-Received: by 2002:a05:6a20:cf90:b0:1c0:ede4:9a73 with SMTP id adf61e73a8af0-1c4a1179111mr15143592637.7.1722365492280; Tue, 30 Jul 2024 11:51:32 -0700 (PDT)
MIME-Version: 1.0
References: <f26dc8c7-d7b3-4fb5-8189-55ffb2d99332@nist.gov> <60e9e8ca-3318-4017-b11a-7be327b90d75@nist.gov>
In-Reply-To: <60e9e8ca-3318-4017-b11a-7be327b90d75@nist.gov>
From: "Markku-Juhani O. Saarinen" <mjos.crypto@gmail.com>
Date: Tue, 30 Jul 2024 18:51:21 +0000
Message-ID: <CA+iU_qnPB2h3ZQTuH00bcFZXTOEyHkmpkRp3EMBtT+tR8AGQbA@mail.gmail.com>
To: "David A. Cooper" <david.cooper@nist.gov>
Content-Type: multipart/alternative; boundary="0000000000005745f2061e7b77fc"
Message-ID-Hash: 76TYYB6YW4E5Z3KC2ZK2F5IZJBUFJNNC
X-Message-ID-Hash: 76TYYB6YW4E5Z3KC2ZK2F5IZJBUFJNNC
X-MailFrom: mjos.crypto@gmail.com
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-spasm.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>, spasm@ietf.org
X-Mailman-Version: 3.3.9rc4
Precedence: list
Subject: [lamps] Re: [pqc-forum] Pre-hash options for SLH-DSA
List-Id: This is the mail list for the LAMPS Working Group <spasm.ietf.org>
Archived-At: <https://mailarchive.ietf.org/arch/msg/spasm/n-J-syIBFK9Sh_O_NundX8az688>
List-Archive: <https://mailarchive.ietf.org/arch/browse/spasm>
List-Help: <mailto:spasm-request@ietf.org?subject=help>
List-Owner: <mailto:spasm-owner@ietf.org>
List-Post: <mailto:spasm@ietf.org>
List-Subscribe: <mailto:spasm-join@ietf.org>
List-Unsubscribe: <mailto:spasm-leave@ietf.org>

Thanks David,


Collision resistance assumptions aside, let's look at these technical
choices:


SLH-DSA-SHA2-128s and SLH-DSA-SHA2-128f versions would currently *not*
require an implementation of SHA-512 -- the proposed prehashing option
would make SHA-512 necessary for the 128s and 128f variants too. Other SHA2
versions of SLH_DSA require both algorithms. I'd think that it would be
better if the SHA2-128s and SHA2-128f variants used SHA-256 as a prehash,
as was suggested in the cited internet draft.


*Rationale:* As everyone knows, SHA-256 and SHA-512 are two different
algorithms from an implementation viewpoint; they have different block
sizes and state sizes. SHA-256 works on 32-bit words, SHA-512 works on
64-bit words; the SHA-512 round constants require more than twice ROM bits,
etc. SHA-512 has faster throughput on regular 64-bit PCs but not on smaller
units like security controllers, which are an important use case for these
two variants (OpenTitan already supports 128s). Requiring SHA-512
complicates hardware implementations of these smaller variants
significantly and more than doubles its size ( https://ia.cr/2024/367 ).
With the current generation, acceleration on microcontrollers is often
available for SHA-256 but not SHA-512. The vast majority of the internal
hash ops is SHA-256 for all security levels anyway, and SHA-256 is usually
faster for those tasks.


*On internal hashing of SLH-DSA-SHAKE-128s and 128f:* Your posting didn't
clarify this, but I assume you're planning to keep the *internal* hashes of
SLH-DSA-SHAKE-128s and 128f as SHAKE256, as per Section 10.1 of the FIPS
205 ipd. For SLH-DSA's internal hashing (actually generating and verifying
hash-based signatures), SHAKE128 and SHAKE256 are essentially the same
algorithm. For these hashes the difference ends up being the contents and
location of a few padding bits within a block -- there is no security or
performance difference between SHAKE128 and SHAKE256 for single-block
messages.


Hence there should be no complication in using the faster-throughput
SHAKE128 for SLH-DSA-SHAKE-128 *external* prehashing (as proposed) while
all of the internal hashing is kept as SHAKE256 as it currently is.

Cheers,
- markku

Dr. Markku-Juhani O. Saarinen <mjos@iki.fi>


On Tue, Jul 30, 2024 at 3:38 PM 'David A. Cooper' via pqc-forum <
pqc-forum@list.nist.gov> wrote:

> As was previously announced on the pqc-forum
> <https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/JKMh0D0pa30/m/vbflXolxAQAJ>,
> SLH-DSA will specify separate "pure" and "pre-hash" versions. For the
> pre-hash versions, each of the OIDs that NIST will assign will specify both
> the SLH-DSA parameter set and the function to use for pre-hashing. Given
> the number of SLH-DSA parameter sets and the number of NIST *approved*
> hash functions and XOFs, there is a very large number of potential
> combinations. While assigning OIDs for more combinations would allow for
> more flexibility, we believe there is a benefit in minimizing the number of
> options in order to facilitate interoperability.
>
> For SLH-DSA, we are currently considering assigning an OID for one
> pre-hash option for each parameter set, as in the table below. For the SHA2
> parameter sets, SHA-512 would be used for the pre-hash at all security
> levels. While SHA-256 would provide sufficient security for the category 1
> parameter sets, SHA-512 is faster than SHA-256 on many platforms when
> hashing large messages. SHA-512 is also a more conservative option, which
> many people have requested. For the SHAKE parameter sets, SHAKE256 would be
> used with the category 3 and 5 parameter sets. For the category 1 parameter
> sets, SHAKE128 would be used, since it is faster than SHAKE256 and it
> provides sufficient security for category 1.
>
> A slightly different approach that could be followed is the one
> recommended in Section 4 of
> https://www.ietf.org/archive/id/draft-ietf-lamps-cms-sphincs-plus-07.html
> for selecting a digest algorithm to use in CMS. The recommendations in that
> draft are the same as in the table below, with the exception that SHA-256
> is recommended when using the SLH-DSA-SHA2-128s and SLH-DSA-SHA2-128f
> parameter sets.
>
> We would appreciate any feedback people may have about what OIDs to assign
> for pre-hash versions of SLH-DSA.
>
> Thank you,
>
> David
>
> *parameter set *
> *pre-hash function *
> SLH-DSA-SHA2-128s
> SHA-512
> SLH-DSA-SHA2-128f SHA-512
> SLH-DSA-SHA2-192s SHA-512
> SLH-DSA-SHA2-192f SHA-512
> SLH-DSA-SHA2-256s SHA-512
> SLH-DSA-SHA2-256f SHA-512
> SLH-DSA-SHAKE-128s SHAKE128 with 256 bits of output
> SLH-DSA-SHAKE-128f SHAKE128 with 256 bits of output
> SLH-DSA-SHAKE-192s SHAKE256 with 512 bits of output
> SLH-DSA-SHAKE-192f SHAKE256 with 512 bits of output
> SLH-DSA-SHAKE-256s SHAKE256 with 512 bits of output
> SLH-DSA-SHAKE-256f SHAKE256 with 512 bits of output
>
>
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/60e9e8ca-3318-4017-b11a-7be327b90d75%40nist.gov
> <https://groups.google.com/a/list.nist.gov/d/msgid/pqc-forum/60e9e8ca-3318-4017-b11a-7be327b90d75%40nist.gov?utm_medium=email&utm_source=footer>
> .
>