diff options
author | Behan Webster <behanw@converseincode.com> | 2014-04-04 17:18:00 -0400 |
---|---|---|
committer | Behan Webster <behanw@converseincode.com> | 2014-10-14 04:51:23 -0400 |
commit | 7bc53c3f9ac8c0d6b6ffa92b4b7493576233e78e (patch) | |
tree | 9505fdcacf1bc7824f1c45cea5c1e61bfc3a8163 /drivers/crypto | |
parent | ce1f3e47d9d11ffde75d06170304dc9ff2afe0c6 (diff) |
crypto: LLVMLinux: Remove VLAIS from crypto/omap_sham.c
Replaced the use of a Variable Length Array In Struct (VLAIS) with a C99
compliant equivalent. This patch 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: Behan Webster <behanw@converseincode.com>
Reviewed-by: Mark Charlebois <charlebm@gmail.com>
Reviewed-by: Jan-Simon Möller <dl9pf@gmx.de>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/omap-sham.c | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/crypto/omap-sham.c b/drivers/crypto/omap-sham.c index 710d86386965..24ef48965e45 100644 --- a/drivers/crypto/omap-sham.c +++ b/drivers/crypto/omap-sham.c | |||
@@ -949,17 +949,14 @@ static int omap_sham_finish_hmac(struct ahash_request *req) | |||
949 | struct omap_sham_hmac_ctx *bctx = tctx->base; | 949 | struct omap_sham_hmac_ctx *bctx = tctx->base; |
950 | int bs = crypto_shash_blocksize(bctx->shash); | 950 | int bs = crypto_shash_blocksize(bctx->shash); |
951 | int ds = crypto_shash_digestsize(bctx->shash); | 951 | int ds = crypto_shash_digestsize(bctx->shash); |
952 | struct { | 952 | SHASH_DESC_ON_STACK(shash, bctx->shash); |
953 | struct shash_desc shash; | ||
954 | char ctx[crypto_shash_descsize(bctx->shash)]; | ||
955 | } desc; | ||
956 | 953 | ||
957 | desc.shash.tfm = bctx->shash; | 954 | shash->tfm = bctx->shash; |
958 | desc.shash.flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */ | 955 | shash->flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */ |
959 | 956 | ||
960 | return crypto_shash_init(&desc.shash) ?: | 957 | return crypto_shash_init(shash) ?: |
961 | crypto_shash_update(&desc.shash, bctx->opad, bs) ?: | 958 | crypto_shash_update(shash, bctx->opad, bs) ?: |
962 | crypto_shash_finup(&desc.shash, req->result, ds, req->result); | 959 | crypto_shash_finup(shash, req->result, ds, req->result); |
963 | } | 960 | } |
964 | 961 | ||
965 | static int omap_sham_finish(struct ahash_request *req) | 962 | static int omap_sham_finish(struct ahash_request *req) |
@@ -1118,18 +1115,15 @@ static int omap_sham_update(struct ahash_request *req) | |||
1118 | return omap_sham_enqueue(req, OP_UPDATE); | 1115 | return omap_sham_enqueue(req, OP_UPDATE); |
1119 | } | 1116 | } |
1120 | 1117 | ||
1121 | static int omap_sham_shash_digest(struct crypto_shash *shash, u32 flags, | 1118 | static int omap_sham_shash_digest(struct crypto_shash *tfm, u32 flags, |
1122 | const u8 *data, unsigned int len, u8 *out) | 1119 | const u8 *data, unsigned int len, u8 *out) |
1123 | { | 1120 | { |
1124 | struct { | 1121 | SHASH_DESC_ON_STACK(shash, tfm); |
1125 | struct shash_desc shash; | ||
1126 | char ctx[crypto_shash_descsize(shash)]; | ||
1127 | } desc; | ||
1128 | 1122 | ||
1129 | desc.shash.tfm = shash; | 1123 | shash->tfm = tfm; |
1130 | desc.shash.flags = flags & CRYPTO_TFM_REQ_MAY_SLEEP; | 1124 | shash->flags = flags & CRYPTO_TFM_REQ_MAY_SLEEP; |
1131 | 1125 | ||
1132 | return crypto_shash_digest(&desc.shash, data, len, out); | 1126 | return crypto_shash_digest(shash, data, len, out); |
1133 | } | 1127 | } |
1134 | 1128 | ||
1135 | static int omap_sham_final_shash(struct ahash_request *req) | 1129 | static int omap_sham_final_shash(struct ahash_request *req) |