Commit 61f953cb authored by Linus Torvalds's avatar Linus Torvalds

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
parents a44a553f 50b6e71a
...@@ -101,13 +101,13 @@ config CRYPTO_MANAGER2 ...@@ -101,13 +101,13 @@ config CRYPTO_MANAGER2
select CRYPTO_BLKCIPHER2 select CRYPTO_BLKCIPHER2
select CRYPTO_PCOMP2 select CRYPTO_PCOMP2
config CRYPTO_MANAGER_TESTS config CRYPTO_MANAGER_DISABLE_TESTS
bool "Run algolithms' self-tests" bool "Disable run-time self tests"
default y default y
depends on CRYPTO_MANAGER2 depends on CRYPTO_MANAGER2
help help
Run cryptomanager's tests for the new crypto algorithms being Disable run-time self tests that normally take place at
registered. algorithm registration.
config CRYPTO_GF128MUL config CRYPTO_GF128MUL
tristate "GF(2^128) multiplication functions (EXPERIMENTAL)" tristate "GF(2^128) multiplication functions (EXPERIMENTAL)"
......
...@@ -47,8 +47,11 @@ static int hash_walk_next(struct crypto_hash_walk *walk) ...@@ -47,8 +47,11 @@ static int hash_walk_next(struct crypto_hash_walk *walk)
walk->data = crypto_kmap(walk->pg, 0); walk->data = crypto_kmap(walk->pg, 0);
walk->data += offset; walk->data += offset;
if (offset & alignmask) if (offset & alignmask) {
nbytes = alignmask + 1 - (offset & alignmask); unsigned int unaligned = alignmask + 1 - (offset & alignmask);
if (nbytes > unaligned)
nbytes = unaligned;
}
walk->entrylen -= nbytes; walk->entrylen -= nbytes;
return nbytes; return nbytes;
......
...@@ -206,13 +206,16 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval) ...@@ -206,13 +206,16 @@ static int cryptomgr_schedule_probe(struct crypto_larval *larval)
return NOTIFY_OK; return NOTIFY_OK;
} }
#ifdef CONFIG_CRYPTO_MANAGER_TESTS
static int cryptomgr_test(void *data) static int cryptomgr_test(void *data)
{ {
struct crypto_test_param *param = data; struct crypto_test_param *param = data;
u32 type = param->type; u32 type = param->type;
int err = 0; int err = 0;
#ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
goto skiptest;
#endif
if (type & CRYPTO_ALG_TESTED) if (type & CRYPTO_ALG_TESTED)
goto skiptest; goto skiptest;
...@@ -267,7 +270,6 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg) ...@@ -267,7 +270,6 @@ static int cryptomgr_schedule_test(struct crypto_alg *alg)
err: err:
return NOTIFY_OK; return NOTIFY_OK;
} }
#endif /* CONFIG_CRYPTO_MANAGER_TESTS */
static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
void *data) void *data)
...@@ -275,10 +277,8 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg, ...@@ -275,10 +277,8 @@ static int cryptomgr_notify(struct notifier_block *this, unsigned long msg,
switch (msg) { switch (msg) {
case CRYPTO_MSG_ALG_REQUEST: case CRYPTO_MSG_ALG_REQUEST:
return cryptomgr_schedule_probe(data); return cryptomgr_schedule_probe(data);
#ifdef CONFIG_CRYPTO_MANAGER_TESTS
case CRYPTO_MSG_ALG_REGISTER: case CRYPTO_MSG_ALG_REGISTER:
return cryptomgr_schedule_test(data); return cryptomgr_schedule_test(data);
#endif
} }
return NOTIFY_DONE; return NOTIFY_DONE;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "internal.h" #include "internal.h"
#ifndef CONFIG_CRYPTO_MANAGER_TESTS #ifdef CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
/* a perfect nop */ /* a perfect nop */
int alg_test(const char *driver, const char *alg, u32 type, u32 mask) int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
...@@ -2542,6 +2542,6 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask) ...@@ -2542,6 +2542,6 @@ int alg_test(const char *driver, const char *alg, u32 type, u32 mask)
return -EINVAL; return -EINVAL;
} }
#endif /* CONFIG_CRYPTO_MANAGER_TESTS */ #endif /* CONFIG_CRYPTO_MANAGER_DISABLE_TESTS */
EXPORT_SYMBOL_GPL(alg_test); EXPORT_SYMBOL_GPL(alg_test);
...@@ -387,7 +387,7 @@ static int n2rng_init_control(struct n2rng *np) ...@@ -387,7 +387,7 @@ static int n2rng_init_control(struct n2rng *np)
static int n2rng_data_read(struct hwrng *rng, u32 *data) static int n2rng_data_read(struct hwrng *rng, u32 *data)
{ {
struct n2rng *np = rng->priv; struct n2rng *np = (struct n2rng *) rng->priv;
unsigned long ra = __pa(&np->test_data); unsigned long ra = __pa(&np->test_data);
int len; int len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment