Received: by 2002:ab2:3b09:0:b0:1ed:14ea:9113 with SMTP id b9csp23718lqc; Thu, 29 Feb 2024 09:17:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKN3mf3wncxDnHYYjRGQlA29M6B/pCP5iZjV3vf86H9ZgomzjaDLRHCxKVA+3QqERM2lFptoJy+mgBCAz832r7iYM2cQEE9gRmjcUoKQ== X-Google-Smtp-Source: AGHT+IFdD/jeghU/gk7gKtFj3Pe9tUXntgF4q65TIN3YuzKFnS5yhUvWKt6KFWayko8XKL6V10si X-Received: by 2002:a05:6e02:585:b0:365:22a6:b792 with SMTP id c5-20020a056e02058500b0036522a6b792mr3090304ils.7.1709227024794; Thu, 29 Feb 2024 09:17:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709227024; cv=pass; d=google.com; s=arc-20160816; b=qBOTHf9YoJCT4CgidFJvnbxAU8yKRV7Fma6FCyDGFkIGIwVjFEmIgt3c8U16weFcGP FfGnqP6aqBYNZZlWmRuu3vuOQd7IUj/dWFcjnspTAwgl5hKCrgfgORbbwjKRpNFdbU2e tg2dJC4rEnVwibuYmbUT2KmxjDjCrUPi/i9iSaVw4W5OUHmXwiEiNv+gu15E1Nd/wOFp MgKdKxiOAQb+5QGW6WJEeTSPlFb6Lp4oGMjP3y83o2XJLWJWAL9+U4ejNIpTd/BBVW0o rOlSCqnazmMmdk8U9SyAB0lzhuKMnzjcxAm+LtXSLRIUhq56V36tCoj4mRBa7i7Z/Fzh wILA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=p4tBGpI1kZhsn76PkxteL6Unmf5QcEMekg/Y4vuZV6U=; fh=/w08LdzNt1kNSwWwCVqhlqp7XWsG8pryXQF7MxR0bbE=; b=BkAkMdnO0/eLt+CbsU64iYFz9yt1NOGZ2iudNO8Hnxt4pDdVrDdO1Mu8WF6ZsIeUL3 TJaV8pPBMUIJN7O9b4aT4045lkc6GZaSUcpQ6UYcwiTRajkpMyLJ2FwJLtb4AjkZqsGx GCio/Uisn9GmfNh653aRGjxGZmcJ24EzYPaOMJ/qrwuRSJ6rnnHmKb9Iamk3dChwMQRd 57IdAYQIS6RldMpSgQ3+RyGwdjFTWYQT39ze6LrZbw43BTUkkDRsyYTISOawmGxPTBq6 ATXLkW+2IrqY5GTzEcwcXXFz9W6gtMcXhMjwCNoEk+0zWFi7Bm+5ek85bzmK6/9XH90D Z9Xw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2400-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h25-20020aa786d9000000b006e48fd5e403si1631847pfo.238.2024.02.29.09.17.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 09:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto+bounces-2400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-crypto+bounces-2400-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-2400-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8C722B212BE for ; Thu, 29 Feb 2024 16:48:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 00B51383A4; Thu, 29 Feb 2024 16:48:22 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (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 A19A9383A0; Thu, 29 Feb 2024 16:48:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=176.9.242.62 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709225301; cv=none; b=MRmomeuVHACZVLeitMZKCTuzu10CLk4wNzxGUL7tIv1aV+2tSkaSA4QCUeBpl73RqmUu/cHjStUfLSSd4WT7iCp0ae+u+jVchLQK+YtzXaq72mzv6C/dwb/M+//lAJVgiFuTW9NIrJ6ibaAX2DHoHKaEvgTba39fH/cCa4dq/rg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709225301; c=relaxed/simple; bh=qOGUpVdRDAYJlycT5lc3gVy4K/H/F/f7brncKz6FGU8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WDVosfXoqHeWjw/BAVh7bYi5+VUppoaR/TA95+FOeCTMh4uMM3e0qaLv76aEUN1sFC5dH19tcbcL1yscik7aeygc1rHLvJt9CDqaSZT3XFB+UqnDB05ORrhxUh5XaH9Nqc/ltBDASVsSdVciQME/jf3V9lAIvPRT1f5/ob+47JU= 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=176.9.242.62 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 bmailout3.hostsharing.net (Postfix) with ESMTPS id 12E44100DA1C9; Thu, 29 Feb 2024 17:48:11 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id D51985DD6B0; Thu, 29 Feb 2024 17:48:10 +0100 (CET) Date: Thu, 29 Feb 2024 17:48:10 +0100 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, saulo.alessandre@tse.jus.br Subject: Re: [PATCH v3 01/10] crypto: ecdsa - Convert byte arrays with key coordinates to digits Message-ID: <20240229164810.GA7144@wunner.de> References: <20240223204149.4055630-1-stefanb@linux.ibm.com> <20240223204149.4055630-2-stefanb@linux.ibm.com> <20240229091105.GA29363@wunner.de> Precedence: bulk X-Mailing-List: linux-crypto@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: User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Feb 29, 2024 at 09:57:30AM -0500, Stefan Berger wrote: > static inline void ecc_digits_from_bytes(const u8 *in, unsigned int nbytes, > u64 *out, unsigned int ndigits) > { > unsigned int o = nbytes & 7; > u64 msd = 0; > size_t i; > > if (o == 0) { > ecc_swap_digits(in, out, ndigits); > } else { > for (i = 0; i < o; i++) > msd = (msd << 8) | in[i]; > out[ndigits - 1] = msd; > ecc_swap_digits(&in[o], out, ndigits - 1); > } > } Might be beneficial to add a code comment explaining the else-branch is for curves with key length not a multiple of 64 bits (such as NIST P521). Otherwise LGTM, thanks! Lukas