Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp526151lqt; Mon, 18 Mar 2024 15:25:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpHmkmmwZLIghTVEfgd0ZOvQiIAe9XFvgOfck8EczhpRpKWvm+DVYes2IduOdSoVHFlBli3Y9Lyr34cOSFKRjqDD7aXM+GmrrPPEHmcA== X-Google-Smtp-Source: AGHT+IF2RN2heW2bCo7Q68jT5Ox/TcVZYdTdtwK7A/Xnb8cMk/HgT6OpnVNoKgNvZHOaEvEveu5F X-Received: by 2002:ac8:60da:0:b0:430:92b4:288a with SMTP id i26-20020ac860da000000b0043092b4288amr1823276qtm.20.1710800733465; Mon, 18 Mar 2024 15:25:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710800733; cv=pass; d=google.com; s=arc-20160816; b=vCFizQc6+YaodwOh2VmAQoXdZcXYvnG+ejh8LExHJggAS6CEZ6ZBC/QDyiSbOZYfu0 63G6fYrtXgzAOTUmre68XdqaDbG9CRmFsVhLOnF9PFok6nLnlRWHRP3mub3PK3ktJrSj +2/kDQUHS5UMWmEUzOAcFCDvn8N1ItW64vJOHnC34lAB/xfd5KU4aCudyxGBvtP5bfu3 gPezRWCE9Z0OPKE2CTVOHYkLRMvpC8z+2jREmxG24K9QYif9ILoT0MaxVDwVkb9T+hNs 3c78ONW4I25r2FEmKD0vQX+5OyvbZZKya/T/PHdfqtcyEHjv8zXaF7vmct83lJ2ZIxgH rD+A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=7m+lBkkWOh2R+llyjfx7DpL6d0DNGPhOePy3x03ev3Q=; fh=GVfuQURdF5ZJVjlkDIOF//FZJA5UX6Q2PffM3pU/h+w=; b=Fd6Ytw7IX6tjNMJsNRXKojZJ8OJsPfphzVKbDYUh5UuTCWjROzjrjUtKaJVpqXxl1/ ksHNXJ+Vf7EeF3OPvlLFGTANuqnW0PtmwrhUDaYoz8hGnCboFiQeuzzoIWQWggSqvjU4 Us3G7EnPeLzuw8iMJYqbf7GfUMtQowkdehc06iDS2fa3HxOk/Vz/gd/s3LhKcZoGveaA boYXX0YYAhngg/SFtLHXSmmc8u8hQFL3Dzyn/Us5ahV8m1xl4B53PH07yY2osojGOOSh g+2sv5MXAlx3YVyvpp23WjqkguPi/RMj2GVrs7D9BHCWHXld0M8s0pVawSCn9TfFtQih 8Ijg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eZgEJQB3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 e12-20020ac8598c000000b00430b178b6e2si7746157qte.88.2024.03.18.15.25.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 15:25:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2732-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=eZgEJQB3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2732-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2732-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 32EB71C21688 for ; Mon, 18 Mar 2024 22:25:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E142959B79; Mon, 18 Mar 2024 22:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eZgEJQB3" X-Original-To: linux-crypto@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 93AD758AC7; Mon, 18 Mar 2024 22:25:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710800726; cv=none; b=rNqh0ailXuNPHZhMWh4joloVf5aEJwXhy8iU0uztwSoIGhJshnCFjHPqcydK/hKaqavh0a1+Uuy6OoizGBSAR9u68V9UIx25qNRgV5XAjugxhY84/59+QR4t7kN/1RbvlkrybdPOCUi9KtBpBZGznwW3wqNrUTJoFcfBicdU/EE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710800726; c=relaxed/simple; bh=itttylFttcbiCbzFFglP/gxOduvNaaoCGRLHiPfLiJg=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=VstuSM5o/boek1rBVAwGyqFH0pATuTP5xO/kW2qftlbk+Y02VbERH3tVlqriqJIn80Ak42brMmWH1VgnORhTXDutDHKOYfPkm7pBq8JRb8etxNgV+CFhudoJccBtlBRqQK6VnsYlbaMCq9MdCrfJ8gETPUELDPasn/kT+Y3W+1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eZgEJQB3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19360C433C7; Mon, 18 Mar 2024 22:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710800726; bh=itttylFttcbiCbzFFglP/gxOduvNaaoCGRLHiPfLiJg=; h=Date:Cc:Subject:From:To:References:In-Reply-To:From; b=eZgEJQB3Me3KvgDGLbPzkNSX7QZd7wuYGp/4rkVev4ls2tTomPc0MUNgWZwAVMuzT xASDqm32pOIVx8gVOTtYpWIyeukaNOM3MjOGwSrCJtxXrc80828Abuur7sbL5jTfLn PtFQPK3Ot46N0CrSKOFlWcyW4g+yJzhqDyR5fyBIO2iQrstrCNWkOK1+88Ym+e34hi aGzdRljQhZJgp3eMhH7ClWpjcphictD4T6eU0tldas0tEOIwuyJRv2K1Mh/rOmFVYS XjuV720pI8JA2maLIgV5GlbNPlw70zNulpOMF78BpIAUQ8WNMfu+0GXNUl1XXS+304 08sYaJ00kt7Hg== Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 19 Mar 2024 00:25:22 +0200 Message-Id: Cc: "Stefan Berger" , , , , , , , , "Stefan Berger" Subject: Re: [PATCH v6 03/13] crypto: ecdsa - Adjust tests on length of key parameters From: "Jarkko Sakkinen" To: "Lukas Wunner" X-Mailer: aerc 0.15.2 References: <20240312183618.1211745-1-stefanb@linux.vnet.ibm.com> <20240312183618.1211745-4-stefanb@linux.vnet.ibm.com> In-Reply-To: On Mon Mar 18, 2024 at 10:32 PM EET, Lukas Wunner wrote: > 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 th= e > > > 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 ea= ch > > > coordinate fits into an array of 'ndigits' digits. Mathematical tests= on > > > the key's parameters are then done in ecc_is_pubkey_valid_full reject= ing > > > invalid keys. > > > > > > The change is necessary since NIST P521 keys do not have keys with > > > coordinates that each fully require 'full' digits (=3D u64), unlike > > > NIST P192/256/384 that all require multiple 'full' digits. > >=20 > > This sentence is not really comprehendable English sentence. Can you > > just write the rationale in understandable form? > >=20 > > "fully require full digits (=3D 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, P25= 6 > and P384 all u64 in the sequence are used to their full extent because th= e > key size is divisable by 64. That's not the case for P521, where the mos= t > significant u64 is not fully used (only 2 out of 8 bytes are used). This would be a great extension to the current commit message. My point here is that: 1. I obviously acknowledge that not all math etc. related to a crypto standard can be explained in a commit message. 2. That said, they should be more verbose than usualy commit messages to be as easy to follow as possible, given the complexity of topic. Here the topic is fairly complex but most of commit messages are written without much focus on the background story. In this type of patch set even having some redundancy in the commit messages is favorable so that they are as easy to understand as possible. Actually just as code changes they are quite simple but why they are made is the complex topic, which means that commit messages are even more important. This motivation comes from e.g. when these need to be backtracked at some point when bisecting a bug and whatnot. > Thanks, > > Lukas BR, Jarkko