linux_dsm_epyc7002/drivers/crypto
John Allen 8a302808c6 crypto: ccp - Fix use of merged scatterlists
Running the crypto manager self tests with
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS may result in several types of errors
when using the ccp-crypto driver:

alg: skcipher: cbc-des3-ccp encryption failed on test vector 0; expected_error=0, actual_error=-5 ...

alg: skcipher: ctr-aes-ccp decryption overran dst buffer on test vector 0 ...

alg: ahash: sha224-ccp test failed (wrong result) on test vector ...

These errors are the result of improper processing of scatterlists mapped
for DMA.

Given a scatterlist in which entries are merged as part of mapping the
scatterlist for DMA, the DMA length of a merged entry will reflect the
combined length of the entries that were merged. The subsequent
scatterlist entry will contain DMA information for the scatterlist entry
after the last merged entry, but the non-DMA information will be that of
the first merged entry.

The ccp driver does not take this scatterlist merging into account. To
address this, add a second scatterlist pointer to track the current
position in the DMA mapped representation of the scatterlist. Both the DMA
representation and the original representation of the scatterlist must be
tracked as while most of the driver can use just the DMA representation,
scatterlist_map_and_copy() must use the original representation and
expects the scatterlist pointer to be accurate to the original
representation.

In order to properly walk the original scatterlist, the scatterlist must
be walked until the combined lengths of the entries seen is equal to the
DMA length of the current entry being processed in the DMA mapped
representation.

Fixes: 63b945091a ("crypto: ccp - CCP device driver and interface support")
Signed-off-by: John Allen <john.allen@amd.com>
Cc: stable@vger.kernel.org
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2020-07-03 14:18:34 +10:00
..
allwinner crypto: sun8i-ce - Fix runtime PM imbalance in sun8i_ce_cipher_init 2020-07-03 14:18:33 +10:00
amcc
amlogic crypto: amlogic - Delete duplicate dev_err in meson_crypto_probe() 2020-04-16 16:49:22 +10:00
axis crypto: artpec6 - use crypto_shash_tfm_digest() 2020-05-08 15:32:13 +10:00
bcm crypto: bcm - Use the defined variable to clean code 2020-05-08 15:30:40 +10:00
caam crypto: caam/qi2 - fix return code in ahash_finup_no_ctx() 2020-06-26 14:46:43 +10:00
cavium crypto: cpt - don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified 2020-06-26 14:46:42 +10:00
ccp crypto: ccp - Fix use of merged scatterlists 2020-07-03 14:18:34 +10:00
ccree crypto: ccree - remove unused field 2020-06-26 14:49:53 +10:00
chelsio Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-06-13 16:27:13 -07:00
hisilicon crypto: hisilicon - don't sleep of CRYPTO_TFM_REQ_MAY_SLEEP was not specified 2020-06-26 14:46:42 +10:00
inside-secure
marvell crypto: octeontx - Fix sparse warnings 2020-06-18 17:47:16 +10:00
mediatek crypto: mediatek - use crypto_shash_tfm_digest() 2020-05-08 15:32:13 +10:00
nx crypto/nx: Remove 'pid' in vas_tx_win_attr struct 2020-04-20 16:53:14 +10:00
qat crypto: qat - update timeout logic in put admin msg 2020-06-18 17:26:43 +10:00
qce crypto: qce/sha - Do not modify scatterlist passed along with request 2020-07-03 14:18:34 +10:00
rockchip
stm32 crypto: stm32/crc32 - protect from concurrent accesses 2020-05-23 00:08:21 +10:00
ux500
virtio crypto: virtio: Fix dest length calculation in __virtio_crypto_skcipher_do_req() 2020-06-04 15:36:51 -04:00
vmx .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
xilinx crypto: xilinx - Remove set but not used variable 'drv_ctx' 2020-05-05 12:35:07 +02:00
atmel-aes-regs.h
atmel-aes.c
atmel-authenc.h
atmel-ecc.c
atmel-i2c.c crypto: atmel-i2c - Fix wakeup fail 2020-03-20 14:36:51 +11:00
atmel-i2c.h
atmel-sha204a.c
atmel-sha-regs.h
atmel-sha.c crypto: lib/sha1 - remove unnecessary includes of linux/cryptohash.h 2020-05-08 15:32:17 +10:00
atmel-tdes-regs.h
atmel-tdes.c
exynos-rng.c
geode-aes.c
geode-aes.h
hifn_795x.c
img-hash.c crypto: img-hash - remove redundant initialization of variable err 2020-06-26 14:46:43 +10:00
ixp4xx_crypto.c
Kconfig crypto: qce - support zero length test vectors 2020-07-03 14:18:34 +10:00
Makefile crypto: marvell - create common Kconfig and Makefile for Marvell 2020-03-20 14:36:51 +11:00
mxs-dcp.c crypto: mxs-dcp - fix scatterlist linearization for hash 2020-03-06 12:28:21 +11:00
n2_asm.S
n2_core.c crypto: n2 - use crypto_shash_tfm_digest() 2020-05-08 15:32:14 +10:00
n2_core.h
omap-aes-gcm.c crypto: omap-aes - avoid spamming console with self tests 2020-06-04 22:03:39 +10:00
omap-aes.c crypto: omap-aes - prevent unregistering algorithms twice 2020-06-04 22:03:42 +10:00
omap-aes.h
omap-crypto.c crypto: omap-crypto - fix userspace copied buffer access 2020-06-04 22:03:40 +10:00
omap-crypto.h
omap-des.c crypto: omap-des - Fix sparse/compiler warnings 2020-06-26 14:46:42 +10:00
omap-sham.c crypto: omap-sham - Fix sparse/compiler warnings 2020-06-26 14:46:42 +10:00
padlock-aes.c crypto: Convert to new CPU match macros 2020-03-24 21:36:06 +01:00
padlock-sha.c crypto: Convert to new CPU match macros 2020-03-24 21:36:06 +01:00
picoxcell_crypto_regs.h
picoxcell_crypto.c
qcom-rng.c
s5p-sss.c crypto: s5p-sss - use crypto_shash_tfm_digest() 2020-05-08 15:32:14 +10:00
sahara.c
talitos.c
talitos.h