crypto: ixp4xx - fallback when having more than one SG
authorCorentin Labbe <clabbe@baylibre.com>
Wed, 5 May 2021 20:26:10 +0000 (20:26 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 May 2021 11:07:56 +0000 (19:07 +0800)
commitdfb098d692eac2a11a7051dfe87be98cd90da67d
tree4e526234d27e3a3df87997a0fd7f5feea6e37a76
parente8acf011f2e7e21a7e2fae47cbaa06598e533d40
crypto: ixp4xx - fallback when having more than one SG

Testing ixp4xx_crypto lead to:
alg: skcipher: ecb(des)-ixp4xx encryption overran dst buffer on test vector 0, cfg="two even aligned splits"

The HW overwrites destination always when sg_nents() > 1.
The problem seems that the HW always write areq->cryptlen bytes on the
last SG.
A comment in driver's code seems to give a clue that multiple SG was not
planned "This was never tested by Intel for more than one dst buffer, I think".
So let's add a fallback for this situation.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/Kconfig
drivers/crypto/ixp4xx_crypto.c