crypto: xts - remove xts_crypt()
authorEric Biggers <ebiggers@google.com>
Tue, 20 Feb 2018 07:48:24 +0000 (23:48 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 2 Mar 2018 16:03:33 +0000 (00:03 +0800)
Now that all users of xts_crypt() have been removed in favor of the XTS
template wrapping an ECB mode algorithm, remove xts_crypt().

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/xts.c
include/crypto/xts.h

index f317c48b5e4320820aa0c748d3ddbddc66ddfbcb..12284183bd20a0c1ab54e9d737b29fa92ac4031c 100644 (file)
@@ -357,78 +357,6 @@ static int decrypt(struct skcipher_request *req)
        return do_decrypt(req, init_crypt(req, decrypt_done));
 }
 
-int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *sdst,
-             struct scatterlist *ssrc, unsigned int nbytes,
-             struct xts_crypt_req *req)
-{
-       const unsigned int bsize = XTS_BLOCK_SIZE;
-       const unsigned int max_blks = req->tbuflen / bsize;
-       struct blkcipher_walk walk;
-       unsigned int nblocks;
-       le128 *src, *dst, *t;
-       le128 *t_buf = req->tbuf;
-       int err, i;
-
-       BUG_ON(max_blks < 1);
-
-       blkcipher_walk_init(&walk, sdst, ssrc, nbytes);
-
-       err = blkcipher_walk_virt(desc, &walk);
-       nbytes = walk.nbytes;
-       if (!nbytes)
-               return err;
-
-       nblocks = min(nbytes / bsize, max_blks);
-       src = (le128 *)walk.src.virt.addr;
-       dst = (le128 *)walk.dst.virt.addr;
-
-       /* calculate first value of T */
-       req->tweak_fn(req->tweak_ctx, (u8 *)&t_buf[0], walk.iv);
-
-       i = 0;
-       goto first;
-
-       for (;;) {
-               do {
-                       for (i = 0; i < nblocks; i++) {
-                               gf128mul_x_ble(&t_buf[i], t);
-first:
-                               t = &t_buf[i];
-
-                               /* PP <- T xor P */
-                               le128_xor(dst + i, t, src + i);
-                       }
-
-                       /* CC <- E(Key2,PP) */
-                       req->crypt_fn(req->crypt_ctx, (u8 *)dst,
-                                     nblocks * bsize);
-
-                       /* C <- T xor CC */
-                       for (i = 0; i < nblocks; i++)
-                               le128_xor(dst + i, dst + i, &t_buf[i]);
-
-                       src += nblocks;
-                       dst += nblocks;
-                       nbytes -= nblocks * bsize;
-                       nblocks = min(nbytes / bsize, max_blks);
-               } while (nblocks > 0);
-
-               *(le128 *)walk.iv = *t;
-
-               err = blkcipher_walk_done(desc, &walk, nbytes);
-               nbytes = walk.nbytes;
-               if (!nbytes)
-                       break;
-
-               nblocks = min(nbytes / bsize, max_blks);
-               src = (le128 *)walk.src.virt.addr;
-               dst = (le128 *)walk.dst.virt.addr;
-       }
-
-       return err;
-}
-EXPORT_SYMBOL_GPL(xts_crypt);
-
 static int init_tfm(struct crypto_skcipher *tfm)
 {
        struct skcipher_instance *inst = skcipher_alg_instance(tfm);
index 322aab6e78a71f5b241bae2eab17d8fa5c461bde..34d94c95445a5871a4db1f8502e61cb80fd331de 100644 (file)
@@ -6,27 +6,10 @@
 #include <crypto/internal/skcipher.h>
 #include <linux/fips.h>
 
-struct scatterlist;
-struct blkcipher_desc;
-
 #define XTS_BLOCK_SIZE 16
 
-struct xts_crypt_req {
-       le128 *tbuf;
-       unsigned int tbuflen;
-
-       void *tweak_ctx;
-       void (*tweak_fn)(void *ctx, u8* dst, const u8* src);
-       void *crypt_ctx;
-       void (*crypt_fn)(void *ctx, u8 *blks, unsigned int nbytes);
-};
-
 #define XTS_TWEAK_CAST(x) ((void (*)(void *, u8*, const u8*))(x))
 
-int xts_crypt(struct blkcipher_desc *desc, struct scatterlist *dst,
-             struct scatterlist *src, unsigned int nbytes,
-             struct xts_crypt_req *req);
-
 static inline int xts_check_key(struct crypto_tfm *tfm,
                                const u8 *key, unsigned int keylen)
 {