X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=package%2Fkernel%2Flantiq%2Fltq-deu%2Fsrc%2Fifxmips_des.c;h=513c9166ec0d041c07e57911fe503c9603dabad2;hp=dcf6c18a98748768f69bc1b7905e23e708429441;hb=93916613943ae095027f01acc521b4fcf174dea2;hpb=4ebf19b48fafc8d94e14e4ba779969613b241a6a;ds=sidebyside diff --git a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c index dcf6c18a98..513c9166ec 100644 --- a/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c +++ b/package/kernel/lantiq/ltq-deu/src/ifxmips_des.c @@ -465,14 +465,15 @@ int ecb_des_encrypt(struct blkcipher_desc *desc, struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; + unsigned int enc_bytes; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); - while ((nbytes = walk.nbytes)) { - nbytes -= (nbytes % DES_BLOCK_SIZE); + while ((nbytes = enc_bytes = walk.nbytes)) { + enc_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, - NULL, nbytes, CRYPTO_DIR_ENCRYPT, 0); + NULL, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } @@ -496,15 +497,16 @@ int ecb_des_decrypt(struct blkcipher_desc *desc, struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; + unsigned int dec_bytes; DPRINTF(1, "\n"); blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); - while ((nbytes = walk.nbytes)) { - nbytes -= (nbytes % DES_BLOCK_SIZE); + while ((nbytes = dec_bytes = walk.nbytes)) { + dec_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_ecb(ctx, walk.dst.virt.addr, walk.src.virt.addr, - NULL, nbytes, CRYPTO_DIR_DECRYPT, 0); + NULL, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } @@ -574,16 +576,17 @@ int cbc_des_encrypt(struct blkcipher_desc *desc, struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; + unsigned int enc_bytes; DPRINTF(1, "\n"); blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); - while ((nbytes = walk.nbytes)) { + while ((nbytes = enc_bytes = walk.nbytes)) { u8 *iv = walk.iv; - nbytes -= (nbytes % DES_BLOCK_SIZE); + enc_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, - iv, nbytes, CRYPTO_DIR_ENCRYPT, 0); + iv, enc_bytes, CRYPTO_DIR_ENCRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } @@ -607,16 +610,17 @@ int cbc_des_decrypt(struct blkcipher_desc *desc, struct des_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; + unsigned int dec_bytes; DPRINTF(1, "\n"); blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); - while ((nbytes = walk.nbytes)) { + while ((nbytes = dec_bytes = walk.nbytes)) { u8 *iv = walk.iv; - nbytes -= (nbytes % DES_BLOCK_SIZE); + dec_bytes -= (nbytes % DES_BLOCK_SIZE); ifx_deu_des_cbc(ctx, walk.dst.virt.addr, walk.src.virt.addr, - iv, nbytes, CRYPTO_DIR_DECRYPT, 0); + iv, dec_bytes, CRYPTO_DIR_DECRYPT, 0); nbytes &= DES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); }