linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Svenning Sørensen" <sss@secomea.com>
To: Nicolas Royer <nicolas@eukrea.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: <linux-crypto@vger.kernel.org>
Subject: [PATCH] CRYPTO: atmel_sha: remove unused shash fallback instance
Date: Thu, 4 Dec 2014 23:59:48 +0100	[thread overview]
Message-ID: <5480E764.7030508@secomea.com> (raw)

CRYPTO: atmel_sha: remove unused shash fallback instance.

The fallback is never used, so there is no point in having it.

The cra_exit routine can also be removed, since all it did was releasing
the fallback, along with the stub around cra_init, which just added an
unused NULL argument.

Signed-off-by: Svenning Soerensen <sss@secomea.com>

diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 9a4f69e..6ed3530 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -102,10 +102,6 @@ struct atmel_sha_ctx {
      struct atmel_sha_dev    *dd;

      unsigned long        flags;
-
-    /* fallback stuff */
-    struct crypto_shash    *fallback;
-
  };

  #define ATMEL_SHA_QUEUE_LENGTH    50
@@ -974,19 +970,8 @@ static int atmel_sha_digest(struct ahash_request *req)
      return atmel_sha_init(req) ?: atmel_sha_finup(req);
  }

-static int atmel_sha_cra_init_alg(struct crypto_tfm *tfm, const char 
*alg_base)
+static int atmel_sha_cra_init(struct crypto_tfm *tfm)
  {
-    struct atmel_sha_ctx *tctx = crypto_tfm_ctx(tfm);
-    const char *alg_name = crypto_tfm_alg_name(tfm);
-
-    /* Allocate a fallback and abort if it failed. */
-    tctx->fallback = crypto_alloc_shash(alg_name, 0,
-                        CRYPTO_ALG_NEED_FALLBACK);
-    if (IS_ERR(tctx->fallback)) {
-        pr_err("atmel-sha: fallback driver '%s' could not be loaded.\n",
-                alg_name);
-        return PTR_ERR(tctx->fallback);
-    }
      crypto_ahash_set_reqsize(__crypto_ahash_cast(tfm),
                   sizeof(struct atmel_sha_reqctx) +
                   SHA_BUFFER_LEN + SHA512_BLOCK_SIZE);
@@ -994,19 +979,6 @@ static int atmel_sha_cra_init_alg(struct crypto_tfm 
*tfm, const char *alg_base)
      return 0;
  }

-static int atmel_sha_cra_init(struct crypto_tfm *tfm)
-{
-    return atmel_sha_cra_init_alg(tfm, NULL);
-}
-
-static void atmel_sha_cra_exit(struct crypto_tfm *tfm)
-{
-    struct atmel_sha_ctx *tctx = crypto_tfm_ctx(tfm);
-
-    crypto_free_shash(tctx->fallback);
-    tctx->fallback = NULL;
-}
-
  static struct ahash_alg sha_1_256_algs[] = {
  {
      .init        = atmel_sha_init,
@@ -1020,14 +992,12 @@ static struct ahash_alg sha_1_256_algs[] = {
              .cra_name        = "sha1",
              .cra_driver_name    = "atmel-sha1",
              .cra_priority        = 100,
-            .cra_flags        = CRYPTO_ALG_ASYNC |
-                        CRYPTO_ALG_NEED_FALLBACK,
+            .cra_flags        = CRYPTO_ALG_ASYNC,
              .cra_blocksize        = SHA1_BLOCK_SIZE,
              .cra_ctxsize        = sizeof(struct atmel_sha_ctx),
              .cra_alignmask        = 0,
              .cra_module        = THIS_MODULE,
              .cra_init        = atmel_sha_cra_init,
-            .cra_exit        = atmel_sha_cra_exit,
          }
      }
  },
@@ -1043,14 +1013,12 @@ static struct ahash_alg sha_1_256_algs[] = {
              .cra_name        = "sha256",
              .cra_driver_name    = "atmel-sha256",
              .cra_priority        = 100,
-            .cra_flags        = CRYPTO_ALG_ASYNC |
-                        CRYPTO_ALG_NEED_FALLBACK,
+            .cra_flags        = CRYPTO_ALG_ASYNC,
              .cra_blocksize        = SHA256_BLOCK_SIZE,
              .cra_ctxsize        = sizeof(struct atmel_sha_ctx),
              .cra_alignmask        = 0,
              .cra_module        = THIS_MODULE,
              .cra_init        = atmel_sha_cra_init,
-            .cra_exit        = atmel_sha_cra_exit,
          }
      }
  },
@@ -1068,14 +1036,12 @@ static struct ahash_alg sha_224_alg = {
              .cra_name        = "sha224",
              .cra_driver_name    = "atmel-sha224",
              .cra_priority        = 100,
-            .cra_flags        = CRYPTO_ALG_ASYNC |
-                        CRYPTO_ALG_NEED_FALLBACK,
+            .cra_flags        = CRYPTO_ALG_ASYNC,
              .cra_blocksize        = SHA224_BLOCK_SIZE,
              .cra_ctxsize        = sizeof(struct atmel_sha_ctx),
              .cra_alignmask        = 0,
              .cra_module        = THIS_MODULE,
              .cra_init        = atmel_sha_cra_init,
-            .cra_exit        = atmel_sha_cra_exit,
          }
      }
  };
@@ -1093,14 +1059,12 @@ static struct ahash_alg sha_384_512_algs[] = {
              .cra_name        = "sha384",
              .cra_driver_name    = "atmel-sha384",
              .cra_priority        = 100,
-            .cra_flags        = CRYPTO_ALG_ASYNC |
-                        CRYPTO_ALG_NEED_FALLBACK,
+            .cra_flags        = CRYPTO_ALG_ASYNC,
              .cra_blocksize        = SHA384_BLOCK_SIZE,
              .cra_ctxsize        = sizeof(struct atmel_sha_ctx),
              .cra_alignmask        = 0x3,
              .cra_module        = THIS_MODULE,
              .cra_init        = atmel_sha_cra_init,
-            .cra_exit        = atmel_sha_cra_exit,
          }
      }
  },
@@ -1116,14 +1080,12 @@ static struct ahash_alg sha_384_512_algs[] = {
              .cra_name        = "sha512",
              .cra_driver_name    = "atmel-sha512",
              .cra_priority        = 100,
-            .cra_flags        = CRYPTO_ALG_ASYNC |
-                        CRYPTO_ALG_NEED_FALLBACK,
+            .cra_flags        = CRYPTO_ALG_ASYNC,
              .cra_blocksize        = SHA512_BLOCK_SIZE,
              .cra_ctxsize        = sizeof(struct atmel_sha_ctx),
              .cra_alignmask        = 0x3,
              .cra_module        = THIS_MODULE,
              .cra_init        = atmel_sha_cra_init,
-            .cra_exit        = atmel_sha_cra_exit,
          }
      }
  },

             reply	other threads:[~2014-12-04 23:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-04 22:59 Svenning Sørensen [this message]
2014-12-05  0:18 ` Resend: [PATCH] CRYPTO: atmel_sha: remove unused shash fallback instance Svenning Sørensen
2014-12-22 12:03   ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5480E764.7030508@secomea.com \
    --to=sss@secomea.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=nicolas@eukrea.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).