diff options
author | Sebastian Siewior <sebastian@breakpoint.cc> | 2007-10-07 23:45:10 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:50 -0400 |
commit | ad5d27899fdbe7a66e57fdf1af883dbd7ff88dac (patch) | |
tree | 666a5809fd9a01e0798411b94962903c3431400c /drivers/crypto | |
parent | f8246af005d56b73f4f04304fc5b6fd9878af4ef (diff) |
[CRYPTO] sha: Load the SHA[1|256] module by an alias
Loading the crypto algorithm by the alias instead of by module directly
has the advantage that all possible implementations of this algorithm
are loaded automatically and the crypto API can choose the best one
depending on its priority.
Additionally it ensures that the generic implementation as well as the
HW driver (if available) is loaded in case the HW driver needs the
generic version as fallback in corner cases.
Also remove the probe for sha1 in padlock's init code.
Quote from Herbert:
The probe is actually pointless since we can always probe when
the algorithm is actually used which does not lead to dead-locks
like this.
Signed-off-by: Sebastian Siewior <sebastian@breakpoint.cc>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/padlock-sha.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/drivers/crypto/padlock-sha.c b/drivers/crypto/padlock-sha.c index a781fd23b607..f3857bbbfae3 100644 --- a/drivers/crypto/padlock-sha.c +++ b/drivers/crypto/padlock-sha.c | |||
@@ -253,19 +253,6 @@ static struct crypto_alg sha256_alg = { | |||
253 | } | 253 | } |
254 | }; | 254 | }; |
255 | 255 | ||
256 | static void __init padlock_sha_check_fallbacks(void) | ||
257 | { | ||
258 | if (!crypto_has_hash("sha1", 0, CRYPTO_ALG_ASYNC | | ||
259 | CRYPTO_ALG_NEED_FALLBACK)) | ||
260 | printk(KERN_WARNING PFX | ||
261 | "Couldn't load fallback module for sha1.\n"); | ||
262 | |||
263 | if (!crypto_has_hash("sha256", 0, CRYPTO_ALG_ASYNC | | ||
264 | CRYPTO_ALG_NEED_FALLBACK)) | ||
265 | printk(KERN_WARNING PFX | ||
266 | "Couldn't load fallback module for sha256.\n"); | ||
267 | } | ||
268 | |||
269 | static int __init padlock_init(void) | 256 | static int __init padlock_init(void) |
270 | { | 257 | { |
271 | int rc = -ENODEV; | 258 | int rc = -ENODEV; |
@@ -280,8 +267,6 @@ static int __init padlock_init(void) | |||
280 | return -ENODEV; | 267 | return -ENODEV; |
281 | } | 268 | } |
282 | 269 | ||
283 | padlock_sha_check_fallbacks(); | ||
284 | |||
285 | rc = crypto_register_alg(&sha1_alg); | 270 | rc = crypto_register_alg(&sha1_alg); |
286 | if (rc) | 271 | if (rc) |
287 | goto out; | 272 | goto out; |
@@ -314,5 +299,7 @@ MODULE_DESCRIPTION("VIA PadLock SHA1/SHA256 algorithms support."); | |||
314 | MODULE_LICENSE("GPL"); | 299 | MODULE_LICENSE("GPL"); |
315 | MODULE_AUTHOR("Michal Ludvig"); | 300 | MODULE_AUTHOR("Michal Ludvig"); |
316 | 301 | ||
302 | MODULE_ALIAS("sha1"); | ||
303 | MODULE_ALIAS("sha256"); | ||
317 | MODULE_ALIAS("sha1-padlock"); | 304 | MODULE_ALIAS("sha1-padlock"); |
318 | MODULE_ALIAS("sha256-padlock"); | 305 | MODULE_ALIAS("sha256-padlock"); |