Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5078630pxj; Wed, 26 May 2021 02:15:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo53oWuVgd4QtAxoOuA/ePsgJrkJ5TJhtJ5liMI+dwTuDQPKGIcD8UY0CuVV5XwpsPCqA+ X-Received: by 2002:a17:906:68ca:: with SMTP id y10mr32930125ejr.318.1622020501568; Wed, 26 May 2021 02:15:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622020501; cv=none; d=google.com; s=arc-20160816; b=QFox7WZ5ohfmwvD32xIgDNWiUx9FK7Re9WNbkvnokHK2YmW3YTkO7i+E5xaYPgHWmU a+z6qPcWXS8lMpuoGUQrmNCV9oW+lP1pIg2ufa+U15tvsh3p41emV/nLQ12Hztb6C+Gs PtDSLnOhqRbCE4AhJELGrBsl43/BICoDsY2i4+y5Mo62sh/tkiL3a0idDtJGewqG6KhN XVrx3fGwQSkJgbZroIKa9zcG9fmGVhs8pEoOztghiR8cczKEVCq1XPM7Cugix0tZarQD hewW5xJjHYykB9zPH6wfDwZh60gbZ+1xFon6lU53taGj5pNtyh2Yz9udDj6SkjIJDbIE 4tOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=NiGUSDVwggaL0U4a1gbKDgxDfsTaVXMK3WxnBFwimyU=; b=GwyHTqepxsK+0kn4O2JmEYzTIVEer8bYLDjb/wyhoacXPzyYPdfyndpuC5LzBXAbnU Ko3Q4gmRf8RqAq8UdesHrqfqNDi1ycB0lA3dCZ5M5wnwY9Sa+HI9Q0Ty59XLsOpV4AHg kYM8MjJnKXmLqu61x0fTkGXcFmFWiQJEEpLoppQ3do0a7y/dL1uzh1ctLL1cbcVWAVNW 4ST/cVxWkZKwldA9itM+kEv/nfZsc+V9qXCJSz+mjIhbRIqA9a06zndc20nez3Fq2U2C oHHkzpP0thXNIZv0KpG9IZ5y4/sQqa8cTyuOi8L1+DyEHCwq9MqZro9To0osmXvAPW0+ QLeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s9jHdOo2; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p24si14845880edq.63.2021.05.26.02.14.37; Wed, 26 May 2021 02:15:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=s9jHdOo2; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233264AbhEZJP6 (ORCPT + 99 others); Wed, 26 May 2021 05:15:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:48204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233240AbhEZJP6 (ORCPT ); Wed, 26 May 2021 05:15:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6D18D61248 for ; Wed, 26 May 2021 09:14:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622020467; bh=dXdnX56Dp8n+ZTGKiJD0nb2UHMRh0G34i2mPLUC97+A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=s9jHdOo2+iOjD99FkcK/KmAm9zQ4gQldFrFuWpx9Bz8JKCJI7+vaZBH0QHy0p2fTo Q5EvHTF18G303rGuRaRt7XfbEnT8PqweI6hGLMg+F48kJdroB9wXdCvTBXnlsLyVBs tJKbAAIJJu4se0/dykxT21obsiTolxs/5MH7r2SQtTqsDLzpHI+yOxrmq8J52t2uUg XqrIny4pRBHxMBU/Q/8Xqc1yiSp6HiiqbCs4mzrfJ6RefRt6wXoZedH8JxP8F9KHU6 stZPta+9+sM6M5MXQFEhqAtEgwNZIPyARcvMab0ECRXAsEtedY2nLIEFDQiyem/l+9 aj1hA1prVB59A== Received: by mail-oo1-f41.google.com with SMTP id f22-20020a4aeb160000b029021135f0f404so130263ooj.6 for ; Wed, 26 May 2021 02:14:27 -0700 (PDT) X-Gm-Message-State: AOAM530z3sz7rmZhLSELV2PFQJV12fMwvGCNHoPrj9oGIXISmhyX8LBd Kr05A+7os9ZfV1RG8UVwLVBnhWyUXBLx34mjJzs= X-Received: by 2002:a4a:8706:: with SMTP id z6mr1423776ooh.41.1622020466796; Wed, 26 May 2021 02:14:26 -0700 (PDT) MIME-Version: 1.0 References: <20210521102053.66609-1-ardb@kernel.org> <20210521102053.66609-6-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Wed, 26 May 2021 11:14:15 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5 5/5] crypto: arm64/aes-ccm - avoid by-ref argument for ce_aes_ccm_auth_data To: Eric Biggers Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, will@kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 24 May 2021 at 23:53, Eric Biggers wrote: > > On Fri, May 21, 2021 at 12:20:53PM +0200, Ard Biesheuvel wrote: > > With the SIMD code path removed, we can clean up the CCM auth-only path > > a bit further, by passing the 'macp' input buffer pointer by value, > > rather than by reference, and taking the output value from the > > function's return value. > > > > This way, the compiler is no longer forced to allocate macp on the > > stack. This is not expected to make any difference in practice, it just > > makes for slightly cleaner code. > > > > Signed-off-by: Ard Biesheuvel > > --- > > arch/arm64/crypto/aes-ce-ccm-core.S | 23 ++++++++++---------- > > arch/arm64/crypto/aes-ce-ccm-glue.c | 17 +++++---------- > > 2 files changed, 17 insertions(+), 23 deletions(-) > > > > diff --git a/arch/arm64/crypto/aes-ce-ccm-core.S b/arch/arm64/crypto/aes-ce-ccm-core.S > > index 8adff299fcd3..b03f7f71f893 100644 > > --- a/arch/arm64/crypto/aes-ce-ccm-core.S > > +++ b/arch/arm64/crypto/aes-ce-ccm-core.S > > @@ -12,22 +12,21 @@ > > .arch armv8-a+crypto > > > > /* > > - * void ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes, > > - * u32 *macp, u8 const rk[], u32 rounds); > > + * u32 ce_aes_ccm_auth_data(u8 mac[], u8 const in[], u32 abytes, > > + * u32 macp, u8 const rk[], u32 rounds); > > How is this different from 'u8 mac[]' which is already one of the parameters? > mac[] is the combined digest/input buffer, and macp is the index into it that keeps track on how much new input we have accumulated. I.e., instead of having a separate buffer of the same size, and accumulating bytes until we can perform the XOR + AES transformation, the partial input is accumulated into mac[] using XOR directly.