Skip to contentSkip to conversation

s390-aes: use correct encrypt/decrypt function in fallback

PATCH In review Sebastian Siewior 2 participants 2 messages Dec 8, 2007 – Dec 10, 2007

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390-aes: use correct encrypt/decrypt function in fallback

crypto_blkcipher_decrypt is wrong because it does not care about the IV.

---
 arch/s390/crypto/aes_s390.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)
arch/s390/crypto/aes_s390.c +2 -8
index 8524611..46c9705 100644
@@ -234,13 +234,10 @@ static int fallback_blk_dec(struct blkcipher_desc *desc,
 	struct crypto_blkcipher *tfm;
 	struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
 
-	memcpy(crypto_blkcipher_crt(sctx->fallback.blk)->iv, desc->info,
-		AES_BLOCK_SIZE);
-
 	tfm = desc->tfm;
 	desc->tfm = sctx->fallback.blk;
 
-	ret = crypto_blkcipher_decrypt(desc, dst, src, nbytes);
+	ret = crypto_blkcipher_decrypt_iv(desc, dst, src, nbytes);
 
 	desc->tfm = tfm;
 	return ret;
@@ -254,13 +251,10 @@ static int fallback_blk_enc(struct blkcipher_desc *desc,
 	struct crypto_blkcipher *tfm;
 	struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
 
-	memcpy(crypto_blkcipher_crt(sctx->fallback.blk)->iv, desc->info,
-		AES_BLOCK_SIZE);
-
 	tfm = desc->tfm;
 	desc->tfm = sctx->fallback.blk;
 
-	ret = crypto_blkcipher_encrypt(desc, dst, src, nbytes);
+	ret = crypto_blkcipher_encrypt_iv(desc, dst, src, nbytes);
 
 	desc->tfm = tfm;
 	return ret;
Signature · 1 line
1.5.3.4
maintainer
#1 lore raw
Quoted 4 lines · Sebastian Siewior

crypto_blkcipher_decrypt is wrong because it does not care about the IV.

Also applied.

Signature · 4 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt