Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp554214lqg; Fri, 1 Mar 2024 13:20:25 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUIsPNHzcZloqEA0cywrr1aRdLY2+qSg6PjpfjG+8+xKInK5vK1CWbu49IOvZctyUHnR/RS3HDSG+CPEFs3jL39211Q5e8WLpScZoaGtA== X-Google-Smtp-Source: AGHT+IFTI7LF4TH4t3Fr5spGYjvXnymNEV/DUpjbA+eoaa4+YNxHs7uanK4bRvW5RlHBHmv2lqSu X-Received: by 2002:a17:90a:1289:b0:29a:7497:6186 with SMTP id g9-20020a17090a128900b0029a74976186mr2637318pja.13.1709328024831; Fri, 01 Mar 2024 13:20:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709328024; cv=pass; d=google.com; s=arc-20160816; b=zINBP0eoZO4dJD+xes/urGX9xu/0ydgaz9uQrbsAVkfT54csoOJAqo1cWTHSA/wT23 6GHhMycFpNb9hLFMDCF0cPrnSIEebG+QJSVXoamUxdNo7eHEDBx6tWxUG2W2tSg0sB4r 1Xu+saWMjRrD7+leIa5fZl2UnUJnov2SVUlFp0+iBz63ojw3+sa2Kn40AxscVag2q8wD FSvrrxohnj4NFxFM595TtD0Sgl8ak8BlUzSClnHEZyg9pk5sEOACN80qUB9Tuh8EG5Sr 8Pfcm3fs625vrPgyKD+YynsuYXH3UmEvbRLL0uA2dMKu/SV0rwvrWvWpsfbZMnziEwq8 1ETg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=+RMLsOnNosJmVE5b3aZfPjID67/Lvajwmqc6g347uww=; fh=rrH7wh+GU1rjLrg78kDN7CpxjoQ5/Z8EZZ3KZB2Xwv4=; b=OFIqRn2JlxhAFUFMY2g+da/fCclgTZgOKsr/YkvBK+ZUP4Nl7SUoyuSgq5KFlun8vy 7ZyEIK2rTJig6Hz1ao6EPpOyQ4qqtvCvOn5LZxOO9LwhXvgPC+vduArR8SwZEBwjBon8 e9QQNR/twXvg2jL9+gprkZFN0bMVEhp61V0k07hS4nXfUtoDk+vHdo2ok+0WUn/ubtdE mV8jWmwZUlGFw0jFRdzXW5wAdjUKUzA7g8Qu01WMacdN4NIL6Ry3LPqGoGk4aMigfQ49 iKGJbaBK7oRPoxogg2a4es6YsPkhpmBr3mUjYyueYfXlE7DMw2d7xeqEeFftWfGH33Kv awRA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SobCjazG; 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-89139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89139-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id dj15-20020a17090ad2cf00b0029a8c77e671si4522205pjb.11.2024.03.01.13.20.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 13:20:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=SobCjazG; 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-89139-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89139-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8231A28745F for ; Fri, 1 Mar 2024 21:20:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BD625733F; Fri, 1 Mar 2024 21:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="SobCjazG" Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 11EDA56B8A; Fri, 1 Mar 2024 21:20:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.156.1 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709328016; cv=none; b=fyEPJ4zD2FIvtJQOokwFP+ozRBk5ERbor0YFuWOTOj7YyUsDjcQ8YEv3EqK30VnYTpslxKDqXDDZH6VaWSOuj59lLhcnNgGg+2U0nu0ih9s9clywd12VEiNSW4aPpxvIrS1lNLjpcwTPboZwe2crUnX0brGoZAomcygwXmEKrS4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709328016; c=relaxed/simple; bh=Fp36LTyYV9kpvNDK+hVtBJ7X8DZcQYNdYOtSiayQAFI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=TNNWYK8t9lK8209oonXKBs47nsD9g0nwbvsE0gi7y94JzTfmMvm/maA2rPPzrk3VbJiKmwRShSyIO98Ly8ejqBInIx8lijayPLC4ec5VKXgWzfLiQlhEfitymahexDUld4C8VZ4HSlt94sgEis+wyz1a5y2hDma/SAyQk/3uJkQ= 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=SobCjazG; arc=none smtp.client-ip=148.163.156.1 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 (m0353727.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 421LHs9n003197; Fri, 1 Mar 2024 21:20:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=+RMLsOnNosJmVE5b3aZfPjID67/Lvajwmqc6g347uww=; b=SobCjazGG0pUI4x3HPRPyh5z9AlBLh3s6MkkBZm0vVwVYI7NPMz0WgW90v6ayP8DqAMa MQOAdZaL5JwVFXzurGEIQU9VlF0DwlvCjymfnR9+0eJn2kSrH07M3ps8HMtNAql1AJHz u5ScJdkaSxnPlyjVksSszF3z8WFTacW3UnULDwXxceUvC6ZCwPJD/Jjp3OO4wLokstST dpwVAzgoKSw1zBEqZgiDZCfOI7aamS+zA7SKE5U8hrwp+y5AmAjjhl/fLniBYjvflcPi 99iMSd8BAACl3XCatV9qr6G5ZyhVZnYRQ3ecxJ8kjp4s3EeXiysfMetwcfUUHLdH93ty gg== Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3wkpt5g1ga-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 21:20:05 +0000 Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 421K0KM7008142; Fri, 1 Mar 2024 21:20:04 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3wfv9mxxtu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 01 Mar 2024 21:20:04 +0000 Received: from smtpav01.wdc07v.mail.ibm.com (smtpav01.wdc07v.mail.ibm.com [10.39.53.228]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 421LK1w27078838 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 1 Mar 2024 21:20:04 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93F0158055; Fri, 1 Mar 2024 21:20:01 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F4F158063; Fri, 1 Mar 2024 21:20:00 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Fri, 1 Mar 2024 21:20:00 +0000 (GMT) Message-ID: <00bd9f8d-cde7-44a7-ab1a-888d8fd66cd8@linux.ibm.com> Date: Fri, 1 Mar 2024 16:20:00 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 09/12] crypto: ecdsa - Rename keylen to bufsize where necessary Content-Language: en-US To: Jarkko Sakkinen , 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 References: <20240301022007.344948-1-stefanb@linux.ibm.com> <20240301022007.344948-10-stefanb@linux.ibm.com> <90606a3c-1384-407b-8270-dd76dccc700b@linux.ibm.com> From: Stefan Berger In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: nXiz26RnlBkFlwg5vbrlGyglIK2iYYA4 X-Proofpoint-ORIG-GUID: nXiz26RnlBkFlwg5vbrlGyglIK2iYYA4 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-03-01_22,2024-03-01_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 mlxscore=0 spamscore=0 impostorscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2311290000 definitions=main-2403010177 On 3/1/24 15:50, Jarkko Sakkinen wrote: > On Fri Mar 1, 2024 at 10:47 PM EET, Stefan Berger wrote: >> >> >> On 3/1/24 15:41, Jarkko Sakkinen wrote: >>> On Fri Mar 1, 2024 at 4:20 AM EET, Stefan Berger wrote: >>>> In some cases the name keylen does not reflect the purpose of the variable >>>> anymore once NIST P521 is used but it is the size of the buffer. There- >>>> for, rename keylen to bufsize where appropriate. >>>> >>>> Signed-off-by: Stefan Berger >>>> --- >>>> crypto/ecdsa.c | 12 ++++++------ >>>> 1 file changed, 6 insertions(+), 6 deletions(-) >>>> >>>> diff --git a/crypto/ecdsa.c b/crypto/ecdsa.c >>>> index 4daefb40c37a..4e847b59622a 100644 >>>> --- a/crypto/ecdsa.c >>>> +++ b/crypto/ecdsa.c >>>> @@ -35,8 +35,8 @@ struct ecdsa_signature_ctx { >>>> static int ecdsa_get_signature_rs(u64 *dest, size_t hdrlen, unsigned char tag, >>>> const void *value, size_t vlen, unsigned int ndigits) >>>> { >>>> - size_t keylen = ndigits * sizeof(u64); >>>> - ssize_t diff = vlen - keylen; >>>> + size_t bufsize = ndigits * sizeof(u64); >>> >>> why not just "* 8"? using sizeof here makes this function only unreadable. >> >> 'unreadable' is a 'strong' word ... > > so what is the gain when writing sizeof(u64)? It matches existing code and a digit is a 'u64'. > > BR, Jarkko