Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp238681lqp; Wed, 22 May 2024 03:10:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDwrZVImbL/ecP4ntfpxpq3TA9a75EpsSs30IaPd1cxC99GX7k5gx3BDSMwlb3IBYPWXvHuRQ/45zMuos+zAyJ6M7Gpl3w8Ip/oGhbZg== X-Google-Smtp-Source: AGHT+IENY2Zj4yMYUZyJvwzqW953eN2PUmr9XmN8D8yOXRJWKtCBiLsqipBYF2aGs53Q9jSnDxMD X-Received: by 2002:a05:6512:3710:b0:51e:876d:17d0 with SMTP id 2adb3069b0e04-526c0a68fcdmr1255628e87.52.1716372603696; Wed, 22 May 2024 03:10:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716372603; cv=pass; d=google.com; s=arc-20160816; b=Z7xCqo/WysM9p+1ehraegMgKyoME9mupDObLkCXnLVzq8HCc9J2+U3rSwhQBaAkWni p8p8EsodBTyQhstgn2EhwlBAuCVDzm/ItmOoxO0FAJAMFsgqHtWCcLjQbdFL+suJ/vKF 86EQ8bmMdbGbY/ru4zUW2azZ/lhH3iowB+koLgHnNXCPyCke8+LGDBJDRPt//V2hyWcQ yWAhu0mnG5VPuc5whhTdePJrl8P8Ysup9J1H99f3IuJEMcDp0Umni9Xih2zy5GFn14ge hizQ0wBFFMERR8u5recUj009PpXInPi6OeVfcym0sC1/01ZNdaAhd/CMWxaTAVkgB4OL AAQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=nicHAGE5YruJPSfcFbW6ad4W1V9KVFBY/TpOLZVUW7M=; fh=Lx4Zvo0BxNdTBAwsdI8mCB16U+woHK+KAo8lK3OjO3w=; b=GRq3RnsCPNncopdtWn33YQl4apMuSAagwOBVu1fVr5urrtK7MEJp9RcJAaRrbpQp/2 NUEZJivK8ww7BiYtjRAEoRySsm3ZKZ8A2dFNzi46nwBXRySyxKUQ0orpiqOMiAeTM2UX /GUXb7NVvARvYSIShXZU292UKRNPfITwXHPRM4DdJ6f0aBkbmPLzEYOLhZiE90s0Bmc0 4wZ2BnZ/CG4E5Tfm/XhMQi04PaliT+GZcsYB/8G0L3h42vYb2M2lT0bqdPrcgJSZUAVt /TFt2XaLP8hskUq+D4UbcM77lErwPjwvm8c7hRo+r/y6OvMQEb1mGt8Rkpy54prDb52+ V2Zw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-186033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186033-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c2d54f3si14962053a12.323.2024.05.22.03.10.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:10:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-186033-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186033-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6314E1F21C6A for ; Wed, 22 May 2024 10:10:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B442581AD0; Wed, 22 May 2024 10:09:55 +0000 (UTC) Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 F1A021CD13; Wed, 22 May 2024 10:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.223.95.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716372595; cv=none; b=b+56xX6SQHaRqu5cDMbpgZMjXoKpH8GohqGjhai5BY8h1wPaTTNmyuq+7UxpLukPwy+GrdZ2aamKYqHpR134G+TiooCpGfkb40mRPc360eNfYVGYJLZS+OXBbnnLn2AOpGRF48Z+BG749nY/WP8Y2MDZtXStbfQKps0XGtKRdY0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716372595; c=relaxed/simple; bh=MGaEax+OAxHF7CuQ1K04zDUYjYQwNLeO0Fvn7PYBV7U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WoJf8yPad06ssRzz+46+ge8H892kvNWaUb3Soq11TF7ud26nB12DVGUIURFw6ARFdWjwxWL/jUjjuTL/btv+UM5fxhyD/mEcoguDydjgO2c548irCbDGsR9ua2r+PMk2ypc5RO7EYj8MPnDTtIT0jibvK7u4vtKoWVo9ywU1axw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de; spf=none smtp.mailfrom=h08.hostsharing.net; arc=none smtp.client-ip=83.223.95.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 6A0C8300000A6; Wed, 22 May 2024 12:09:42 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 624716FAE90; Wed, 22 May 2024 12:09:42 +0200 (CEST) Date: Wed, 22 May 2024 12:09:42 +0200 From: Lukas Wunner To: Stefan Berger Cc: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, davem@davemloft.net, linux-kernel@vger.kernel.org, jarkko@kernel.org Subject: Re: [REPOST PATCH v3] crypto: ecc - Prevent ecc_digits_from_bytes from reading too many bytes Message-ID: References: <20240521225006.207084-1-stefanb@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240521225006.207084-1-stefanb@linux.ibm.com> On Tue, May 21, 2024 at 06:50:06PM -0400, Stefan Berger wrote: > Prevent ecc_digits_from_bytes from reading too many bytes from the input > byte array in case an insufficient number of bytes is provided to fill the > output digit array of ndigits. Therefore, initialize the most significant > digits with 0 to avoid trying to read too many bytes later on. Convert the > function into a regular function since it is getting too big for an inline > function. > > If too many bytes are provided on the input byte array the extra bytes > are ignored since the input variable 'ndigits' limits the number of digits > that will be filled. > > Fixes: d67c96fb97b5 ("crypto: ecdsa - Convert byte arrays with key coordinates to digits") > Reviewed-by: Jarkko Sakkinen > Signed-off-by: Stefan Berger > > --- > v3: > - Applied Jarkko's tag Already landed in Linus' tree 42 hours ago -- with Jarkko's tag: https://git.kernel.org/linus/568c98a0f6ef