Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp1267015lqb; Thu, 30 May 2024 05:44:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyRMXwnFX4voeRoMrJjHEHuukmfUpxoqnjY2tnNgW41PfuWqxURzkenJvGWDDIVLIc3heBH7ZL85HnMnrxcycfgx1O1ikIcCfgkT+Smg== X-Google-Smtp-Source: AGHT+IHZRbR81BWkAN6WFLVi3ukdBnynUU6fruPyjJNPoLb9WB3xq7c4suon2rtggLJBa8jhJcUA X-Received: by 2002:a05:6a21:6d97:b0:1a9:8b4a:b84 with SMTP id adf61e73a8af0-1b2646c7a0bmr2035859637.18.1717073088984; Thu, 30 May 2024 05:44:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717073088; cv=pass; d=google.com; s=arc-20160816; b=Kf11pFhZNV4da+zrwPhCdFBdbtNz0vJ94MTNkoyW3Ey/Y8raU5a9ixYkhYr+2LhaJw OJApwZJqEvmArj6KnV2K+XwFfl961+T8PaQiL8dNwtVAjJc4tIHs10qGIins1MXj96g/ 6Yh7Wuz8AwMJHMcH5g3vLFIJNqSjzlNlkirocKZjU7P8QpbfULyuKn5PAKOsSThiVLmP BnJT5dlCi7an4eY8yFcKP+9RiMERQD47oySHvTMp2FI804ycg0FYbfg/L04rRJfmc0d1 B1K5lqmHJxkWFg86hTfyaceoka43ySo1PSkJDDMg/B2sIQAdbwyqECAHBoNZWOuLtIh/ /FwQ== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=x/5WyAvEHtHaYc78l54/mQX1c4iwlaGJHyfS9qbBN8Y=; fh=vrTcvqufaKVRDtC42e97Tmt8E5nQG05k1N5ENiDsoQw=; b=bzd6ZdlrVHh35FePYtbXVf35QONhun4DH/N0Qf+KCkViuq+KOXPglFZ/ctv6seTsMl WMZtbgRvA0CSXHEvtucOylE8ZC0lOm2ymU798IaaPJW7tO2CftPj78h9/070T1GCVzbv R3MUGgwww3W5WcS6JTs2P8y5c/l5jSAZefShVxeQBd/06+FcAeAyOL9ETp4ZZp7AJ1CJ BTEXHrOlsMGXHVwrqlTZakYQFOQisuJsJIyZ3L4gJ+Z8hUPz2q0Lz48xGacYJc6Wp6hA CH+WqBPDaW0pgCLePWOAo5XcxTKWnLBDM13SnHroADpQaBD+3cH8NHzaF2PF33rEcH83 Hpaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jGIyEAii; 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-4530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4530-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1a77d7787si1520992a91.185.2024.05.30.05.44.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 05:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=jGIyEAii; 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-4530-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4530-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 6FFBC283D91 for ; Thu, 30 May 2024 12:44:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C64AE132126; Thu, 30 May 2024 12:44:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="jGIyEAii" 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 9F57A18309F; Thu, 30 May 2024 12:44:42 +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=1717073084; cv=none; b=hDxysxhDA8thpNeO8Fc20Bghs9PnTl1xsqVVSetg9xBd74eJwfu+iZbqcx0EDVvrPSWsdJKmhqV60B4l2C0WHj09X4hlpDfuvDtXkD/ESDDXd69LPzqR+CrvAReRSZj328SbIGnvydyjtLG1nqWxKQo31/HAVKK5zDMRRmp6LDA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717073084; c=relaxed/simple; bh=tl3Gx8GhE1b/e4gvK0Lfp630cLEwyy06op12vRvGxFk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=AfcvvGeyBIiQtQmy9LMj/z6PbhlgPZYUCauOTrFmM0h0s5FlCAFcTzxKRzLTU4E25Oba9LOnr17a2E5g2rYU8VqP1NbV6TqzXs/PD7tq3UBhjZzCGHnrrBm+Fl1KTnvO+F65hoAP7EatgwKREO3YbRoa/m6FCcVZ0165qgBpa9o= 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=jGIyEAii; 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 (m0356516.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 44UCGPZM001414; Thu, 30 May 2024 12:44:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc : content-transfer-encoding : content-type : date : from : in-reply-to : message-id : mime-version : references : subject : to; s=pp1; bh=x/5WyAvEHtHaYc78l54/mQX1c4iwlaGJHyfS9qbBN8Y=; b=jGIyEAiiehCVGbYpPrTADNFymVxbc9/S8HJrWCjV3Sg2JybvRHYWpX355TYwCCIBvjAn UhynzApJTI2k9YlE2VTuvL9klXPAvkrzppkFPQrq9nLqbbL+kR3PjXQgn13btnSO8zKl vK/oSQbLGCv3Qw73R61y4FLueb+ICyJYin45rhOtTjC1kE80FGlO0vfC2dURJnlMIHgG nsAuj71uBinmZV6XbJmkRT6KmJSsA68hwem50ORNid4HZLCV9JvLtG5BECfd6FPB0DiW XtkC1mGbw97WGLlUW5y5x7QDrtdLp8iEXydqveXa6sAtlgZBnU+AS1X8GKImVPMmcdK1 Mg== 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 3yes5nr2sg-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 May 2024 12:44:34 +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 44UC6XH8026789; Thu, 30 May 2024 12:16:53 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([172.16.1.8]) by ppma12.dal12v.mail.ibm.com (PPS) with ESMTPS id 3ydpd2stbr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 30 May 2024 12:16:53 +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 44UCGoM618285144 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 May 2024 12:16:52 GMT Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 50F865805B; Thu, 30 May 2024 12:16:50 +0000 (GMT) Received: from smtpav01.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AA7655804B; Thu, 30 May 2024 12:16:49 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav01.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 30 May 2024 12:16:49 +0000 (GMT) Message-ID: <435d756d-2404-4f66-9ce3-363813997629@linux.ibm.com> Date: Thu, 30 May 2024 08:16:49 -0400 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/2] ecdsa: Use ecc_digits_from_bytes to simplify code 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, lukas@wunner.de References: <20240529230827.379111-1-stefanb@linux.ibm.com> Content-Language: en-US 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: wnydKamIK_X16yge0UrmJz1oP5kdyasd X-Proofpoint-ORIG-GUID: wnydKamIK_X16yge0UrmJz1oP5kdyasd X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.12.28.16 definitions=2024-05-30_09,2024-05-28_01,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 malwarescore=0 phishscore=0 mlxlogscore=966 adultscore=0 mlxscore=0 spamscore=0 bulkscore=0 priorityscore=1501 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2405300096 On 5/30/24 01:08, Jarkko Sakkinen wrote: > On Thu May 30, 2024 at 2:08 AM EEST, Stefan Berger wrote: >> Simplify two functions that were using temporary byte arrays for >> converting too-short input byte arrays to digits. Use ecc_digits_from_bytes >> since this function can now handle an input byte array that provides >> less bytes than what a coordinate of a curve requires - the function >> provides zeros for the missing (leading) bytes. >> >> See: c6ab5c915da4 ("crypto: ecc - Prevent ecc_digits_from_bytes from reading too many bytes") >> >> Regards, >> Stefan >> >> Stefan Berger (2): >> crypto: ecdsa - Use ecc_digits_from_bytes to create hash digits array >> crypto: ecdsa - Use ecc_digits_from_bytes to convert signature >> >> crypto/ecdsa.c | 29 ++++++----------------------- >> 1 file changed, 6 insertions(+), 23 deletions(-) > > BTW, would it make sense split ecdsa signature encoding to its own patch > in my next patch set version and name it ecdsa_* style and put it to > ecdsa.c? I would only put it into ecdsa.c if functions inside this file (can) make use of it, otherwise leave it in your file. > > Just asking this because the part should be the same same for any ECDSA > signature. It must scale also to all NIST variants before my patch set > can land. > > BR, Jarkko >