Skip to content

Commit 20a0f97

Browse files
ebiggersherbertx
authored andcommitted
crypto: lrw - use correct alignmask
Commit c778f96 ("crypto: lrw - Optimize tweak computation") incorrectly reduced the alignmask of LRW instances from '__alignof__(u64) - 1' to '__alignof__(__be32) - 1'. However, xor_tweak() and setkey() assume that the data and key, respectively, are aligned to 'be128', which has u64 alignment. Fix the alignmask to be at least '__alignof__(be128) - 1'. Fixes: c778f96 ("crypto: lrw - Optimize tweak computation") Cc: <stable@vger.kernel.org> # v4.20+ Cc: Ondrej Mosnacek <omosnace@redhat.com> Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 5c6bc4d commit 20a0f97

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎crypto/lrw.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ static int create(struct crypto_template *tmpl, struct rtattr **tb)
388388
inst->alg.base.cra_priority = alg->base.cra_priority;
389389
inst->alg.base.cra_blocksize = LRW_BLOCK_SIZE;
390390
inst->alg.base.cra_alignmask = alg->base.cra_alignmask |
391-
(__alignof__(__be32) - 1);
391+
(__alignof__(be128) - 1);
392392

393393
inst->alg.ivsize = LRW_BLOCK_SIZE;
394394
inst->alg.min_keysize = crypto_skcipher_alg_min_keysize(alg) +

0 commit comments

Comments
 (0)