diff options
author | Vinícius Tinti <viniciustinti@gmail.com> | 2014-04-04 18:18:00 -0300 |
---|---|---|
committer | Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org> | 2016-04-06 01:57:22 +0200 |
commit | e013b9c0fe4f9cef22af51c290b2a0da5a11fb95 (patch) | |
tree | f3e401739e2e390c77e0cf421ecc0b1e61b923b1 /security | |
parent | 3ae56c19a6847ae9a2ba43374b99e7ab0ec8275b (diff) |
apparmor: LLVMLinux: Remove VLAIS
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This patch instead allocates the appropriate amount of
memory using a char array using the SHASH_DESC_ON_STACK macro.
The new code can be compiled with both gcc and clang.
Signed-off-by: Vinícius Tinti <viniciustinti@gmail.com>
Reviewed-by: Jan-Simon Möller <dl9pf@gmx.de>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'security')
-rw-r--r-- | security/apparmor/crypto.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/security/apparmor/crypto.c b/security/apparmor/crypto.c index 532471d0b3a0..c948247e90c2 100644 --- a/security/apparmor/crypto.c +++ b/security/apparmor/crypto.c @@ -32,10 +32,7 @@ unsigned int aa_hash_size(void) int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, size_t len) { - struct { - struct shash_desc shash; - char ctx[crypto_shash_descsize(apparmor_tfm)]; - } desc; + SHASH_DESC_ON_STACK(shash, apparmor_tfm); int error = -ENOMEM; u32 le32_version = cpu_to_le32(version); @@ -46,19 +43,19 @@ int aa_calc_profile_hash(struct aa_profile *profile, u32 version, void *start, if (!profile->hash) goto fail; - desc.shash.tfm = apparmor_tfm; - desc.shash.flags = 0; + shash->tfm = apparmor_tfm; + shash->flags = 0; - error = crypto_shash_init(&desc.shash); + error = crypto_shash_init(shash); if (error) goto fail; - error = crypto_shash_update(&desc.shash, (u8 *) &le32_version, 4); + error = crypto_shash_update(shash, (u8 *) &le32_version, 4); if (error) goto fail; - error = crypto_shash_update(&desc.shash, (u8 *) start, len); + error = crypto_shash_update(shash, (u8 *) start, len); if (error) goto fail; - error = crypto_shash_final(&desc.shash, profile->hash); + error = crypto_shash_final(shash, profile->hash); if (error) goto fail; |