Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933787AbcKGTCo (ORCPT ); Mon, 7 Nov 2016 14:02:44 -0500 Received: from frisell.zx2c4.com ([192.95.5.64]:43168 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932414AbcKGTCm (ORCPT ); Mon, 7 Nov 2016 14:02:42 -0500 MIME-Version: 1.0 In-Reply-To: <20161107182646.GA34388@google.com> References: <20161103004934.GA30775@gondor.apana.org.au> <20161103.130852.1456848512897088071.davem@davemloft.net> <20161104173723.GB34176@google.com> <20161107182646.GA34388@google.com> From: "Jason A. Donenfeld" Date: Mon, 7 Nov 2016 20:02:35 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] poly1305: generic C can be faster on chips with slow unaligned access To: Eric Biggers Cc: David Miller , Herbert Xu , linux-crypto@vger.kernel.org, LKML , Martin Willi , WireGuard mailing list , =?UTF-8?Q?Ren=C3=A9_van_Dorst?= Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 755 Lines: 14 On Mon, Nov 7, 2016 at 7:26 PM, Eric Biggers wrote: > > I was not referring to any users in particular, only what users could do. As an > example, if you did crypto_shash_update() with 32, 15, then 17 bytes, and the > underlying algorithm is poly1305-generic, the last block would end up > misaligned. This doesn't appear possible with your pseudocode because it only > passes in multiples of the block size until the very end. However I don't see > it claimed anywhere that shash API users have to do that. Actually it appears that crypto/poly1305_generic.c already buffers incoming blocks to a buffer that definitely looks aligned, to prevent this condition! I'll submit a v2 with only the inner unaligned operations changed.