diff options
| author | Gideon Israel Dsouza <gidisrael@gmail.com> | 2016-12-31 06:56:23 -0900 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2017-01-12 07:24:39 -0900 |
| commit | d8c34b949d8c9f61e099e00f22770e400adf2b76 (patch) | |
| tree | 748dafb61696c949ed7c885aef4eb68610f543b4 /crypto/shash.c | |
| parent | d2110224a66779fc2c833d2c16caa73e2e23591e (diff) | |
| download | linux-stable-d8c34b949d8c9f61e099e00f22770e400adf2b76.tar.gz linux-stable-d8c34b949d8c9f61e099e00f22770e400adf2b76.tar.bz2 linux-stable-d8c34b949d8c9f61e099e00f22770e400adf2b76.tar.xz linux-stable-d8c34b949d8c9f61e099e00f22770e400adf2b76.zip | |
crypto: Replaced gcc specific attributes with macros from compiler.h
Continuing from this commit: 52f5684c8e1e
("kernel: use macros from compiler.h instead of __attribute__((...))")
I submitted 4 total patches. They are part of task I've taken up to
increase compiler portability in the kernel. I've cleaned up the
subsystems under /kernel /mm /block and /security, this patch targets
/crypto.
There is <linux/compiler.h> which provides macros for various gcc specific
constructs. Eg: __weak for __attribute__((weak)). I've cleaned all
instances of gcc specific attributes with the right macros for the crypto
subsystem.
I had to make one additional change into compiler-gcc.h for the case when
one wants to use this: __attribute__((aligned) and not specify an alignment
factor. From the gcc docs, this will result in the largest alignment for
that data type on the target machine so I've named the macro
__aligned_largest. Please advise if another name is more appropriate.
Signed-off-by: Gideon Israel Dsouza <gidisrael@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/shash.c')
| -rw-r--r-- | crypto/shash.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/crypto/shash.c b/crypto/shash.c index a051541a4a17..5e31c8d776df 100644 --- a/crypto/shash.c +++ b/crypto/shash.c | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
| 20 | #include <linux/cryptouser.h> | 20 | #include <linux/cryptouser.h> |
| 21 | #include <net/netlink.h> | 21 | #include <net/netlink.h> |
| 22 | #include <linux/compiler.h> | ||
| 22 | 23 | ||
| 23 | #include "internal.h" | 24 | #include "internal.h" |
| 24 | 25 | ||
| @@ -67,7 +68,7 @@ EXPORT_SYMBOL_GPL(crypto_shash_setkey); | |||
| 67 | static inline unsigned int shash_align_buffer_size(unsigned len, | 68 | static inline unsigned int shash_align_buffer_size(unsigned len, |
| 68 | unsigned long mask) | 69 | unsigned long mask) |
| 69 | { | 70 | { |
| 70 | typedef u8 __attribute__ ((aligned)) u8_aligned; | 71 | typedef u8 __aligned_largest u8_aligned; |
| 71 | return len + (mask & ~(__alignof__(u8_aligned) - 1)); | 72 | return len + (mask & ~(__alignof__(u8_aligned) - 1)); |
| 72 | } | 73 | } |
| 73 | 74 | ||
| @@ -80,7 +81,7 @@ static int shash_update_unaligned(struct shash_desc *desc, const u8 *data, | |||
| 80 | unsigned int unaligned_len = alignmask + 1 - | 81 | unsigned int unaligned_len = alignmask + 1 - |
| 81 | ((unsigned long)data & alignmask); | 82 | ((unsigned long)data & alignmask); |
| 82 | u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)] | 83 | u8 ubuf[shash_align_buffer_size(unaligned_len, alignmask)] |
| 83 | __attribute__ ((aligned)); | 84 | __aligned_largest; |
| 84 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); | 85 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); |
| 85 | int err; | 86 | int err; |
| 86 | 87 | ||
| @@ -116,7 +117,7 @@ static int shash_final_unaligned(struct shash_desc *desc, u8 *out) | |||
| 116 | struct shash_alg *shash = crypto_shash_alg(tfm); | 117 | struct shash_alg *shash = crypto_shash_alg(tfm); |
| 117 | unsigned int ds = crypto_shash_digestsize(tfm); | 118 | unsigned int ds = crypto_shash_digestsize(tfm); |
| 118 | u8 ubuf[shash_align_buffer_size(ds, alignmask)] | 119 | u8 ubuf[shash_align_buffer_size(ds, alignmask)] |
| 119 | __attribute__ ((aligned)); | 120 | __aligned_largest; |
| 120 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); | 121 | u8 *buf = PTR_ALIGN(&ubuf[0], alignmask + 1); |
| 121 | int err; | 122 | int err; |
| 122 | 123 | ||
| @@ -403,7 +404,7 @@ static int crypto_shash_report(struct sk_buff *skb, struct crypto_alg *alg) | |||
| 403 | #endif | 404 | #endif |
| 404 | 405 | ||
| 405 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 406 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
| 406 | __attribute__ ((unused)); | 407 | __maybe_unused; |
| 407 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) | 408 | static void crypto_shash_show(struct seq_file *m, struct crypto_alg *alg) |
| 408 | { | 409 | { |
| 409 | struct shash_alg *salg = __crypto_shash_alg(alg); | 410 | struct shash_alg *salg = __crypto_shash_alg(alg); |
