]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: xcbc - remove unnecessary alignment logic
authorEric Biggers <ebiggers@google.com>
Thu, 19 Oct 2023 05:53:36 +0000 (22:53 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 27 Oct 2023 10:04:25 +0000 (18:04 +0800)
commita2b1118052c41ca92cbc2366e77b2f0ff3b054ba
tree2f258536682838bc2a091eee86060dd88e98d3e3
parent1fb90689bc7ced529152fec406faddd0bcbf99f1
crypto: xcbc - remove unnecessary alignment logic

The xcbc template is setting its alignmask to that of its underlying
'cipher'.  Yet, it doesn't care itself about how its inputs and outputs
are aligned, which is ostensibly the point of the alignmask.  Instead,
xcbc actually just uses its alignmask itself to runtime-align certain
fields in its tfm and desc contexts appropriately for its underlying
cipher.  That is almost entirely pointless too, though, since xcbc is
already using the cipher API functions that handle alignment themselves,
and few ciphers set a nonzero alignmask anyway.  Also, even without
runtime alignment, an alignment of at least 4 bytes can be guaranteed.

Thus, at best this code is optimizing for the rare case of ciphers that
set an alignmask >= 7, at the cost of hurting the common cases.

Therefore, this patch removes the manual alignment code from xcbc and
makes it stop setting an alignmask.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/xcbc.c