From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Jason@zx2c4.com Received: from frisell.zx2c4.com (frisell.zx2c4.com [192.95.5.64]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 232d7b19 for ; Mon, 7 Nov 2016 19:00:53 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id d9ec6074 for ; Mon, 7 Nov 2016 19:00:53 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id cd5a941e (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO) for ; Mon, 7 Nov 2016 19:00:52 +0000 (UTC) Received: by mail-lf0-f52.google.com with SMTP id o141so49598867lff.1 for ; Mon, 07 Nov 2016 11:02:37 -0800 (PST) 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 Message-ID: To: Eric Biggers Content-Type: text/plain; charset=UTF-8 Cc: Herbert Xu , Martin Willi , LKML , linux-crypto@vger.kernel.org, David Miller , WireGuard mailing list Subject: Re: [WireGuard] [PATCH] poly1305: generic C can be faster on chips with slow unaligned access List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.