[PATCH] powerpc: oprofile support for POWER6
[powerpc.git] / drivers / crypto / padlock-aes.c
index 963e03d..5158a9d 100644 (file)
@@ -284,7 +284,11 @@ aes_hw_extkey_available(uint8_t key_len)
 
 static inline struct aes_ctx *aes_ctx(void *ctx)
 {
-       return (struct aes_ctx *)ALIGN((unsigned long)ctx, PADLOCK_ALIGNMENT);
+       unsigned long align = PADLOCK_ALIGNMENT;
+
+       if (align <= crypto_tfm_ctx_alignment())
+               align = 1;
+       return (struct aes_ctx *)ALIGN((unsigned long)ctx, align);
 }
 
 static int
@@ -348,10 +352,10 @@ aes_set_key(void *ctx_arg, const uint8_t *in_key, unsigned int key_len, uint32_t
                break;
 
        case 32:
-               E_KEY[4] = le32_to_cpu(in_key[4]);
-               E_KEY[5] = le32_to_cpu(in_key[5]);
-               E_KEY[6] = le32_to_cpu(in_key[6]);
-               t = E_KEY[7] = le32_to_cpu(in_key[7]);
+               E_KEY[4] = le32_to_cpu(key[4]);
+               E_KEY[5] = le32_to_cpu(key[5]);
+               E_KEY[6] = le32_to_cpu(key[6]);
+               t = E_KEY[7] = le32_to_cpu(key[7]);
                for (i = 0; i < 7; ++i)
                        loop8 (i);
                break;
@@ -466,6 +470,8 @@ static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out,
 
 static struct crypto_alg aes_alg = {
        .cra_name               =       "aes",
+       .cra_driver_name        =       "aes-padlock",
+       .cra_priority           =       300,
        .cra_flags              =       CRYPTO_ALG_TYPE_CIPHER,
        .cra_blocksize          =       AES_BLOCK_SIZE,
        .cra_ctxsize            =       sizeof(struct aes_ctx),