aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-09-07 17:35:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-09-07 17:35:16 -0400
commit61f953cbaae26f930b8d937366270547e08c1290 (patch)
tree44cefef0fdd172ce4fe2083ed7695d86b76ed257 /crypto
parenta44a553f827f28d46130c9818dbcb95f4262b96c (diff)
parent50b6e71ae83714be509b80727dbf90fa8b1c0717 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: Revert "hwrng: n2-drv - remove casts from void*" crypto: testmgr - Default to no tests crypto: testmgr - Fix test disabling option crypto: hash - Fix handling of small unaligned buffers
Diffstat (limited to 'crypto')
-rw-r--r--crypto/Kconfig8
-rw-r--r--crypto/ahash.c7
-rw-r--r--crypto/algboss.c8
-rw-r--r--crypto/testmgr.c4
4 files changed, 15 insertions, 12 deletions
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 1cd497d7a15..e573077f167 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -101,13 +101,13 @@ config CRYPTO_MANAGER2
101 select CRYPTO_BLKCIPHER2 101 select CRYPTO_BLKCIPHER2
102 select CRYPTO_PCOMP2 102 select CRYPTO_PCOMP2
103 103
104config CRYPTO_MANAGER_TESTS 104config CRYPTO_MANAGER_DISABLE_TESTS
105 bool "Run algolithms' self-tests" 105 bool "Disable run-time self tests"
106 default y 106 default y
107 depends on CRYPTO_MANAGER2 107 depends on CRYPTO_MANAGER2
108 help 108 help
109 Run cryptomanager's tests for the new crypto algorithms being 109 Disable run-time self tests that normally take place at
110 registered. 110 algorithm registration.
111 111
112config CRYPTO_GF128MUL 112config CRYPTO_GF128MUL
113 tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" 113 tristate "GF(2^128) multiplication functions (EXPERIMENTAL)"
diff --git a/crypto/ahash.c b/crypto/ahash.c
index b8c59b889c6..f669822a7a4 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -47,8 +47,11 @@ static int hash_walk_next(struct crypto_hash_walk *walk)
47 walk->data = crypto_kmap(walk->pg, 0); 47 walk->data = crypto_kmap(walk->pg, 0);
48 walk->data += offset; 48 walk->data += offset;
49 49
50 if (offset & alignmask) 50 if (offset & alignmask) {
51 nbytes = alignmask + 1 - (offset & alignmask); 51 unsigned int unaligned = alignmask + 1 - (offset & alignmask);
52 if (nbytes > unaligned)
53 nbytes = unaligned;
54 }
52 55
53 walk->entrylen -= nbytes; 56 walk->entrylen -= nbytes;
54 return nbytes; 57 return nbytes;
diff --git a/crypto/algboss.c b/crypto/algboss.c
index 40bd391f34d..791d194958f 100644
--- a/crypto/algboss.c
+++ b/crypto/algboss.c
@@ -206,13 +206,16 @@ err:
206 return NOTIFY_OK; 206 return NOTIFY_OK;
207} 207}
208 208
209#ifdef CONFIG_CRYPTO_MANAGER_TESTS
210static int cryptomgr_test(void *data) 209static int cryptomgr_test(void *data)
211{ 210{
212 struct crypto_test_param *param = data; 211 struct crypto_test_param *param = data;
213 u32 type = param->type; 212 u32 type = param->type;
214 int err = 0; 213 int err = 0;
215 214
215#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
216 goto skiptest;
217#endif
218
216 if (type & CRYPTO_ALG_TESTED) 219 if (type & CRYPTO_ALG_TESTED)
217 goto skiptest; 220 goto skiptest;
218 221
@@ -267,7 +270,6 @@ err_put_module:
267err: 270err:
268 return NOTIFY_OK; 271 return NOTIFY_OK;
269} 272}
270#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
271 273
272static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, 274static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
273 void *data) 275 void *data)
@@ -275,10 +277,8 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
275 switch (msg) { 277 switch (msg) {
276 case CRYPTO_MSG_ALG_REQUEST: 278 case CRYPTO_MSG_ALG_REQUEST:
277 return cryptomgr_schedule_probe(data); 279 return cryptomgr_schedule_probe(data);
278#ifdef CONFIG_CRYPTO_MANAGER_TESTS
279 case CRYPTO_MSG_ALG_REGISTER: 280 case CRYPTO_MSG_ALG_REGISTER:
280 return cryptomgr_schedule_test(data); 281 return cryptomgr_schedule_test(data);
281#endif
282 } 282 }
283 283
284 return NOTIFY_DONE; 284 return NOTIFY_DONE;
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index abd980c729e..fa8c8f78c8d 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -23,7 +23,7 @@
23 23
24#include "internal.h" 24#include "internal.h"
25 25
26#ifndef CONFIG_CRYPTO_MANAGER_TESTS 26#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
27 27
28/* a perfect nop */ 28/* a perfect nop */
29int alg_test(const char *driver, const char *alg, u32 type, u32 mask) 29int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
@@ -2542,6 +2542,6 @@ non_fips_alg:
2542 return -EINVAL; 2542 return -EINVAL;
2543} 2543}
2544 2544
2545#endif /* CONFIG_CRYPTO_MANAGER_TESTS */ 2545#endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
2546 2546
2547EXPORT_SYMBOL_GPL(alg_test); 2547EXPORT_SYMBOL_GPL(alg_test);