lkml.org 
[lkml]   [2010]   [May]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC][PATCH] crypto: disable tests when they are not enabled
Date
Don't compile in and don't schedule cryptomanager's tests when
CONFIG_CRYPTO_TESTS is not set. This saves quite some time during
kernel initialization.

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
CC: Herbert Xu <herbert@gondor.apana.org.au>
CC: linux-kernel@vger.kernel.org
CC: linux-crypto@vger.kernel.org
---
crypto/algboss.c | 4 ++++
crypto/testmgr.c | 14 ++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/crypto/algboss.c b/crypto/algboss.c
index c3c196b..4814a44 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -206,6 +206,7 @@ err:
return NOTIFY_OK;
}

+#ifdef CONFIG_CRYPTO_TEST
static int cryptomgr_test(void *data)
{
struct crypto_test_param *param = data;
@@ -266,6 +267,7 @@ err_put_module:
err:
return NOTIFY_OK;
}
+#endif /* CONFIG_CRYPTO_TEST */

static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
void *data)
@@ -273,8 +275,10 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
switch (msg) {
case CRYPTO_MSG_ALG_REQUEST:
return cryptomgr_schedule_probe(data);
+#ifdef CONFIG_CRYPTO_TEST
case CRYPTO_MSG_ALG_REGISTER:
return cryptomgr_schedule_test(data);
+#endif
}

return NOTIFY_DONE;
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 5c8aaa0..3529484 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -22,6 +22,17 @@
#include <crypto/rng.h>

#include "internal.h"
+
+#ifndef CONFIG_CRYPTO_TEST
+
+/* a perfect nop */
+int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
+{
+ return 0;
+}
+
+#else
+
#include "testmgr.h"

/*
@@ -2530,4 +2541,7 @@ notest:
non_fips_alg:
return -EINVAL;
}
+
+#endif
+
EXPORT_SYMBOL_GPL(alg_test);
--
1.7.1.1.g15764


\
 
 \ /
  Last update: 2010-05-24 11:39    [W:0.095 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site