aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2014-07-25 19:42:30 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-07-28 10:01:03 -0400
commitf3c400ef473e00c680ea713a66196b05870b3710 (patch)
tree8ea3fa84ff78263bf88e8c9556d6b1dde1ec983e /arch
parentf960d2093f29f0bc4e1df1fcefb993455620c0b5 (diff)
crypto: arm-aes - fix encryption of unaligned data
Fix the same alignment bug as in arm64 - we need to pass residue unprocessed bytes as the last argument to blkcipher_walk_done. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org # 3.13+ Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/crypto/aesbs-glue.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/arm/crypto/aesbs-glue.c b/arch/arm/crypto/aesbs-glue.c
index 4522366da759..15468fbbdea3 100644
--- a/arch/arm/crypto/aesbs-glue.c
+++ b/arch/arm/crypto/aesbs-glue.c
@@ -137,7 +137,7 @@ static int aesbs_cbc_encrypt(struct blkcipher_desc *desc,
137 dst += AES_BLOCK_SIZE; 137 dst += AES_BLOCK_SIZE;
138 } while (--blocks); 138 } while (--blocks);
139 } 139 }
140 err = blkcipher_walk_done(desc, &walk, 0); 140 err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
141 } 141 }
142 return err; 142 return err;
143} 143}
@@ -158,7 +158,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
158 bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr, 158 bsaes_cbc_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
159 walk.nbytes, &ctx->dec, walk.iv); 159 walk.nbytes, &ctx->dec, walk.iv);
160 kernel_neon_end(); 160 kernel_neon_end();
161 err = blkcipher_walk_done(desc, &walk, 0); 161 err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
162 } 162 }
163 while (walk.nbytes) { 163 while (walk.nbytes) {
164 u32 blocks = walk.nbytes / AES_BLOCK_SIZE; 164 u32 blocks = walk.nbytes / AES_BLOCK_SIZE;
@@ -182,7 +182,7 @@ static int aesbs_cbc_decrypt(struct blkcipher_desc *desc,
182 dst += AES_BLOCK_SIZE; 182 dst += AES_BLOCK_SIZE;
183 src += AES_BLOCK_SIZE; 183 src += AES_BLOCK_SIZE;
184 } while (--blocks); 184 } while (--blocks);
185 err = blkcipher_walk_done(desc, &walk, 0); 185 err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
186 } 186 }
187 return err; 187 return err;
188} 188}
@@ -268,7 +268,7 @@ static int aesbs_xts_encrypt(struct blkcipher_desc *desc,
268 bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr, 268 bsaes_xts_encrypt(walk.src.virt.addr, walk.dst.virt.addr,
269 walk.nbytes, &ctx->enc, walk.iv); 269 walk.nbytes, &ctx->enc, walk.iv);
270 kernel_neon_end(); 270 kernel_neon_end();
271 err = blkcipher_walk_done(desc, &walk, 0); 271 err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
272 } 272 }
273 return err; 273 return err;
274} 274}
@@ -292,7 +292,7 @@ static int aesbs_xts_decrypt(struct blkcipher_desc *desc,
292 bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr, 292 bsaes_xts_decrypt(walk.src.virt.addr, walk.dst.virt.addr,
293 walk.nbytes, &ctx->dec, walk.iv); 293 walk.nbytes, &ctx->dec, walk.iv);
294 kernel_neon_end(); 294 kernel_neon_end();
295 err = blkcipher_walk_done(desc, &walk, 0); 295 err = blkcipher_walk_done(desc, &walk, walk.nbytes % AES_BLOCK_SIZE);
296 } 296 }
297 return err; 297 return err;
298} 298}