Re: [PATCH] crypto: cmac - fix alignment of 'consts'
From: Eric Biggers
Date: Mon Oct 10 2016 - 14:14:41 EST
On Mon, Oct 10, 2016 at 10:51:14AM -0700, Joe Perches wrote:
> Hey Eric.
> I don't see any PTR_ALIGN uses in crypto/ or drivers/crypto/ that
> use a bitwise or, just mask + 1, but I believe the effect is the
> same. Anyway, your choice, but I think using min is clearer.
> cheers, Joe
Usually the bitwise OR is used when setting cra_alignmask in the 'struct
crypto_alg'. Indeed, the problem could be solved by setting
inst->alg.base.cra_alignmask = alg->cra_alignmask | (__alignof__(__be64) - 1);
I decided against that because it would always force 8-byte alignment for CMAC
input buffers and keys, when in fact they don't need that level of alignment
unless the underlying block cipher requires it.