include/asm-x86/voyager.h: checkpatch cleanups - formatting only
[sfrench/cifs-2.6.git] / crypto / tgr192.c
index 2d8e44f6fbe906520ce07628d7a148b597731a7d..2e7ea1680c7f72a6e3e945fac880ccad40c41183 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <asm/byteorder.h>
-#include <asm/scatterlist.h>
 #include <linux/crypto.h>
 #include <linux/types.h>
 
@@ -496,11 +495,10 @@ static void tgr192_transform(struct tgr192_ctx *tctx, const u8 * data)
        tctx->c = c;
 }
 
-static void tgr192_init(void *ctx)
+static void tgr192_init(struct crypto_tfm *tfm)
 {
-       struct tgr192_ctx *tctx = ctx;
+       struct tgr192_ctx *tctx = crypto_tfm_ctx(tfm);
 
-       memset (tctx->hash, 0, 64);
        tctx->a = 0x0123456789abcdefULL;
        tctx->b = 0xfedcba9876543210ULL;
        tctx->c = 0xf096a5b4c3b2e187ULL;
@@ -511,9 +509,10 @@ static void tgr192_init(void *ctx)
 
 /* Update the message digest with the contents
  * of INBUF with length INLEN. */
-static void tgr192_update(void *ctx, const u8 * inbuf, unsigned int len)
+static void tgr192_update(struct crypto_tfm *tfm, const u8 *inbuf,
+                         unsigned int len)
 {
-       struct tgr192_ctx *tctx = ctx;
+       struct tgr192_ctx *tctx = crypto_tfm_ctx(tfm);
 
        if (tctx->count == 64) {        /* flush the buffer */
                tgr192_transform(tctx, tctx->hash);
@@ -527,7 +526,7 @@ static void tgr192_update(void *ctx, const u8 * inbuf, unsigned int len)
                for (; len && tctx->count < 64; len--) {
                        tctx->hash[tctx->count++] = *inbuf++;
                }
-               tgr192_update(tctx, NULL, 0);
+               tgr192_update(tfm, NULL, 0);
                if (!len) {
                        return;
                }
@@ -549,15 +548,15 @@ static void tgr192_update(void *ctx, const u8 * inbuf, unsigned int len)
 
 
 /* The routine terminates the computation */
-static void tgr192_final(void *ctx, u8 * out)
+static void tgr192_final(struct crypto_tfm *tfm, u8 * out)
 {
-       struct tgr192_ctx *tctx = ctx;
+       struct tgr192_ctx *tctx = crypto_tfm_ctx(tfm);
        __be64 *dst = (__be64 *)out;
        __be64 *be64p;
        __le32 *le32p;
        u32 t, msb, lsb;
 
-       tgr192_update(tctx, NULL, 0); /* flush */ ;
+       tgr192_update(tfm, NULL, 0); /* flush */ ;
 
        msb = 0;
        t = tctx->nblocks;
@@ -585,7 +584,7 @@ static void tgr192_final(void *ctx, u8 * out)
                while (tctx->count < 64) {
                        tctx->hash[tctx->count++] = 0;
                }
-               tgr192_update(tctx, NULL, 0); /* flush */ ;
+               tgr192_update(tfm, NULL, 0); /* flush */ ;
                memset(tctx->hash, 0, 56);    /* fill next block with zeroes */
        }
        /* append the 64 bit count */
@@ -601,22 +600,20 @@ static void tgr192_final(void *ctx, u8 * out)
        dst[2] = be64p[2] = cpu_to_be64(tctx->c);
 }
 
-static void tgr160_final(void *ctx, u8 * out)
+static void tgr160_final(struct crypto_tfm *tfm, u8 * out)
 {
-       struct tgr192_ctx *wctx = ctx;
        u8 D[64];
 
-       tgr192_final(wctx, D);
+       tgr192_final(tfm, D);
        memcpy(out, D, TGR160_DIGEST_SIZE);
        memset(D, 0, TGR192_DIGEST_SIZE);
 }
 
-static void tgr128_final(void *ctx, u8 * out)
+static void tgr128_final(struct crypto_tfm *tfm, u8 * out)
 {
-       struct tgr192_ctx *wctx = ctx;
        u8 D[64];
 
-       tgr192_final(wctx, D);
+       tgr192_final(tfm, D);
        memcpy(out, D, TGR128_DIGEST_SIZE);
        memset(D, 0, TGR192_DIGEST_SIZE);
 }
@@ -627,6 +624,7 @@ static struct crypto_alg tgr192 = {
        .cra_blocksize = TGR192_BLOCK_SIZE,
        .cra_ctxsize = sizeof(struct tgr192_ctx),
        .cra_module = THIS_MODULE,
+       .cra_alignmask = 7,
        .cra_list = LIST_HEAD_INIT(tgr192.cra_list),
        .cra_u = {.digest = {
                             .dia_digestsize = TGR192_DIGEST_SIZE,
@@ -641,6 +639,7 @@ static struct crypto_alg tgr160 = {
        .cra_blocksize = TGR192_BLOCK_SIZE,
        .cra_ctxsize = sizeof(struct tgr192_ctx),
        .cra_module = THIS_MODULE,
+       .cra_alignmask = 7,
        .cra_list = LIST_HEAD_INIT(tgr160.cra_list),
        .cra_u = {.digest = {
                             .dia_digestsize = TGR160_DIGEST_SIZE,
@@ -655,6 +654,7 @@ static struct crypto_alg tgr128 = {
        .cra_blocksize = TGR192_BLOCK_SIZE,
        .cra_ctxsize = sizeof(struct tgr192_ctx),
        .cra_module = THIS_MODULE,
+       .cra_alignmask = 7,
        .cra_list = LIST_HEAD_INIT(tgr128.cra_list),
        .cra_u = {.digest = {
                             .dia_digestsize = TGR128_DIGEST_SIZE,