]> err.no Git - linux-2.6/blobdiff - drivers/crypto/padlock-aes.c
[CRYPTO] padlock: Add compatibility alias after rename
[linux-2.6] / drivers / crypto / padlock-aes.c
index 17ee684144f9d2d54aae8ff95b16f77bdd091965..241052da278782e6875f8176e1fd0c1642ca5e05 100644 (file)
@@ -59,6 +59,9 @@
 #define AES_EXTENDED_KEY_SIZE  64      /* in uint32_t units */
 #define AES_EXTENDED_KEY_SIZE_B        (AES_EXTENDED_KEY_SIZE * sizeof(uint32_t))
 
+/* Whenever making any changes to the following
+ * structure *make sure* you keep E, d_data
+ * and cword aligned on 16 Bytes boundaries!!! */
 struct aes_ctx {
        struct {
                struct cword encrypt;
@@ -66,8 +69,10 @@ struct aes_ctx {
        } cword;
        u32 *D;
        int key_length;
-       u32 E[AES_EXTENDED_KEY_SIZE];
-       u32 d_data[AES_EXTENDED_KEY_SIZE];
+       u32 E[AES_EXTENDED_KEY_SIZE]
+               __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));
+       u32 d_data[AES_EXTENDED_KEY_SIZE]
+               __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));
 };
 
 /* ====== Key management routines ====== */
@@ -490,15 +495,44 @@ static struct crypto_alg aes_alg = {
        }
 };
 
-int __init padlock_init_aes(void)
+static int __init padlock_init(void)
 {
-       printk(KERN_NOTICE PFX "Using VIA PadLock ACE for AES algorithm.\n");
+       int ret;
+
+       if (!cpu_has_xcrypt) {
+               printk(KERN_ERR PFX "VIA PadLock not detected.\n");
+               return -ENODEV;
+       }
+
+       if (!cpu_has_xcrypt_enabled) {
+               printk(KERN_ERR PFX "VIA PadLock detected, but not enabled. Hmm, strange...\n");
+               return -ENODEV;
+       }
 
        gen_tabs();
-       return crypto_register_alg(&aes_alg);
+       if ((ret = crypto_register_alg(&aes_alg))) {
+               printk(KERN_ERR PFX "VIA PadLock AES initialization failed.\n");
+               return ret;
+       }
+
+       printk(KERN_NOTICE PFX "Using VIA PadLock ACE for AES algorithm.\n");
+
+       return ret;
 }
 
-void __exit padlock_fini_aes(void)
+static void __exit padlock_fini(void)
 {
        crypto_unregister_alg(&aes_alg);
 }
+
+module_init(padlock_init);
+module_exit(padlock_fini);
+
+MODULE_DESCRIPTION("VIA PadLock AES algorithm support");
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Michal Ludvig");
+
+MODULE_ALIAS("aes-padlock");
+
+/* This module used to be called padlock. */
+MODULE_ALIAS("padlock");