Skip to content

Commit

Permalink
[CRYPTO] s390-aes: Use correct encrypt/decrypt function in fallback
Browse files Browse the repository at this point in the history
crypto_blkcipher_decrypt is wrong because it does not care about
the IV.

Signed-off-by: Sebastian Siewior <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
sebastianas authored and herbertx committed Jan 10, 2008
1 parent fdc520a commit 2d74d40
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions arch/s390/crypto/aes_s390.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 2d74d40

Please sign in to comment.