From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933643AbcKHR0c (ORCPT ); Tue, 8 Nov 2016 12:26:32 -0500 Received: from mail-pf0-f176.google.com ([209.85.192.176]:33866 "EHLO mail-pf0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933526AbcKHR0a (ORCPT ); Tue, 8 Nov 2016 12:26:30 -0500 Date: Tue, 8 Nov 2016 09:26:26 -0800 From: Eric Biggers To: Martin Willi Cc: "Jason A. Donenfeld" , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, =?iso-8859-1?Q?Ren=E9?= van Dorst Subject: Re: [PATCH v4] poly1305: generic C can be faster on chips with slow unaligned access Message-ID: <20161108172626.GA99078@google.com> References: <20161107191253.17998-1-Jason@zx2c4.com> <20161107194709.20457-1-Jason@zx2c4.com> <1478591559.5216.7.camel@strongswan.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478591559.5216.7.camel@strongswan.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 08, 2016 at 08:52:39AM +0100, Martin Willi wrote: > > > Not sure what the exact alignment rules for key/iv are, but maybe we > want to replace the same function in chacha20_generic.c as well? > > Martin chacha20-generic provides a blkcipher API and sets an alignmask of sizeof(u32) - 1. This applies to the key buffer for ->setkey() and to the mapped addresses for the input/output buffers and IV during the blkcipher walk. So it does not appear to have the problems that poly1305 has. I do however see one small problem which is that 'u8 stream[CHACHA20_BLOCK_SIZE];' is, strictly speaking, not guaranteed to be aligned to u32. Eric