api: Fixed crypto_tfm context alignment
Herbert Xu
maintainerHi:
[CRYPTO] api: Fixed crypto_tfm context alignment
Previously the __aligned__ attribute was added to the crypto_tfm context member to ensure it is alinged correctly on architectures such as arm. Unfortunately kmalloc does not use the same minimum alignment rules as gcc so this is useless.
This patch changes it to use kmalloc's minimum alignment.
Signed-off-by Herbert Xu <[email protected]>
Cheers,
Signature · 5 lines
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--include/linux/crypto.h +11 -2
@@ -21,8 +21,9 @@ #include <linux/module.h>#include <linux/kernel.h> #include <linux/types.h> #include <linux/list.h> +#include <linux/slab.h> #include <linux/string.h> -#include <asm/page.h> +#include <linux/uaccess.h> /* * Algorithm masks and types.
@@ -61,6 +62,14 @@ #define CRYPTO_MAX_ALG_NAME 64#define CRYPTO_DIR_ENCRYPT 1#define CRYPTO_DIR_DECRYPT 0 +#if defined(ARCH_KMALLOC_MINALIGN ) +#define CRYPTO_MINALIGN_ATTR __attribute__ ((ARCH_KMALLOC_MINALIGN)) +#elif defined(ARCH_SLAB_MINALIGN ) +#define CRYPTO_MINALIGN_ATTR __attribute__ ((ARCH_SLAB_MINALIGN)) +#else +#define CRYPTO_MINALIGN_ATTR +#endif +struct scatterlist ;struct crypto_tfm ;
@@ -231,7 +240,7 @@ struct crypto_tfm {struct crypto_alg *__crt_alg; - char __crt_ctx[] __attribute__ ((__aligned__)); + void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; };/*