diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/crypto.h | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 7f946241b879..cb1e6631b132 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -21,8 +21,9 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/types.h> | 22 | #include <linux/types.h> |
23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
24 | #include <linux/slab.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <asm/page.h> | 26 | #include <linux/uaccess.h> |
26 | 27 | ||
27 | /* | 28 | /* |
28 | * Algorithm masks and types. | 29 | * Algorithm masks and types. |
@@ -61,6 +62,26 @@ | |||
61 | #define CRYPTO_DIR_ENCRYPT 1 | 62 | #define CRYPTO_DIR_ENCRYPT 1 |
62 | #define CRYPTO_DIR_DECRYPT 0 | 63 | #define CRYPTO_DIR_DECRYPT 0 |
63 | 64 | ||
65 | /* | ||
66 | * The macro CRYPTO_MINALIGN_ATTR (along with the void * type in the actual | ||
67 | * declaration) is used to ensure that the crypto_tfm context structure is | ||
68 | * aligned correctly for the given architecture so that there are no alignment | ||
69 | * faults for C data types. In particular, this is required on platforms such | ||
70 | * as arm where pointers are 32-bit aligned but there are data types such as | ||
71 | * u64 which require 64-bit alignment. | ||
72 | */ | ||
73 | #if defined(ARCH_KMALLOC_MINALIGN) | ||
74 | #define CRYPTO_MINALIGN ARCH_KMALLOC_MINALIGN | ||
75 | #elif defined(ARCH_SLAB_MINALIGN) | ||
76 | #define CRYPTO_MINALIGN ARCH_SLAB_MINALIGN | ||
77 | #endif | ||
78 | |||
79 | #ifdef CRYPTO_MINALIGN | ||
80 | #define CRYPTO_MINALIGN_ATTR __attribute__ ((__aligned__(CRYPTO_MINALIGN))) | ||
81 | #else | ||
82 | #define CRYPTO_MINALIGN_ATTR | ||
83 | #endif | ||
84 | |||
64 | struct scatterlist; | 85 | struct scatterlist; |
65 | struct crypto_tfm; | 86 | struct crypto_tfm; |
66 | 87 | ||
@@ -231,7 +252,7 @@ struct crypto_tfm { | |||
231 | 252 | ||
232 | struct crypto_alg *__crt_alg; | 253 | struct crypto_alg *__crt_alg; |
233 | 254 | ||
234 | char __crt_ctx[] __attribute__ ((__aligned__)); | 255 | void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; |
235 | }; | 256 | }; |
236 | 257 | ||
237 | /* | 258 | /* |