Received: by 2002:a05:7208:13ce:b0:7f:395a:35b6 with SMTP id r14csp363177rbe; Thu, 29 Feb 2024 01:34:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXZk+so+kBbn+yBwFzhZ29sOHlp62l9p8zNYdarbY0a5eFs5ioBq7UV+lmGho2F+qE3pgrskUWX6XKIOiy2b/SqOLo3VcV5QWpogUvZLg== X-Google-Smtp-Source: AGHT+IFbr5rz9QVXxrvCyLEXAMXDVB3CNZKQkZswX82LsSMlXDiy+8C1FVKn4SgibzWjmhFBz7NE X-Received: by 2002:a17:906:f8c8:b0:a44:1f23:5d08 with SMTP id lh8-20020a170906f8c800b00a441f235d08mr1017447ejb.15.1709199288671; Thu, 29 Feb 2024 01:34:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709199288; cv=pass; d=google.com; s=arc-20160816; b=MNl2K3BrELCBS8ZoWNfhq8/OV7XqDgth1+bUEbAAmsJCF0i70FmuRGvxWV+JTM6LML PuzM2gz8QBerotGMkglQd85SegNCoIOO++QkJaxfTqLpiQ0c0xFi8cXEq6OhnOfhQAs7 8rqjNX6hTObXkZZ2pG/jiHFE3n8wzIcGa2v83XVTJQzmNKtDohFfwWQxp+dI6HLxwGH8 +T2rrePGa7C50ENueTo1xs1hGRTlF360YOfX/jvgV8Unq7ieYHB1b5ZIZJu9T1DhT9t8 MvHAARHcNii2a7Xz0y5MoeAcasknEp6RTpfZmPR6soN0sePtbjOrBNHNrhTLozVhwHHu WzSA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=2u2r3OCrhFiO5A4yicuQC5YJzLs1JB3PIXU4smKzMI4=; fh=/w08LdzNt1kNSwWwCVqhlqp7XWsG8pryXQF7MxR0bbE=; b=RtHBj1u5h+gJAkB7LsrUDwhFOG2FZzJonmrRqwFnZRabfbpilPzi3l8udwfd5zEjrr pxmku2/GVlRHNPGCwkXi698upe4bk4yZs+9uXN3E+nMwcb2Kw/ebxjb41fLPFYDUX3b+ 88zsI4abcjbp/wJoBlbK+VLhe1dqLmYkw+SLQq7OiR2mtM3QvbEAQR+TkQCTxQy73OjM h/Y5qhOA2yWFeQuEFbl8rQDJJk3/8uOfpO1CThUOz3JHL6d0cv4m4KAsRB+uTDfPr01V TZFo8unMDpVMq64F7xZYBctVtH+YL1EEjjLmK3R2CI+zfw0yOQ8oqeuFpAn9BiU4FaAH z/jQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2387-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id q4-20020a1709060e4400b00a4306abc23bsi417775eji.895.2024.02.29.01.34.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 01:34:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2387-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2387-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 70C721F25069 for ; Thu, 29 Feb 2024 09:34:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 11D915DF0A; Thu, 29 Feb 2024 09:34:25 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from bmailout2.hostsharing.net (bmailout2.hostsharing.net [83.223.78.240]) (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 10C765D91B; Thu, 29 Feb 2024 09:34:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.78.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709199264; cv=none; b=H8GLn/TR/wDOyN6r7MU9E8wD/gkErSI19ZIswF9T5893r08I9MYZmuk0sb79bIMr/DdRNFp1VVWnP7L4lpeyHTckO4J3oRLryuVlFDQnXf+o5blXjyFDT7zoVpE8/bmqKy8G63oX0Es4h16yH81Fyg9GLv0WlYdDLSDITG0KLvk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709199264; c=relaxed/simple; bh=AIypsgqbCFGVRElhXEqL4dlDKOmK1OT1uzTwp7CIJHg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B/H5QPT2jakk3kkQ22LItn7COFF8BHYHDr6Fnv7SyEVFL1h8Rj7kHZWcFMFBANeqBsVT7faSYxoluxwzQOeek4+Ox37KT7ljANNpNqrel8EZ2On1k8pxevwbSZeK1Iswx8GYW3TChLv1Im5VdkDG4Uw3TCUyDuwSqE7+gk2Cgqg= 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=83.223.78.240 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 bmailout2.hostsharing.net (Postfix) with ESMTPS id C45012800BB90; Thu, 29 Feb 2024 10:34:19 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B787513B544; Thu, 29 Feb 2024 10:34:19 +0100 (CET) Date: Thu, 29 Feb 2024 10:34:19 +0100 From: Lukas Wunner To: Stefan Berger Cc: 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 Subject: Re: [PATCH v3 00/10] Add support for NIST P521 to ecdsa Message-ID: <20240229093419.GA32424@wunner.de> References: <20240223204149.4055630-1-stefanb@linux.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: <20240223204149.4055630-1-stefanb@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Fri, Feb 23, 2024 at 03:41:39PM -0500, Stefan Berger wrote: > This series adds support for the NIST P521 curve to the ecdsa module. > > An issue with the current code in ecdsa is that it assumes that input > arrays providing key coordinates for example, are arrays of digits > (a 'digit' is a 'u64'). This works well for all currently supported > curves, such as NIST P192/256/384, but does not work for NIST P521 where > coordinates are 8 digits + 2 bytes long. So some of the changes deal with > converting byte arrays to digits and adjusting tests on input byte > array lengths to tolerate arrays not providing multiples of 8 bytes. Don't you also need to amend software_key_query()? In the "issig" case, it calculates len = crypto_sig_maxsize(sig), which is 72 bytes for P521, then further below calculates "info->max_sig_size = 2 * (len + 3) + 2;" I believe the ASN.1 encoded integers are just 66 bytes instead of 72, so info->max_sig_size is 6 bytes too large. Am I missing something? Thanks, Lukas