summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/padlock.c
diff options
context:
space:
mode:
authorMichal Ludvig <michal@logix.cz>2006-08-06 22:50:30 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2006-09-21 11:41:00 +1000
commit5644bda5d6aa17a70b8842eb56365d501a5da159 (patch)
treeac19f321bdc0dfa081e4ea7348584f516f6a7e7b /drivers/crypto/padlock.c
parentcb17530b0a4e01bd595a7ac437467a1a9833a15c (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/padlock.c')
-rw-r--r--drivers/crypto/padlock.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/crypto/padlock.c b/drivers/crypto/padlock.c
new file mode 100644
index 00000000000..ce581684f4b
--- /dev/null
+++ b/drivers/crypto/padlock.c
@@ -0,0 +1,58 @@
+/*
+ * Cryptographic API.
+ *
+ * Support for VIA PadLock hardware crypto engine.
+ *
+ * Copyright (c) 2006 Michal Ludvig <michal@logix.cz>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/crypto.h>
+#include <linux/cryptohash.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/scatterlist.h>
+#include "padlock.h"
+
+static int __init padlock_init(void)
+{
+ int success = 0;
+
+ if (crypto_alg_available("aes-padlock", 0))
+ success++;
+
+ if (crypto_alg_available("sha1-padlock", 0))
+ success++;
+
+ if (crypto_alg_available("sha256-padlock", 0))
+ success++;
+
+ if (!success) {
+ printk(KERN_WARNING PFX "No VIA PadLock drivers have been loaded.\n");
+ return -ENODEV;
+ }
+
+ printk(KERN_NOTICE PFX "%d drivers are available.\n", success);
+
+ return 0;
+}
+
+static void __exit padlock_fini(void)
+{
+}
+
+module_init(padlock_init);
+module_exit(padlock_fini);
+
+MODULE_DESCRIPTION("Load all configured PadLock algorithms.");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Michal Ludvig");
+