Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "crypto: shash - avoid comparing pointers to exported functions under CFI"

This reverts commit 22ca9f4aaf431a9413dcc115dd590123307f274f because CFI
no longer breaks cross-module function address equality, so
crypto_shash_alg_has_setkey() can now be an inline function like before.

This commit should not be backported to kernels that don't have the new
CFI implementation.

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
c060e16d cc7acaad

+10 -16
+3 -15
crypto/shash.c
··· 20 20 21 21 static const struct crypto_type crypto_shash_type; 22 22 23 - static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, 24 - unsigned int keylen) 23 + int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, 24 + unsigned int keylen) 25 25 { 26 26 return -ENOSYS; 27 27 } 28 - 29 - /* 30 - * Check whether an shash algorithm has a setkey function. 31 - * 32 - * For CFI compatibility, this must not be an inline function. This is because 33 - * when CFI is enabled, modules won't get the same address for shash_no_setkey 34 - * (if it were exported, which inlining would require) as the core kernel will. 35 - */ 36 - bool crypto_shash_alg_has_setkey(struct shash_alg *alg) 37 - { 38 - return alg->setkey != shash_no_setkey; 39 - } 40 - EXPORT_SYMBOL_GPL(crypto_shash_alg_has_setkey); 28 + EXPORT_SYMBOL_GPL(shash_no_setkey); 41 29 42 30 static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, 43 31 unsigned int keylen)
+7 -1
include/crypto/internal/hash.h
··· 75 75 int ahash_register_instance(struct crypto_template *tmpl, 76 76 struct ahash_instance *inst); 77 77 78 - bool crypto_shash_alg_has_setkey(struct shash_alg *alg); 78 + int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, 79 + unsigned int keylen); 80 + 81 + static inline bool crypto_shash_alg_has_setkey(struct shash_alg *alg) 82 + { 83 + return alg->setkey != shash_no_setkey; 84 + } 79 85 80 86 static inline bool crypto_shash_alg_needs_key(struct shash_alg *alg) 81 87 {