]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
crypto: skcipher - optimize initializing skcipher_walk fields
authorEric Biggers <ebiggers@google.com>
Sun, 5 Jan 2025 19:34:15 +0000 (11:34 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 14 Jan 2025 03:38:33 +0000 (11:38 +0800)
commit8b13c2239d8b65604b7a0ff18c2eb74b531c4c06
tree8f71f809699cac80175fddc5366dc98c8c5b93f6
parentf2489456fe54757098d967c1362c637da0be08a9
crypto: skcipher - optimize initializing skcipher_walk fields

The helper functions like crypto_skcipher_blocksize() take in a pointer
to a tfm object, but they actually return properties of the algorithm.
As the Linux kernel is compiled with -fno-strict-aliasing, the compiler
has to assume that the writes to struct skcipher_walk could clobber the
tfm's pointer to its algorithm.  Thus it gets repeatedly reloaded in the
generated code.  Therefore, replace the use of these helper functions
with staightforward accesses to the struct fields.

Note that while *users* of the skcipher and aead APIs are supposed to
use the helper functions, this particular code is part of the API
*implementation* in crypto/skcipher.c, which already accesses the
algorithm struct directly in many cases.  So there is no reason to
prefer the helper functions here.

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