Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp87097rbb; Fri, 23 Feb 2024 12:43:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKBkz4+XIyGqt1KbJG0lbHdYRnOZxXgSwslcwaYwxt0OEAsWpRZAQISV0S4F8DUwvDDXXKfKgSmZIsUYvw6lPOQ06t/+yalzUvYVy4RA== X-Google-Smtp-Source: AGHT+IHBXlUw8vavJUAeon2JjkQId1MWCu7wCvt8xopQYe/s1fkiFHIhGF7rf1viMPi5exgLONzy X-Received: by 2002:a17:906:a98:b0:a3e:5c67:2883 with SMTP id y24-20020a1709060a9800b00a3e5c672883mr874938ejf.22.1708721003128; Fri, 23 Feb 2024 12:43:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708721003; cv=pass; d=google.com; s=arc-20160816; b=wu+/S5jD7SG3W6SIQaI6IAiSrgh+T9wBXVuwKc/x6WWr1bodOgx/qXoBMbe0Rd8Hc9 nXZRape4OK7HIR7E0zLiYSA/TKsPxEwSZrDYY47/q6f92fBTZewGfownNeyq9+5KQUfN 6Qsuh26m6PGuaQ6Olpc6D71YMKYRiuUsqUsKPfXtlruZvSK9RKGXxF4pCvKQslFKaFnq wZxdyZ1SnC0++bMPlgueZd6CiOovDFGV5t6QelB+PCSeHaIaKtKieIX5XMIKUa6Idrim HblS9i06uT7/KXqh+jpZXsx4K/KMUAmCtwKvHDLTTWHFvufmr3oC2Vm7qJSWf8uJ4LJV dZ5w== 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=ih8H+9rSJovCi3/ukRlt9OvwFu3iw9Ty9KcWfNmJnpw=; fh=nKmjVxPwCa773nyq5JxrCa37ZALdOpLJMBES7dZaGuw=; b=hr5H5GYq+xghwWIq/rZVmCE7/IVwR14AkfqGgsrxS+h2YmlLe5nFw/Tt/AbFWfQ0+2 t/QbjenUXzlK4FM1GIbGMPlT7MxWTH0DEX0aCLfiygYygWN6mZm2PgBMZ3Cwy3B/w7UH sVOOf/rzjnsn0TMz0bDS5yS/0tOg/JVAz9Fzdit0Y9ZlVERjoI8MgTcO1PIsq8I+U1sv 2MGvX+32pp+fh2yLGxSwNxlZmk1kAyTcfv0+dsVtEoZEVnhNUbTputspyjsdRpElaan3 MWMFrtyZSNYWU+XoqARXK3jN2kCorGgp9PClqKqSyWgvjREXXFzDGfd/kDh12hfHYOrn bfpg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ImoeRBpk; 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-crypto+bounces-2289-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2289-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ga39-20020a1709070c2700b00a3eef1eb74bsi3896486ejc.1012.2024.02.23.12.43.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:43:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2289-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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=ImoeRBpk; 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-crypto+bounces-2289-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2289-linux.lists.archive=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 BA1881F21B2D for ; Fri, 23 Feb 2024 20:43:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 85B4014D43B; Fri, 23 Feb 2024 20:42:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="ImoeRBpk" X-Original-To: linux-crypto@vger.kernel.org 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 C06DE14CAA6; Fri, 23 Feb 2024 20:42:16 +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=1708720938; cv=none; b=PWzbKNpUfJZYl3SFDQG/xeOGhZutGyBP+6eEXQsrtAx/eIzN3UJ+e5i60JN8KPGdjDW9o67Qv83Q6Rw5xGcpgLiu0Zq0UWqC8/WBDDXLIvJyeTSS6+Wcv805fkuOmMSfQD7+c8qpHJptLVQZAlOvQi3DRLznESiogHpUSmvqaNo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708720938; c=relaxed/simple; bh=Q3P/xX5ulSDqYkwQhOykf8ynjRUvhz+oYuiqRNE6Y9A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=prvJVL+vui/2aBNdVeuJwAWF3SVTXoDqN2AqQbzlbb5EeXl2qbVQP3VhFKzwdYqgDPZGVlPT+/b55IMZZsT3/T1QLS9HAJKOYibFWsaztOOZ5oPH4ofV77ik16ur08nQVCfDHhZUszUAlHe7d1gqT+8ncsTVBFnTiZeolp65h3Y= 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=ImoeRBpk; 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 (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 41NK1Wmq010645; Fri, 23 Feb 2024 20:42:10 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=ih8H+9rSJovCi3/ukRlt9OvwFu3iw9Ty9KcWfNmJnpw=; b=ImoeRBpk3e4kRjFUSIQ7jUEFigyDL87ySKOCJ9rzCaZCGStF827yVlhlBg/7XyE/aUfm q/WO1s5iKtupE5CzOP3mBp9651urmM/CQO/6gAPYus5BHUWnWTLxncCNwPyL7OeG8yt/ QdkgF5KtlW8I6/S2V+cRLK0PQ2TEy5bsMdP6/82/xKkBsOS1yED5ZBO6xoNjw3QnUu7D fp7yrsV2tXDCMeMuLvibeVqI0q8sZYBOJeAx/mroY+JqF02JK5P0d5HECGpWZIsJpVGg nYUIZnQmj5YpZffOlq8pkz+NO91Sd/Je2FbjMQ4gygGYiFsKE0mOnOPLibaNBY2ZZVku Yg== Received: from ppma12.dal12v.mail.ibm.com (dc.9e.1632.ip4.static.sl-reverse.com [50.22.158.220]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wf1rssdhh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 20:42:10 +0000 Received: from pps.filterd (ppma12.dal12v.mail.ibm.com [127.0.0.1]) by ppma12.dal12v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 41NIUiBA003671; Fri, 23 Feb 2024 20:42:09 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3wb74u8bc8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 23 Feb 2024 20:42:09 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 41NKg65J22545048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 23 Feb 2024 20:42:09 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9C54758059; Fri, 23 Feb 2024 20:42:06 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DAA7A58058; Fri, 23 Feb 2024 20:42:05 +0000 (GMT) Received: from sbct-3.pok.ibm.com (unknown [9.47.158.153]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 23 Feb 2024 20:42:05 +0000 (GMT) From: Stefan Berger 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, Stefan Berger Subject: [PATCH v3 05/10] crypto: ecc - Add nbits field to ecc_curve structure Date: Fri, 23 Feb 2024 15:41:44 -0500 Message-ID: <20240223204149.4055630-6-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240223204149.4055630-1-stefanb@linux.ibm.com> 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-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: QVYOUD45-EKmdIUN3ldLtCStONgxabdI X-Proofpoint-ORIG-GUID: QVYOUD45-EKmdIUN3ldLtCStONgxabdI 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-23_06,2024-02-23_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 malwarescore=0 suspectscore=0 bulkscore=0 adultscore=0 impostorscore=0 spamscore=0 phishscore=0 mlxlogscore=999 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2402230152 Add the number of bits a curve has to the ecc_curve definition. This field only needs to be set for curves that don't fill up all bytes in their digits, such as NIST P521 which has only 9 bits in the most significant digit. This field will be used to determine the number of bytes a curve requires for its key coordinates for example. Signed-off-by: Stefan Berger --- include/crypto/ecc_curve.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/crypto/ecc_curve.h b/include/crypto/ecc_curve.h index 70964781eb68..337a44956926 100644 --- a/include/crypto/ecc_curve.h +++ b/include/crypto/ecc_curve.h @@ -23,6 +23,8 @@ struct ecc_point { * struct ecc_curve - definition of elliptic curve * * @name: Short name of the curve. + * @nbits: Curves that do not use all bits in their ndigits must specify + * their number of bits here, otherwise can leave at 0. * @g: Generator point of the curve. * @p: Prime number, if Barrett's reduction is used for this curve * pre-calculated value 'mu' is appended to the @p after ndigits. @@ -34,6 +36,7 @@ struct ecc_point { */ struct ecc_curve { char *name; + unsigned int nbits; struct ecc_point g; u64 *p; u64 *n; -- 2.43.0