crypto: atmel-tdes - Set the IV after {en,de}crypt
authorTudor Ambarus <tudor.ambarus@microchip.com>
Fri, 15 Nov 2019 13:49:06 +0000 (13:49 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 22 Nov 2019 10:48:37 +0000 (18:48 +0800)
commit61b0dd664fa1873501297efbb12e5684aff074d4
treef35120081e5dc14cd9635aff0577fccb0886a525
parentd1d787bcebfe122a5bd443ae565696661e2e9656
crypto: atmel-tdes - Set the IV after {en,de}crypt

The req->iv of the skcipher_request is expected to contain the
last ciphertext block when the {en,de}crypt operation is done.
In case of in-place decryption, copy the ciphertext in an
intermediate buffer before decryption.

This fixes the following tcrypt tests:
alg: skcipher: atmel-cbc-des encryption test failed (wrong output IV) on test vector 0, cfg="in-place"
00000000: fe dc ba 98 76 54 32 10
alg: skcipher: atmel-cbc-tdes encryption test failed (wrong output IV) on test vector 0, cfg="in-place"
00000000: 7d 33 88 93 0f 93 b2 42

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-tdes.c