Re: [openpgp] Disadvantages of Salted Signatures

"Neal H. Walfield" <neal@walfield.org> Sat, 09 December 2023 11:37 UTC

Return-Path: <neal@walfield.org>
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 E04E3C151073 for <openpgp@ietfa.amsl.com>; Sat, 9 Dec 2023 03:37:12 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.905
X-Spam-Level:
X-Spam-Status: No, score=-1.905 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_ZEN_BLOCKED_OPENDNS=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
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 3SbwZqWlA_nN for <openpgp@ietfa.amsl.com>; Sat, 9 Dec 2023 03:37:08 -0800 (PST)
Received: from mail.dasr.de (mail.dasr.de [202.61.250.5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id D00E0C14CE51 for <openpgp@ietf.org>; Sat, 9 Dec 2023 03:37:07 -0800 (PST)
Received: from p5de925c3.dip0.t-ipconnect.de ([93.233.37.195] helo=enkidu.walfield.org) by mail.dasr.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from <neal@walfield.org>) id 1rBvdp-0003D4-CZ; Sat, 09 Dec 2023 12:37:05 +0100
Date: Sat, 09 Dec 2023 12:37:04 +0100
Message-ID: <87wmtna9pb.wl-neal@walfield.org>
From: "Neal H. Walfield" <neal@walfield.org>
To: Stephan Verbücheln <verbuecheln@posteo.de>
Cc: openpgp@ietf.org
In-Reply-To: <077dd27cef0c7d3968967fc4c3a880081b8bd9dd.camel@posteo.de>
References: <077dd27cef0c7d3968967fc4c3a880081b8bd9dd.camel@posteo.de>
User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 EasyPG/1.0.0 Emacs/28.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)
MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue")
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/8mpbuyTJFUqGQclXLyT9wxz_fUc>
Subject: Re: [openpgp] Disadvantages of Salted Signatures
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.39
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 09 Dec 2023 11:37:13 -0000

Hi Stephan,

On Sat, 09 Dec 2023 10:04:14 +0100,
Stephan Verbücheln wrote:
> 1. A malicious blackbox implementation (e.g. PGP smartcard) can choose
> the nonce in a way that allows the attacker to compute the secret key
> from two signatures.

As I understand it, OpenPGP signatures are generated in two steps.

  - The data including the salt (which I think you are calling the
    nonce) is hashed.
  - The hash is signed.

From the draft:

  > The body of a v4 or v6 Signature packet contains:
  >
  >   - ...
  >
  >   - Only for v6 signatures, a variable-length field containing:
  >
  >     - A one-octet salt size. The value MUST match the value
  >       defined for the hash algorithm as specified in Table 23.
  >
  >     - The salt; a random value of the specified size.

  https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#section-5.2.3

  > The concatenation of the data being signed, the signature data from
  > the version number through the hashed subpacket data (inclusive),
  > and (for signature versions later than 3) a six-octet trailer (see
  > Section 5.2.4) is hashed. The resulting hash value is what is
  > signed.

  https://www.ietf.org/archive/id/draft-ietf-openpgp-crypto-refresh-12.html#section-5.2.3.6

OpenPGP smartcards, as I understand it, only do the second step.  And,
for what it is worth, this is how we designed the low-level signing
interface in Sequoia:

  https://docs.sequoia-pgp.org/sequoia_openpgp/crypto/trait.Signer.html

That is, OpenPGP smartcards are handed the computed hash and asked to
sign that; AIUI, the smartcard does not generate, nor can it influence
the value of the salt that was generated in the previous step.  So,
from the perspective of the card, I think the signing operation is
deterministic.

Am I misunderstanding something?  If you agree, does your attack still
hold?

I'm sorry if I'm missing something obvious; I'm not a cryptographer.

Neal