Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp478880lqt; Mon, 18 Mar 2024 13:32:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUSuOtkLQASi5ouJEUR2qnQjFVJlBzo69mPmaTMzXkVxPBFZwSbKVrE2J5o3s+nQqXvnNrOVkT1BB+40YWJhI5ThgyyDCKg53gL75ou4g== X-Google-Smtp-Source: AGHT+IGRaJwN1FA6sFn5qs01Sl46HB8hg9yYD84zp2xlZlhiOB2XsbTpaF6rb2C1vdpMtH5wGno9 X-Received: by 2002:a05:6830:1be6:b0:6e6:8a4f:57fa with SMTP id k6-20020a0568301be600b006e68a4f57famr5850277otb.16.1710793939833; Mon, 18 Mar 2024 13:32:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710793939; cv=pass; d=google.com; s=arc-20160816; b=Nm7PAs0Eskt0xrAtdyaQ1n1eXwxQJrR6IceZ3L5A9ZN70IhduCMo8LUAlUKhHQ2pfl 9sdrbBfku5vC5eFDCIWE2a82aeFs0+K3Iq8sgRPYTQCV1DeHuIVebgRIpkrhZdXRe7Gd QOiBAl65KEsMZRi3oKs6dTpycRpzJ1SmN0GjQ6YkUWxPCKQQaXZQVAkKXo7FDNjRa1EB Hmt/+7Zb3yVpZVrakRm9Qdcl2D0JQXbg2L+Wrv0P+GoVin8W/fKOfFLR0TulAJsON3VP RsZRwnmgkRnWg93LMm3l6lgLE8hQ8SKo5HPMQhmy/KN1nGzARvHcMk7i6NX3rXm6KoY2 D+hQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=l8k/Z4/S4z4LzfbHPzprMsyXqN8naOkml5Va3bEqWE0=; fh=0vwKmB3dc/YcdOUZHzZlNcTuqu1xHO4YKbINgKGuSA8=; b=hraAZpQKGyg02YuEJj0Up5ltk+IjDLISObiNb7TRnHwsUrdQXw7VdwXzZdNlaJRocn OW6wCAtthsxVZkbwbWsULUgdT7lccEWWZMALk5HTdhS2Y96zJg0bN1WMESd2GiuKO4A2 x99zbPfGNIP8YwPCb/wTJhxbejo6efB4mT5/ild213/rxurHBJw4c2rKuvqegCrh93Gp H2MDXmUYF2RJUFGPab2us88h4QXByNmR5RXRSMgGWC4666FfsL/R7Ighy+5hptf4Feeh 0hrBLmTDhmu0RGBAmW9a/9Hfwx9MhprrcFbwbelISWqewtyVLPsTOHv5Qgn7ju17gNNk 9C/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2717-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id g8-20020a05620a40c800b00789ec313084si6338549qko.152.2024.03.18.13.32.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 13:32:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2717-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2717-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 441DD1C21637 for ; Mon, 18 Mar 2024 20:32:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C85992030B; Mon, 18 Mar 2024 20:32:14 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9F8E1862C; Mon, 18 Mar 2024 20:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.242.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710793934; cv=none; b=PsST1OMaReDSp3M8jPksWwRkXn/LhGNT3iAUKZ4EfBOVxi6/8FUDJX1KQ0J6+dTmS75pkDFOeHUEE8yfZxC4vql4fwC9BJaE1ynLAkSViFCTKhzx5hy0Bk2ZNwbf0OQl5T2xx0ZRDR0+Hzh8l3R/5a+hDcR0dJqlmU2ZAn5Q0P0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710793934; c=relaxed/simple; bh=vceyYmbAy7tWecXsdFzfdfLb/afM7QOoYmaWc8dBrHg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f4Bo2fo+0YBNcOPAeHFSHXHpgG45G5+EEazbh60vRJU8DOE2VDBLo03i848ILQRkw7Wye4/+/Zs/eojkxRIrz2QHTIrvU89fz2zbXTVuHyrVOL22kZOOGgtNAu/X+xcRIMHY91h75IOZp6fK439Xt8m1pnYaEkmnEEbq/bpJNn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=176.9.242.62 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id D6E12100DCEFE; Mon, 18 Mar 2024 21:32:02 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 9687F3A1A1A; Mon, 18 Mar 2024 21:32:02 +0100 (CET) Date: Mon, 18 Mar 2024 21:32:02 +0100 From: Lukas Wunner To: Jarkko Sakkinen Cc: Stefan Berger , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, linux-kernel@vger.kernel.org, saulo.alessandre@tse.jus.br, bbhushan2@marvell.com, Stefan Berger Subject: Re: [PATCH v6 03/13] crypto: ecdsa - Adjust tests on length of key parameters Message-ID: References: <20240312183618.1211745-1-stefanb@linux.vnet.ibm.com> <20240312183618.1211745-4-stefanb@linux.vnet.ibm.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Mar 18, 2024 at 10:25:26PM +0200, Jarkko Sakkinen wrote: > On Tue Mar 12, 2024 at 8:36 PM EET, Stefan Berger wrote: > > From: Stefan Berger > > > > In preparation for support of NIST P521, adjust the basic tests on the > > length of the provided key parameters to only ensure that the length of the > > x plus y coordinates parameter array is not an odd number and that each > > coordinate fits into an array of 'ndigits' digits. Mathematical tests on > > the key's parameters are then done in ecc_is_pubkey_valid_full rejecting > > invalid keys. > > > > The change is necessary since NIST P521 keys do not have keys with > > coordinates that each fully require 'full' digits (= u64), unlike > > NIST P192/256/384 that all require multiple 'full' digits. > > This sentence is not really comprehendable English sentence. Can you > just write the rationale in understandable form? > > "fully require full digits (= u64)" is something totally alien to me > tbh. It is proper English, but requires an understanding of how large integers are handled by crypto/ecdsa.c: They're a sequence of u64. For P192, P256 and P384 all u64 in the sequence are used to their full extent because the key size is divisable by 64. That's not the case for P521, where the most significant u64 is not fully used (only 2 out of 8 bytes are used). Thanks, Lukas