]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[CRYPTO] padlock: Helper module padlock.ko
authorMichal Ludvig <michal@logix.cz>
Sun, 6 Aug 2006 12:50:30 +0000 (22:50 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 21 Sep 2006 01:41:00 +0000 (11:41 +1000)
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>
drivers/crypto/Kconfig
drivers/crypto/Makefile
drivers/crypto/padlock-aes.c
drivers/crypto/padlock.c [new file with mode: 0644]

index 910c715325be444ae1f88feca39cc250fd88ea1c..86c99cd333faeea737efeba0815c37535c75216b 100644 (file)
@@ -1,10 +1,10 @@
 menu "Hardware crypto devices"
 
 config CRYPTO_DEV_PADLOCK
-       bool "Support for VIA PadLock ACE"
+       tristate "Support for VIA PadLock ACE"
        depends on X86_32
        select CRYPTO_ALGAPI
-       default y
+       default m
        help
          Some VIA processors come with an integrated crypto engine
          (so called VIA PadLock ACE, Advanced Cryptography Engine)
@@ -12,8 +12,17 @@ config CRYPTO_DEV_PADLOCK
          operations with supported algorithms.
          
          The instructions are used only when the CPU supports them.
-         Otherwise software encryption is used. If you are unsure,
-         say Y.
+         Otherwise software encryption is used.
+
+         Selecting M for this option will compile a helper module
+         padlock.ko that should autoload all below configured
+         algorithms. Don't worry if your hardware does not support
+         some or all of them. In such case padlock.ko will
+         simply write a single line into the kernel log informing
+         about its failure but everything will keep working fine.
+
+         If you are unsure, say M. The compiled module will be
+         called padlock.ko
 
 config CRYPTO_DEV_PADLOCK_AES
        tristate "PadLock driver for AES algorithm"
index df498c7d97ab046dcf8ef896a7790176771ecf3e..4c3d0ec1cf805a8b8407d959b6e085e9a2864460 100644 (file)
@@ -1,2 +1,3 @@
+obj-$(CONFIG_CRYPTO_DEV_PADLOCK) += padlock.o
 obj-$(CONFIG_CRYPTO_DEV_PADLOCK_AES) += padlock-aes.o
 obj-$(CONFIG_CRYPTO_DEV_PADLOCK_SHA) += padlock-sha.o
index 149e54b0ea2e1e195505f95f4fa9f331b82d0408..3a2a71108d352e039e5c82f94bef9e9a33d01dc2 100644 (file)
@@ -544,6 +544,3 @@ MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Michal Ludvig");
 
 MODULE_ALIAS("aes-padlock");
-
-/* This module used to be called padlock. */
-MODULE_ALIAS("padlock");
diff --git a/drivers/crypto/padlock.c b/drivers/crypto/padlock.c
new file mode 100644 (file)
index 0000000..ce58168
--- /dev/null
@@ -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");
+