Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp493779lqt; Mon, 18 Mar 2024 14:06:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWthu/h2g1UkIv1Zm4FwwhbK/WDmt0IOLPRFHWBWueQUkYxLRSFgD890gL1KU3Q3lbezw6H8YVJ0L2thqJx+lWGQE82uuhgs8IdBY+Gvg== X-Google-Smtp-Source: AGHT+IEee/yT/oCXAWqTzUc7K1fn8TRWhlgWbQMT92FY+Xrn1i3PV9FylkolVkyo/1bwosHrjG9Y X-Received: by 2002:a05:6214:514b:b0:696:1c12:bda7 with SMTP id kh11-20020a056214514b00b006961c12bda7mr622163qvb.10.1710795991702; Mon, 18 Mar 2024 14:06:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710795991; cv=pass; d=google.com; s=arc-20160816; b=ZhlgogmORrmTNmRICjN4i9jqbnHyAysOu6OD7fCg/UdROtjQDe+8MlM2lN45hIy/fA iJ+yvMQW7LGOFJjwwISamRtkREqhPMOl6t8wvUeLxJr3VEcGXLBtM3ZvpkunU/JDI0xk RK4oYoWNOxjJmqlqWOqthloNpEPQ84Tma7K9jMcz7wGcuBEOwNjtHVHFMtEoc+mtLxvb 5jMPnHQrm18+FzweP9eLF9u2zzgJU599eiGtdgw/a0BsEfVghnN0GDVPEIUyYgUxuHRK tm0dSCgej/oAS8LmCg48kg3BDcyahO6DsvrsjNl0wnd/DivdK/GfgxCD8f/SK0XTYJNd 6uQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:references:cc:to:from:subject:message-id:date :content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=fP1chbxr78jKNA/ES7f4b/J/wtnjauTnQoIfl1erT2I=; fh=KOVYPD5Gdb4DffE2pUfDWmTzITwEg6BwIN4lRZm3tPw=; b=MMcLjq8oHN3KOprYcgwaEQ/4afeouxjkaNJx6Y6+sWp2g6gYGQua6Ljmp7cLJ2Mkfv pb7UR9ai4YqIg1s609IA+nO/z00B5km+i2VMEpu3z1bbY1R/dsjqO7iajh2EKUo2Ih9+ ynk947pV2mj+jzE2XEyQi4bwSkC7uHXfnrJ3eDJp9j5Rb6T7zTBytJCBMYxTHINbabSq Ad9xbBgLN9vgDEy7RGDYrquqUi/2LMjBMqpqOqRFF67r0pIYLek8cDeUbup6xvLwInX0 bfYIQzfPjfLO9iPQ8icYRSw0eiEU+j+PLA3r6jqBxSpCm+z01RQDQzIeGhPVj3xOAcaC NcYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=orx4i0IN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2726-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2726-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 fo14-20020ad45f0e000000b0068fc83c08a3si9143212qvb.356.2024.03.18.14.06.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 14:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2726-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=orx4i0IN; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-2726-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2726-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 678571C21353 for ; Mon, 18 Mar 2024 21:06:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 58DA65915B; Mon, 18 Mar 2024 21:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="orx4i0IN" 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 1259C59140; Mon, 18 Mar 2024 21:06: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=1710795987; cv=none; b=G+o3WUG9LY/4OqCtU2a/gbwcsaKYto7yWKiyVGokVBXgRjhxTm8A1uf5CKMrbpw/SHAzBJjigzZ0oY5lGietBXzHA+iJSTK4QHquyZYBxpfaeeuP2Cs34xm2BEFnzsU10lySmBfX9A/LxnY9wo/SNC1HedNqY1Och3iKQKfG8Ds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710795987; c=relaxed/simple; bh=pJ/CyztUdbXkkqcUV0GUIL8dyTKiysy8Ki9KKV1f3h4=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=ORIKI+8DTZ18f78xTMN89r5eQ0arvKveYNvSl7S2U1XIzr30KQu5PwikS38peQHSNbIlt05glqRtyRntKldlHI8j/sUqFREoSduDFpO7ceoma0D+wsdpn0ROEaiiTuduU8Q1MYGQCxJ3WUNvqUscmhQcmOYwYUh00+gv7PGsx1I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=orx4i0IN; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90476C433C7; Mon, 18 Mar 2024 21:06:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710795986; bh=pJ/CyztUdbXkkqcUV0GUIL8dyTKiysy8Ki9KKV1f3h4=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=orx4i0INsgRD1dta9fCM8Rgd0iyTkoL2CO8Oc29a0N5JT5BcHnX9eZusc90UvjS4I itNYVaBfV0svTRkURpxgtSMUTWUqRB15bjkCe3lOdby1WEX5b97xwB45KFaLSNyVjz syQaAvljvQWqEzxjRJeyn22TVMJc8qw6DA1EOryzZoClTw27UGGbvMiJgWseQYvgvj oawpiPL7vPWYE7Iyo6Wpk97V99pWPSy++IHFRhdWSIeQzmlgRsE/G+xBDBqmjGJQVH f4msTyrAbfeHs3yW7Hb5LpJT+iiQccFfyU+yaevOuTxwYIuNqyCBw4uliN/3IKF1vq ANtMRNVI5OCzg== 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: Mon, 18 Mar 2024 23:06:22 +0200 Message-Id: Subject: Re: [PATCH v6 09/13] crypto: ecdsa - Replace ndigits with nbits where precision is needed From: "Jarkko Sakkinen" To: "Stefan Berger" , , , , Cc: , , , , "Stefan Berger" X-Mailer: aerc 0.15.2 References: <20240312183618.1211745-1-stefanb@linux.vnet.ibm.com> <20240312183618.1211745-10-stefanb@linux.vnet.ibm.com> In-Reply-To: <20240312183618.1211745-10-stefanb@linux.vnet.ibm.com> On Tue Mar 12, 2024 at 8:36 PM EET, Stefan Berger wrote: > From: Stefan Berger > > Replace the usage of ndigits with nbits where more precise space > calculations are needed, such as in ecdsa_max_size where the length of a > coordinate is determined. What does "more precise" mean? > > Signed-off-by: Stefan Berger > Tested-by: Lukas Wunner > --- > crypto/ecdsa.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c > index 1814f009f971..4daefb40c37a 100644 > --- a/crypto/ecdsa.c > +++ b/crypto/ecdsa.c > @@ -266,7 +266,7 @@ static unsigned int ecdsa_max_size(struct crypto_akci= pher *tfm) > { > struct ecc_ctx *ctx =3D akcipher_tfm_ctx(tfm); > =20 > - return ctx->pub_key.ndigits << ECC_DIGITS_TO_BYTES_SHIFT; > + return DIV_ROUND_UP(ctx->curve->nbits, 8); > } > =20 > static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm) BR, Jarkko