ctr.c (a976c2951d8f376112361830aa7762beff83a205) ctr.c (45fe93dff2fb58b22de04c729f8447ba0f773d93)
1/*
2 * CTR: Counter mode
3 *
4 * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

--- 51 unchanged lines hidden (view full) ---

60 u8 *ctrblk = walk->iv;
61 u8 tmp[bsize + alignmask];
62 u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1);
63 u8 *src = walk->src.virt.addr;
64 u8 *dst = walk->dst.virt.addr;
65 unsigned int nbytes = walk->nbytes;
66
67 crypto_cipher_encrypt_one(tfm, keystream, ctrblk);
1/*
2 * CTR: Counter mode
3 *
4 * (C) Copyright IBM Corp. 2007 - Joy Latten <latten@us.ibm.com>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)

--- 51 unchanged lines hidden (view full) ---

60 u8 *ctrblk = walk->iv;
61 u8 tmp[bsize + alignmask];
62 u8 *keystream = PTR_ALIGN(tmp + 0, alignmask + 1);
63 u8 *src = walk->src.virt.addr;
64 u8 *dst = walk->dst.virt.addr;
65 unsigned int nbytes = walk->nbytes;
66
67 crypto_cipher_encrypt_one(tfm, keystream, ctrblk);
68 crypto_xor(keystream, src, nbytes);
69 memcpy(dst, keystream, nbytes);
68 crypto_xor_cpy(dst, keystream, src, nbytes);
70
71 crypto_inc(ctrblk, bsize);
72}
73
74static int crypto_ctr_crypt_segment(struct blkcipher_walk *walk,
75 struct crypto_cipher *tfm)
76{
77 void (*fn)(struct crypto_tfm *, u8 *, const u8 *) =

--- 411 unchanged lines hidden ---
69
70 crypto_inc(ctrblk, bsize);
71}
72
73static int crypto_ctr_crypt_segment(struct blkcipher_walk *walk,
74 struct crypto_cipher *tfm)
75{
76 void (*fn)(struct crypto_tfm *, u8 *, const u8 *) =

--- 411 unchanged lines hidden ---