Re: [openpgp] Review of crypto-refresh 07
Falko Strenzke <falko.strenzke@mtg.de> Thu, 17 November 2022 12:57 UTC
Return-Path: <falko.strenzke@mtg.de>
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 7064EC14F73E for <openpgp@ietfa.amsl.com>; Thu, 17 Nov 2022 04:57:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -7.096
X-Spam-Level:
X-Spam-Status: No, score=-7.096 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, HTML_MESSAGE=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_HI=-5, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, 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=mtg.de
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 57OCxNBt1GE3 for <openpgp@ietfa.amsl.com>; Thu, 17 Nov 2022 04:57:12 -0800 (PST)
Received: from www.mtg.de (www.mtg.de [IPv6:2a02:b98:8:2::2]) (using TLSv1.3 with cipher TLS_CHACHA20_POLY1305_SHA256 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 2557BC14F719 for <openpgp@ietf.org>; Thu, 17 Nov 2022 04:57:10 -0800 (PST)
Received: from minka.mtg.de (minka [IPv6:2a02:b98:8:1:0:0:0:9]) by www.mtg.de (8.17.1/8.17.1) with ESMTPS id 2AHCv5Ts004438 (version=TLSv1.3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256 verify=NOT); Thu, 17 Nov 2022 13:57:05 +0100
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mtg.de; s=mail201801; t=1668689825; bh=A2bI504thfvTPa9Yxo7Cxqsw8pVWtP6R4p6+TWjD7IA=; h=Date:Subject:To:References:From:In-Reply-To; b=lVbhhPjpkQvr7LC4eyjiZWn7gI+BL5PhFMP0+XKdEQcLo6kGIKua2nb47nKzOFSWK SKJjF0f50wXLgtuwEmndObaKaOfK91KthhFNaPt4YM2ucgL0WJBDZQYKdwq2hjSJse kU4ITJLL6PLC9OTfUmun6Xe7+SFZNJQc47mr3R9Chtw1OhRgIvDgH5PsezXehD+5wC M+5wQ8rUQLTd4jjdTgrzXGi7NllUyfk/vl/0vct0H8cOaTGOAAU8OkKBTTZpW1HULm okLsMCObRghNFBOxJuS25+hsY4BM1xuCHFFf0Mz5E2cjpoOxZFe/hdtnExKZfV26k1 xYO1A3HU3TXiw==
Received: from [10.8.0.100] (vpn-10-8-0-100 [10.8.0.100]) by minka.mtg.de (8.17.1/8.17.1) with ESMTPS id 2AHCv4ow013033 (version=TLSv1.3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256 verify=NOT); Thu, 17 Nov 2022 13:57:04 +0100
Message-ID: <9d49e51a-e59f-657d-5630-a8b6c34fddc9@mtg.de>
Date: Thu, 17 Nov 2022 13:57:04 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0
Content-Language: de-DE, en-GB
To: Andrey Jivsov <openpgp@brainhub.org>, openpgp@ietf.org
References: <9901f3c9-7944-e8a0-d2e5-a0aced7cbc3b@mtg.de> <CAAWw3RjhdOqrGxUv8EQBVMSTawYPHt9UO=of1fi52M2qE8TiFw@mail.gmail.com>
From: Falko Strenzke <falko.strenzke@mtg.de>
In-Reply-To: <CAAWw3RjhdOqrGxUv8EQBVMSTawYPHt9UO=of1fi52M2qE8TiFw@mail.gmail.com>
Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg="sha-512"; boundary="------------ms090407090001020900040304"
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/O2RTi0hwp3tIw_MWP6j_X-PBM34>
Subject: Re: [openpgp] Review of crypto-refresh 07
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: Thu, 17 Nov 2022 12:57:17 -0000
Hi Andrey, I tend to recommend not to specify the tweaks you propose or any other tweak to handle curves with this property, even though this would not be per se a security problem. The problems that I see are: - enhanced complexity for implementations - need for test vectors for this special case - possibly increased difficulty for OpenPGP-based products to pass security validations Further, I want to argue that the curves that are affected by this error are mostly irrelevant to OpenPGP: - The curves that I listed are the only ones with this property that I am aware of. Koblitz curves are generally hardly ever used, and the random 160-bit curves can only be used for lightweight authentication. - Probably new curves with this property could be created, if they follow the "prime = sparse linear combination of powers of two" paradigm, as the SECP curves do. But it seems no one has done this for a long time, and I would not expect anyone will do this in the future. On this background it suffices in my opinion to require implementations to gracefully reject these curves. However, that pertains only to key generation, since, as far as I can see, the stored private key is the only scalar that is affected. So it could be specified that 1. an implementation MUST NOT create keys for curves where the base point order is represented in one more octet than p. 2. an implementation SHOULD perform all other operations with such curves. The second point means that if an implementation ignores the first point using one of the methods you propose or it receives a private from elsewhere, it will still be interoperable with other implementations that only need to perform the public operation with that curve. Regarding the second point it could still be discussed if performing private operations should also be forbidden. Does that make sense? - Falko Am 17.11.22 um 01:55 schrieb Andrey Jivsov: > > ## 9.2. ECC Curves for OpenPGP > > > The "Field Size (fsize)" column represents the field size of the > group in number of octets, rounded up, such that [...] or scalars > [...] for the curve can be represented in that many octets. > > The assumption that a scalar, i.e. a group element, always fits > into an array long enough to hold a field element, is not correct: > according to Hasse's theorem for Weierstraß GF( p ) curves, we > find for the base point order N > > N ≤ p + 2 √p + 1 > > Thus, depending on the curve, scalars such as the private key can > be one bit longer than the field size, and thus also need one more > octet. secp160k1, secp160r1, secp160r2, and secp224k1 are examples > of a domain parameter sets where the representation of N needs one > more octet than p. > I do not think that there is a need (or desire) to correct the > OpenPGP specification in this point. I would not expect that the > need arises to support any new elliptic curves, and the ones > listed above most likely are not desired to be supported at all. > But I think a note should be given in the quoted section (or > another appropriate place) regarding this restriction, as an > OpenPGP implementation may behave undefined when attempting to use > it with any of the curves listed above (in an extension > implementation of any kind). Implementations should be prepared to > reject curves with this property for security reasons. > > > The probability to hit this condition is at most 2^-80 for these new > curves. > > When this condition is known to occur, the key's security strength is > only 40 bits. In general, we don't need to special-case odd key > values, as they are expected to be within the key space. > > However, in this case there will need to be special processing due to > the overflow into the next 64-bit word (or a byte at least). This may > result in a side channel information, either due to time needed to > process this new condition, new code path, or even the key size on disk. > > For these reasons I think the best fix for this is to treat the > overflow of private value over log2(p) bits as an error. If detected, > the key should be regenerated. > > This error is an unfortunate side effect of supporting new ECC > curves. However, the error handling can be hidden inside the key > generation routine with e.g. a maximum loop count over key generation > fixed at 2. Specifically, if we detect this condition, generate again, > and if this fails, return a key generation error to the higher level. > > -- *MTG AG* Dr. Falko Strenzke Executive System Architect Phone: +49 6151 8000 24 E-Mail: falko.strenzke@mtg.de Web: mtg.de <https://www.mtg.de> *MTG Exhibitions 2022 – Let´s meet again!* ------------------------------------------------------------------------ <https://www.itsa365.de/de-de/companies/m/mtg-ag> 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>
- [openpgp] Review of crypto-refresh 07 Falko Strenzke
- Re: [openpgp] Review of crypto-refresh 07 Paul Wouters
- Re: [openpgp] Review of crypto-refresh 07 Andrey Jivsov
- Re: [openpgp] Review of crypto-refresh 07 Falko Strenzke
- Re: [openpgp] Review of crypto-refresh 07 Falko Strenzke
- Re: [openpgp] Review of crypto-refresh 07 Andrey Jivsov
- Re: [openpgp] Review of crypto-refresh 07 Falko Strenzke