diff options
author | Michal Ludvig <michal@logix.cz> | 2006-08-06 08:50:30 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2006-09-20 21:41:00 -0400 |
commit | 5644bda5d6aa17a70b8842eb56365d501a5da159 (patch) | |
tree | ac19f321bdc0dfa081e4ea7348584f516f6a7e7b /drivers/crypto | |
parent | cb17530b0a4e01bd595a7ac437467a1a9833a15c (diff) |
[CRYPTO] padlock: Helper module padlock.ko
Compile a helper module padlock.ko that will try
to autoload all configured padlock algorithms.
This also provides backward compatibility with
the ancient times before padlock.ko was renamed
to padlock-aes.ko
Signed-off-by: Michal Ludvig <michal@logix.cz>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/Kconfig | 17 | ||||
-rw-r--r-- | drivers/crypto/Makefile | 1 | ||||
-rw-r--r-- | drivers/crypto/padlock-aes.c | 3 | ||||
-rw-r--r-- | drivers/crypto/padlock.c | 58 |
4 files changed, 72 insertions, 7 deletions
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 910c715325be..86c99cd333fa 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
@@ -1,10 +1,10 @@ | |||
1 | menu "Hardware crypto devices" | 1 | menu "Hardware crypto devices" |
2 | 2 | ||
3 | config CRYPTO_DEV_PADLOCK | 3 | config CRYPTO_DEV_PADLOCK |
4 | bool "Support for VIA PadLock ACE" | 4 | tristate "Support for VIA PadLock ACE" |
5 | depends on X86_32 | 5 | depends on X86_32 |
6 | select CRYPTO_ALGAPI | 6 | select CRYPTO_ALGAPI |
7 | default y | 7 | default m |
8 | help | 8 | help |
9 | Some VIA processors come with an integrated crypto engine | 9 | Some VIA processors come with an integrated crypto engine |
10 | (so called VIA PadLock ACE, Advanced Cryptography Engine) | 10 | (so called VIA PadLock ACE, Advanced Cryptography Engine) |
@@ -12,8 +12,17 @@ config CRYPTO_DEV_PADLOCK | |||
12 | operations with supported algorithms. | 12 | operations with supported algorithms. |
13 | 13 | ||
14 | The instructions are used only when the CPU supports them. | 14 | The instructions are used only when the CPU supports them. |
15 | Otherwise software encryption is used. If you are unsure, | 15 | Otherwise software encryption is used. |
16 | say Y. | 16 | |
17 | Selecting M for this option will compile a helper module | ||
18 | padlock.ko that should autoload all below configured | ||
19 | algorithms. Don't worry if your hardware does not support | ||
20 | some or all of them. In such case padlock.ko will | ||
21 | simply write a single line into the kernel log informing | ||
22 | about its failure but everything will keep working fine. | ||
23 | |||
24 | If you are unsure, say M. The compiled module will be | ||
25 | called padlock.ko | ||
17 | 26 | ||
18 | config CRYPTO_DEV_PADLOCK_AES | 27 | config CRYPTO_DEV_PADLOCK_AES |
19 | tristate "PadLock driver for AES algorithm" | 28 | tristate "PadLock driver for AES algorithm" |
diff --git a/drivers/crypto/Makefile b/drivers/crypto/Makefile index df498c7d97ab..4c3d0ec1cf80 100644 --- a/drivers/crypto/Makefile +++ b/drivers/crypto/Makefile | |||
@@ -1,2 +1,3 @@ | |||
1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o | ||
1 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o | 2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o |
2 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o | 3 | obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 149e54b0ea2e..3a2a71108d35 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
@@ -544,6 +544,3 @@ MODULE_LICENSE("GPL"); | |||
544 | MODULE_AUTHOR("Michal Ludvig"); | 544 | MODULE_AUTHOR("Michal Ludvig"); |
545 | 545 | ||
546 | MODULE_ALIAS("aes-padlock"); | 546 | MODULE_ALIAS("aes-padlock"); |
547 | |||
548 | /* This module used to be called padlock. */ | ||
549 | MODULE_ALIAS("padlock"); | ||
diff --git a/drivers/crypto/padlock.c b/drivers/crypto/padlock.c new file mode 100644 index 000000000000..ce581684f4b4 --- /dev/null +++ b/drivers/crypto/padlock.c | |||
@@ -0,0 +1,58 @@ | |||
1 | /* | ||
2 | * Cryptographic API. | ||
3 | * | ||
4 | * Support for VIA PadLock hardware crypto engine. | ||
5 | * | ||
6 | * Copyright (c) 2006 Michal Ludvig <michal@logix.cz> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | */ | ||
14 | |||
15 | #include <linux/module.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/crypto.h> | ||
19 | #include <linux/cryptohash.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/scatterlist.h> | ||
23 | #include "padlock.h" | ||
24 | |||
25 | static int __init padlock_init(void) | ||
26 | { | ||
27 | int success = 0; | ||
28 | |||
29 | if (crypto_alg_available("aes-padlock", 0)) | ||
30 | success++; | ||
31 | |||
32 | if (crypto_alg_available("sha1-padlock", 0)) | ||
33 | success++; | ||
34 | |||
35 | if (crypto_alg_available("sha256-padlock", 0)) | ||
36 | success++; | ||
37 | |||
38 | if (!success) { | ||
39 | printk(KERN_WARNING PFX "No VIA PadLock drivers have been loaded.\n"); | ||
40 | return -ENODEV; | ||
41 | } | ||
42 | |||
43 | printk(KERN_NOTICE PFX "%d drivers are available.\n", success); | ||
44 | |||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static void __exit padlock_fini(void) | ||
49 | { | ||
50 | } | ||
51 | |||
52 | module_init(padlock_init); | ||
53 | module_exit(padlock_fini); | ||
54 | |||
55 | MODULE_DESCRIPTION("Load all configured PadLock algorithms."); | ||
56 | MODULE_LICENSE("GPL"); | ||
57 | MODULE_AUTHOR("Michal Ludvig"); | ||
58 | |||