linux-stable/crypto
Ard Biesheuvel 391b50b5b8 crypto: shash - avoid comparing pointers to exported functions under CFI
[ Upstream commit 22ca9f4aaf ]

crypto_shash_alg_has_setkey() is implemented by testing whether the
.setkey() member of a struct shash_alg points to the default version,
called shash_no_setkey(). As crypto_shash_alg_has_setkey() is a static
inline, this requires shash_no_setkey() to be exported to modules.

Unfortunately, when building with CFI, function pointers are routed
via CFI stubs which are private to each module (or to the kernel proper)
and so this function pointer comparison may fail spuriously.

Let's fix this by turning crypto_shash_alg_has_setkey() into an out of
line function.

Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-07-20 16:17:32 +02:00
..
asymmetric_keys crypto: asymmetric_keys - select CRYPTO_HASH where needed 2019-07-31 07:28:31 +02:00
async_tx
.gitignore
842.c
ablk_helper.c
ablkcipher.c
acompress.c
aead.c
aes_generic.c
aes_ti.c crypto: aes_ti - disable interrupts while accessing S-box 2019-02-12 19:45:57 +01:00
af_alg.c crypto: af_alg - avoid undefined behavior accessing salg_name 2020-12-29 13:46:50 +01:00
ahash.c crypto: hash - set CRYPTO_TFM_NEED_KEY if ->setkey() fails 2019-03-23 14:35:18 +01:00
akcipher.c
algapi.c crypto: api - Fix race condition in crypto_spawn_alg 2020-02-14 16:32:14 -05:00
algboss.c crypto: algboss - don't wait during notifier callback 2020-06-25 15:42:01 +02:00
algif_aead.c crypto: algif_aead - Do not set MAY_BACKLOG on the async path 2020-10-29 09:07:00 +01:00
algif_hash.c crypto: af_alg - fix use-after-free in af_alg_accept() due to bh_lock_sock() 2020-07-09 09:36:30 +02:00
algif_rng.c
algif_skcipher.c crypto: algif_skcipher - EBUSY on aio should be an error 2020-10-29 09:07:01 +01:00
ansi_cprng.c
anubis.c
api.c crypto: api - check for ERR pointers in crypto_destroy_tfm() 2021-05-22 10:57:16 +02:00
arc4.c
authenc.c crypto: authenc - fix parsing key with misaligned rta_len 2019-01-23 08:09:48 +01:00
authencesn.c crypto: authencesn - Avoid twice completion call in decrypt path 2019-01-23 08:09:47 +01:00
blkcipher.c
blowfish_common.c
blowfish_generic.c
camellia_generic.c
cast5_generic.c
cast6_generic.c
cast_common.c
cbc.c
ccm.c crypto: ccm - fix incompatibility between "ccm" and "ccm_base" 2019-05-21 18:50:20 +02:00
chacha20_generic.c
chacha20poly1305.c crypto: chacha20poly1305 - fix atomic sleep when using async algorithm 2019-07-31 07:28:35 +02:00
cipher.c
cmac.c
compress.c
crc32_generic.c
crc32c_generic.c
crct10dif_common.c
crct10dif_generic.c crypto: crct10dif-generic - fix use via crypto_shash_digest() 2019-05-21 18:50:15 +02:00
cryptd.c crypto: cryptd - Fix skcipher instance memory leak 2019-07-10 09:54:38 +02:00
crypto_engine.c
crypto_null.c
crypto_user.c crypto: user - fix memory leak in crypto_report 2019-12-17 20:38:55 +01:00
crypto_wq.c
ctr.c
cts.c
deflate.c
des_generic.c
dh.c
dh_helper.c
drbg.c
ecb.c
ecc.c crypto: ecdh - fix big endian bug in ECC library 2019-12-17 20:38:55 +01:00
ecc.h
ecc_curve_defs.h
ecdh.c crypto: ecdh - avoid buffer overflow in ecdh_set_secret() 2021-01-12 20:09:09 +01:00
ecdh_helper.c crypto: ecdh_helper - Ensure 'len >= secret.len' in decode_key() 2021-03-03 18:22:43 +01:00
echainiv.c
fcrypt.c
fips.c
gcm.c crypto: gcm - fix incompatibility between "gcm" and "gcm_base" 2019-05-21 18:50:15 +02:00
gf128mul.c
ghash-generic.c crypto: ghash - fix unaligned memory access in ghash_setkey() 2019-07-31 07:28:35 +02:00
hash_info.c
hmac.c
internal.h crypto: api - Fix race condition in crypto_spawn_alg 2020-02-14 16:32:14 -05:00
jitterentropy-kcapi.c
jitterentropy.c
Kconfig crypto: aes_ti - disable interrupts while accessing S-box 2019-02-12 19:45:57 +01:00
keywrap.c
khazad.c
kpp.c
lrw.c gcc-10: avoid shadowing standard library 'free()' in crypto 2020-05-20 08:17:11 +02:00
lz4.c
lz4hc.c
lzo.c
Makefile
mcryptd.c
md4.c
md5.c
memneq.c
michael_mic.c
pcbc.c crypto: pcbc - remove bogus memcpy()s with src == dest 2019-03-23 14:35:21 +01:00
pcrypt.c crypto: pcrypt - Do not clear MAY_SLEEP flag in original request 2020-02-14 16:32:14 -05:00
poly1305_generic.c
proc.c
ripemd.h
rmd128.c
rmd160.c
rmd256.c
rmd320.c
rng.c
rsa-pkcs1pad.c crypto: fix a memory leak in rsa-kcs1pad's encryption mode 2019-11-20 18:00:47 +01:00
rsa.c
rsa_helper.c
rsaprivkey.asn1
rsapubkey.asn1
salsa20_generic.c crypto: salsa20 - don't access already-freed walk.iv 2019-05-21 18:50:19 +02:00
scatterwalk.c
scompress.c
seed.c
seqiv.c
serpent_generic.c crypto: serpent - mark __serpent_setkey_sbox noinline 2019-07-31 07:28:30 +02:00
sha1_generic.c
sha3_generic.c
sha256_generic.c
sha512_generic.c
shash.c crypto: shash - avoid comparing pointers to exported functions under CFI 2021-07-20 16:17:32 +02:00
simd.c
skcipher.c crypto: skcipher - Unmap pages after an external error 2019-10-11 18:18:32 +02:00
tcrypt.c
tcrypt.h
tea.c
testmgr.c crypto: testmgr - skip crc32c context test for ahash algorithms 2019-03-23 14:35:18 +01:00
testmgr.h crypto: x86/poly1305 - fix overflow during partial reduction 2019-04-27 09:35:37 +02:00
tgr192.c crypto: tgr192 - fix unaligned memory access 2020-01-27 14:46:13 +01:00
twofish_common.c
twofish_generic.c
vmac.c
wp512.c
xcbc.c
xor.c
xts.c gcc-10: avoid shadowing standard library 'free()' in crypto 2020-05-20 08:17:11 +02:00