OrangePi_CM5/crypto
Ignat Korchagin a1354bdd19 crypto: akcipher - default implementation for setting a private key
[ Upstream commit bc155c6c188c2f0c5749993b1405673d25a80389 ]

Changes from v1:
  * removed the default implementation from set_pub_key: it is assumed that
    an implementation must always have this callback defined as there are
    no use case for an algorithm, which doesn't need a public key

Many akcipher implementations (like ECDSA) support only signature
verifications, so they don't have all callbacks defined.

Commit 78a0324f4a ("crypto: akcipher - default implementations for
request callbacks") introduced default callbacks for sign/verify
operations, which just return an error code.

However, these are not enough, because before calling sign the caller would
likely call set_priv_key first on the instantiated transform (as the
in-kernel testmgr does). This function does not have a default stub, so the
kernel crashes, when trying to set a private key on an akcipher, which
doesn't support signature generation.

I've noticed this, when trying to add a KAT vector for ECDSA signature to
the testmgr.

With this patch the testmgr returns an error in dmesg (as it should)
instead of crashing the kernel NULL ptr dereference.

Fixes: 78a0324f4a ("crypto: akcipher - default implementations for request callbacks")
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-10-26 13:25:42 +02:00
..
asymmetric_keys KEYS: asymmetric: enforce SM2 signature use pkey algo 2022-08-21 15:16:22 +02:00
async_tx async_xor: check src_offs is not NULL before updating it 2021-06-16 12:01:40 +02:00
842.c
…
Kconfig crypto: memneq - move into lib/ 2022-06-22 14:13:18 +02:00
Makefile crypto: memneq - move into lib/ 2022-06-22 14:13:18 +02:00
acompress.c
…
adiantum.c
…
aead.c
…
aegis.h
…
aegis128-core.c
…
aegis128-neon-inner.c
…
aegis128-neon.c
…
aes_generic.c
…
aes_ti.c
…
af_alg.c
…
ahash.c
…
akcipher.c crypto: akcipher - default implementation for setting a private key 2022-10-26 13:25:42 +02:00
algapi.c crypto: api - Move cryptomgr soft dependency into algapi 2022-02-11 09:09:03 +01:00
algboss.c
…
algif_aead.c
…
algif_hash.c
…
algif_rng.c
…
algif_skcipher.c
…
ansi_cprng.c
…
anubis.c
…
api.c crypto: api - Move cryptomgr soft dependency into algapi 2022-02-11 09:09:03 +01:00
arc4.c
…
authenc.c crypto: authenc - Fix sleep in atomic context in decrypt_tail 2022-04-08 14:39:59 +02:00
authencesn.c
…
blake2b_generic.c
…
blake2s_generic.c lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-05-30 09:33:26 +02:00
blowfish_common.c
…
blowfish_generic.c
…
camellia_generic.c
…
cast5_generic.c
…
cast6_generic.c
…
cast_common.c
…
cbc.c
…
ccm.c
…
cfb.c
…
chacha20poly1305.c
…
chacha_generic.c
…
cipher.c
…
cmac.c
…
compress.c
…
crc32_generic.c
…
crc32c_generic.c
…
crct10dif_common.c
…
crct10dif_generic.c
…
cryptd.c crypto: cryptd - Protect per-CPU resource by disabling BH. 2022-06-09 10:21:17 +02:00
crypto_engine.c
…
crypto_null.c
…
crypto_user_base.c
…
crypto_user_stat.c
…
ctr.c
…
cts.c
…
curve25519-generic.c
…
deflate.c
…
des_generic.c
…
dh.c
…
dh_helper.c
…
drbg.c crypto: drbg - make reseeding from get_random_bytes() synchronous 2022-06-06 08:42:42 +02:00
ecb.c
…
ecc.c
…
ecc.h
…
ecc_curve_defs.h
…
ecdh.c
…
ecdh_helper.c
…
echainiv.c
…
ecrdsa.c crypto: ecrdsa - Fix incorrect use of vli_cmp 2022-06-06 08:42:43 +02:00
ecrdsa_defs.h
…
ecrdsa_params.asn1
…
ecrdsa_pub_key.asn1
…
essiv.c
…
fcrypt.c
…
fips.c
…
gcm.c
…
geniv.c
…
gf128mul.c
…
ghash-generic.c
…
hash_info.c
…
hmac.c
…
internal.h
…
jitterentropy-kcapi.c
…
jitterentropy.c crypto: jitter - consider 32 LSB for APT 2022-01-27 10:54:12 +01:00
jitterentropy.h
…
keywrap.c
…
khazad.c
…
kpp.c
…
lrw.c
…
lz4.c
…
lz4hc.c
…
lzo-rle.c
…
lzo.c
…
md4.c
…
md5.c
…
michael_mic.c
…
nhpoly1305.c
…
ofb.c
…
pcbc.c
…
pcrypt.c crypto: pcrypt - Delay write to padata->info 2021-11-18 14:04:12 +01:00
poly1305_generic.c
…
proc.c
…
ripemd.h
…
rmd128.c
…
rmd160.c
…
rmd256.c
…
rmd320.c
…
rng.c
…
rsa-pkcs1pad.c crypto: rsa-pkcs1pad - fix buffer overread in pkcs1pad_verify_complete() 2022-04-08 14:39:57 +02:00
rsa.c
…
rsa_helper.c
…
rsaprivkey.asn1
…
rsapubkey.asn1
…
salsa20_generic.c
…
scatterwalk.c
…
scompress.c
…
seed.c
…
seqiv.c
…
serpent_generic.c
…
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-14 16:55:54 +02:00
simd.c
…
skcipher.c
…
sm2.c crypto: sm2 - fix a memory leak in sm2 2021-07-14 16:56:06 +02:00
sm2signature.asn1
…
sm3_generic.c
…
sm4_generic.c
…
streebog_generic.c
…
tcrypt.c
…
tcrypt.h
…
tea.c
…
testmgr.c
…
testmgr.h
…
tgr192.c
…
twofish_common.c
…
twofish_generic.c
…
vmac.c
…
wp512.c
…
xcbc.c
…
xor.c
…
xts.c
…
xxhash_generic.c
…
zstd.c
…