Re: [openpgp] Question on computing v5 signatures

"brian m. carlson" <sandals@crustytoothpaste.net> Thu, 02 May 2019 23:52 UTC

Return-Path: <sandals@crustytoothpaste.net>
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 BC30412068B for <openpgp@ietfa.amsl.com>; Thu, 2 May 2019 16:52:28 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (3072-bit key) header.d=crustytoothpaste.net
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dTamqu-o-7-p for <openpgp@ietfa.amsl.com>; Thu, 2 May 2019 16:52:26 -0700 (PDT)
Received: from injection.crustytoothpaste.net (injection.crustytoothpaste.net [192.241.140.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 6E542120691 for <openpgp@ietf.org>; Thu, 2 May 2019 16:52:26 -0700 (PDT)
Received: from genre.crustytoothpaste.net (unknown [IPv6:2001:470:b978:101:ace5:84c6:6a15:3d32]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by injection.crustytoothpaste.net (Postfix) with ESMTPSA id 443E360100; Thu, 2 May 2019 23:52:23 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=crustytoothpaste.net; s=default; t=1556841143; bh=6SSfZQeapGiqBV2qreaGtFgV+wsEukny879xoBjIeuA=; h=Date:From:To:Subject:References:Content-Type:Content-Disposition: In-Reply-To:From:Reply-To:Subject:Date:To:CC:Resent-Date: Resent-From:Resent-To:Resent-Cc:In-Reply-To:References: Content-Type:Content-Disposition; b=gDEwiJZXkiGfXwQLxkG2kpMoM69EPP7RfvQxsBPDXN47ud5OCUbsxt2LN0aSp3OFX vt/mK9P5jlfDFH+vEkG6+PGrgDj00DEChETTKIkZeOSkwSqB7tERm4DnV/y87RmxAw UhuvomexfucAv5PolCQvbmUcJPWEyiFU2SdCIIruYhixFwQinUQkXbkRICofPnfgeF WNUg7auZI3ptAbrD19NxXg9Dq/vCu1PAO9cKMUcuLOLd1otnWNufX8ZFg1q00QiGqY zvFgjZzztPvgiQ2YTEG3FeciH9ZLfaD+Xn8IpI/w4F0UeQkQmBc1RBFuvQfZoMRbDS a4SJ4HRW/2SI2IVWrb9sefx1Vmtru5djT3eAFbTVbL1W2hVzP4w2pMdNY/BNwH5oCK X2nk3ZzOTEcgGDAufnXq60rSEdVzzlVbUzD6svyC/xg2kydv9hbJn0i7vDA8Xok6yK NEzZV/WQfaVtyjbcHn2/3/t55SvZQFncSi4iqbi8Y4gbfrBz0GH
Date: Thu, 02 May 2019 23:52:19 +0000
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: Heiko Stamer <HeikoStamer@gmx.net>, OpenPGP WG <openpgp@ietf.org>
Message-ID: <20190502235219.GF202237@genre.crustytoothpaste.net>
References: <cdf3ec1d-25b5-0244-459d-11774c22b161@gmx.net> <87r29g6apc.fsf@wheatstone.g10code.de>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="MZf7D3rAEoQgPanC"
Content-Disposition: inline
In-Reply-To: <87r29g6apc.fsf@wheatstone.g10code.de>
X-Machine: Running on genre using GNU/Linux on x86_64 (Linux kernel 4.19.0-4-amd64)
User-Agent: Mutt/1.10.1 (2018-07-13)
X-Scanned-By: MIMEDefang 2.79 on 127.0.1.1
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/t7KX_u4gF6TiBuAypKWBmqSi89o>
Subject: Re: [openpgp] Question on computing v5 signatures
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
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: Thu, 02 May 2019 23:52:34 -0000

On Thu, May 02, 2019 at 07:13:51PM +0200, Werner Koch wrote:
> On Wed,  1 May 2019 21:29, HeikoStamer@gmx.net said:
> > I am wondering why a number of eight-octet size is used here. The
> > biggest field, AFAIS i.e. the hashed subpacket data area, is limited
> > by the included two-octet hashed subpacket length. So why 64 bit?
> 
> That seems to be a misunderstanding.  The original patch from Brian
> (9b846b7e from 2017-02-13) had this text:
> 
>   V5 signatures instead hash in a ten-octet trailer: the version of the
>   Signature packet, i.e., 0x05; 0xFF; and an eight-octet, big-endian
>   number that is the length of the hashed data from the Signature packet
>   (note that this number does not include these final ten octets).
> 
> He might have extended the counter to eight octets to better distinguish
> a V5 signature form a V4 signature.  Reading this I falsely concluded
> that the 32 bit counter of a V4 signature might overflow and thus added
> 
>   The four-octet big-endian number is considered to be an unsigned
>   integer modulo 2^32.
> 
> to the V4 signature desciption.  Obviously we both missed that a 32 bit
> counter is sufficient for a a max of 2*2^16+something octets.

Yes, I think I overlooked that. The goal was to avoid using a four-octet
length for the length of the actual data in a binary or text document
signature, but I misread and didn't realize that this is the length of
the signature packet, not the length of the data to be signed.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204