Message ID | 20240301022007.344948-9-stefanb@linux.ibm.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2097:b0:108:e6aa:91d0 with SMTP id gs23csp813239dyb; Thu, 29 Feb 2024 18:22:29 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVSzIxe+a3Un+a1u4E8H9WQtuiDyk97bDxqxyoEjtwWyA36KSWeczB7V2chvTWN138J0DMB0WDBDnLtufzV/0NDA0WrsA== X-Google-Smtp-Source: AGHT+IFaY+YI5uVJmDnOmgjiiGxuZvAJhd7uW2+uQ+XSXyDSDDHkuP+vO4NUzzo4hXNOyEBMsOue X-Received: by 2002:a17:906:d045:b0:a44:46a:def8 with SMTP id bo5-20020a170906d04500b00a44046adef8mr227420ejb.43.1709259749154; Thu, 29 Feb 2024 18:22:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709259749; cv=pass; d=google.com; s=arc-20160816; b=dkM1w+G7esTWttVZTtrlrLYMqJS1Jv374zAWOBxtU0hmcRyg6OCuBypUn2FpPtGLMJ lBfAZgz2PM0Y0SoXw81oB4oXWqjx0ulw4eW6mewrGPWmGmm4p8Y7+9M7r0RzMzcj/yIh oXkZV2ZUIlugnwhic/vruF18Bwo3nzt/E16XHgk3AJ2QBqRHwDeWauTRcJ1ydlP5wzTm tQMSfccAGuxddxIlTWqFp6LQWlmsqk/7EqKThVnwb5eHRL8OdsGrphDqJn9P30UaBx+I oXVPDmuVKXfSO++LwJ6i0gmtZKDl6+fCth/EVjnaWuKwvsCscqFg8fLaCNCR0L1b/Xld 1bkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=27VVBnEU1E8thdxFnYmmqecPL6rgHzlExygOikrUXI0=; fh=rcM6ok5GFu5IIT2QdH7dFGIfgvD+dlFEBXZav0jM/0I=; b=b7XPich+F5ZZ/k/hT3WJLrpnfYR2SjG6oWSSewDaaxpFEse7sVbx62VI5VQZ22sWvY DQI0MRck+zITZ4lKrIr6howxPShDa/UBNxNBEkRSL6DqtEzCpOiobFeHph5SpRAYqa79 8RH5rZ5HyTd5YZXaxlWUPHDtuiB2UL3ROM9Vs1ukrnecrCoz+hbPzKdW7hvbc19RFS74 7uWf3qFJKP0bJftJGBufXurt0Ko8QlBTtZrMzvE5iWgqnzyjO+TCWUdAjWQ7QfhgyGGx wC8qsoQvcE0zDRupQmBr0Q2x9ZduBZORW8Pm8sea4/JUePXkGCwVLeuk8T31B9akCu2q sf7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LHOk6LWR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q15-20020a170906b28f00b00a4437eda9c8si1085219ejz.456.2024.02.29.18.22.28 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 18:22:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LHOk6LWR; arc=pass (i=1 spf=pass spfdomain=linux.ibm.com dkim=pass dkdomain=ibm.com dmarc=pass fromdomain=linux.ibm.com); spf=pass (google.com: domain of linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-87826-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com 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 C71BF1F25192 for <ouuuleilei@gmail.com>; Fri, 1 Mar 2024 02:21:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 450273CF40; Fri, 1 Mar 2024 02:20:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="LHOk6LWR" Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 9F2E73A8CA; Fri, 1 Mar 2024 02:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709259623; cv=none; b=tG7SdHhtgK662qkuS+9Dgu/rxWhd8tXH8tQTc8RL9hWIl5YQ9it59mJFguQ+9PjhDXCoqOuLnEI3bEeiZGNJpdA/eYBIl7HCFmMRHr8YpWG6TcPFBwF5L0rnLdfvCSBFehCjj+70f5t/D2etd6iRZpAYJotjHNdeQDy+tN6Fb3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709259623; c=relaxed/simple; bh=OQYsXMHfGUAo+fgcBXpX5tzkjfHQI2L/enzJKf9t+JM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TFlwIyC8+IHnLmSHKR5QfhzB5u6KHFwnZ0Ot/Cq3Eqj7ANqIzjGXSyMVHQFf7obFyWHywQf684WlqqzuvGPxIEYinuHBYsERJC0ULSAXx3iVVKmDrVZgg9ZgExg06S9yfNmKB+aZc2J2OwyAzLLnfMAeqD3RcXhL6q2feaEPIb8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=LHOk6LWR; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 4212HcDd017810; Fri, 1 Mar 2024 02:20:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=27VVBnEU1E8thdxFnYmmqecPL6rgHzlExygOikrUXI0=; b=LHOk6LWROyWLTDmb+tyQbe7VOlG0iAAm1o/go2ZyKj/yZCH/rPoVictK12zbps2sLprz +4ZTVU1tZa4O9U5GMHjLQYW9VrbZCF4lGbdjFLVLzUUs5zv4HwQJ60aIZD8JcBdXH4or GSQQsc+Osjsqvf4ueo9Bwz5PXEhsVXtsa6IQmxiz4MA6ir1BelIG/r5MEDKqBjDgaKtZ xBjwZtoGah/6zCj45tjDj9NgFdBekgojdLTYmD4RVGRrTcCSYyXlH1SXpS1R5p7skGFQ IhnouWlTG2kjBeXarXNZUhYlrIm+6UZEWH5QwSGB65Lse6JmWkVFhuxtWCwVHULGyLs5 ng== Received: from ppma11.dal12v.mail.ibm.com (db.9e.1632.ip4.static.sl-reverse.com [50.22.158.219]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wk63rg1wr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 02:20:17 +0000 Received: from pps.filterd (ppma11.dal12v.mail.ibm.com [127.0.0.1]) by ppma11.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41TNofni012328; Fri, 1 Mar 2024 02:20:16 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([172.16.1.5]) by ppma11.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wfwg2s516-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 02:20:16 +0000 Received: from smtpav05.dal12v.mail.ibm.com (smtpav05.dal12v.mail.ibm.com [10.241.53.104]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4212KEk440829434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Mar 2024 02:20:16 GMT Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3BF015806A; Fri, 1 Mar 2024 02:20:14 +0000 (GMT) Received: from smtpav05.dal12v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B15E158068; Fri, 1 Mar 2024 02:20:13 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by smtpav05.dal12v.mail.ibm.com (Postfix) with ESMTP; Fri, 1 Mar 2024 02:20:13 +0000 (GMT) From: Stefan Berger <stefanb@linux.ibm.com> To: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net Cc: linux-kernel@vger.kernel.org, saulo.alessandre@tse.jus.br, lukas@wunner.de, Stefan Berger <stefanb@linux.ibm.com> Subject: [PATCH v4 08/12] crypto: ecdsa - Replace ndigits with nbits where precision is needed Date: Thu, 29 Feb 2024 21:20:03 -0500 Message-ID: <20240301022007.344948-9-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240301022007.344948-1-stefanb@linux.ibm.com> References: <20240301022007.344948-1-stefanb@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: fLuyKHa3H_VNKPiPdDDJtbv0Jtbqd8i4 X-Proofpoint-ORIG-GUID: fLuyKHa3H_VNKPiPdDDJtbv0Jtbqd8i4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-29_08,2024-02-29_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 spamscore=0 clxscore=1015 malwarescore=0 impostorscore=0 mlxscore=0 suspectscore=0 lowpriorityscore=0 mlxlogscore=999 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010018 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792288750467541122 X-GMAIL-MSGID: 1792288750467541122 |
Series |
Add support for NIST P521 to ecdsa
|
|
Commit Message
Stefan Berger
March 1, 2024, 2:20 a.m. UTC
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.
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
---
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_akcipher *tfm) { struct ecc_ctx *ctx = akcipher_tfm_ctx(tfm); - return ctx->pub_key.ndigits << ECC_DIGITS_TO_BYTES_SHIFT; + return DIV_ROUND_UP(ctx->curve->nbits, 8); } static int ecdsa_nist_p384_init_tfm(struct crypto_akcipher *tfm)