summaryrefslogtreecommitdiff
path: root/include/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-10-19 01:34:55 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2023-10-27 13:04:24 +0300
commit08debaa5cb31da50725a8cb2f06d3f617a9caa98 (patch)
tree29f3f1b9b6282469e3dda1441ce9e4d8bc16564e /include/crypto
parenta411f6debeb33e2ec8f5825f0c41497317c0504e (diff)
downloadlinux-08debaa5cb31da50725a8cb2f06d3f617a9caa98.tar.xz
crypto: shash - eliminate indirect call for default import and export
Most shash algorithms don't have custom ->import and ->export functions, resulting in the memcpy() based default being used. Yet, crypto_shash_import() and crypto_shash_export() still make an indirect call, which is expensive. Therefore, change how the default import and export are called to make it so that crypto_shash_import() and crypto_shash_export() don't do an indirect call in this case. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'include/crypto')
-rw-r--r--include/crypto/hash.h15
1 files changed, 2 insertions, 13 deletions
diff --git a/include/crypto/hash.h b/include/crypto/hash.h
index f7c2a22cd776..52e57e93b2f5 100644
--- a/include/crypto/hash.h
+++ b/include/crypto/hash.h
@@ -952,10 +952,7 @@ int crypto_shash_tfm_digest(struct crypto_shash *tfm, const u8 *data,
* Context: Any context.
* Return: 0 if the export creation was successful; < 0 if an error occurred
*/
-static inline int crypto_shash_export(struct shash_desc *desc, void *out)
-{
- return crypto_shash_alg(desc->tfm)->export(desc, out);
-}
+int crypto_shash_export(struct shash_desc *desc, void *out);
/**
* crypto_shash_import() - import operational state
@@ -969,15 +966,7 @@ static inline int crypto_shash_export(struct shash_desc *desc, void *out)
* Context: Any context.
* Return: 0 if the import was successful; < 0 if an error occurred
*/
-static inline int crypto_shash_import(struct shash_desc *desc, const void *in)
-{
- struct crypto_shash *tfm = desc->tfm;
-
- if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
- return -ENOKEY;
-
- return crypto_shash_alg(tfm)->import(desc, in);
-}
+int crypto_shash_import(struct shash_desc *desc, const void *in);
/**
* crypto_shash_init() - (re)initialize message digest