Commit 7bc53c3f authored by Behan Webster's avatar Behan Webster

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: default avatarBehan Webster <behanw@converseincode.com>
Reviewed-by: default avatarMark Charlebois <charlebm@gmail.com>
Reviewed-by: default avatarJan-Simon Möller <dl9pf@gmx.de>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ce1f3e47
...@@ -949,17 +949,14 @@ static int omap_sham_finish_hmac(struct ahash_request *req) ...@@ -949,17 +949,14 @@ static int omap_sham_finish_hmac(struct ahash_request *req)
struct omap_sham_hmac_ctx *bctx = tctx->base; struct omap_sham_hmac_ctx *bctx = tctx->base;
int bs = crypto_shash_blocksize(bctx->shash); int bs = crypto_shash_blocksize(bctx->shash);
int ds = crypto_shash_digestsize(bctx->shash); int ds = crypto_shash_digestsize(bctx->shash);
struct { SHASH_DESC_ON_STACK(shash, bctx->shash);
struct shash_desc shash;
char ctx[crypto_shash_descsize(bctx->shash)];
} desc;
desc.shash.tfm = bctx->shash; shash->tfm = bctx->shash;
desc.shash.flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */ shash->flags = 0; /* not CRYPTO_TFM_REQ_MAY_SLEEP */
return crypto_shash_init(&desc.shash) ?: return crypto_shash_init(shash) ?:
crypto_shash_update(&desc.shash, bctx->opad, bs) ?: crypto_shash_update(shash, bctx->opad, bs) ?:
crypto_shash_finup(&desc.shash, req->result, ds, req->result); crypto_shash_finup(shash, req->result, ds, req->result);
} }
static int omap_sham_finish(struct ahash_request *req) static int omap_sham_finish(struct ahash_request *req)
...@@ -1118,18 +1115,15 @@ static int omap_sham_update(struct ahash_request *req) ...@@ -1118,18 +1115,15 @@ static int omap_sham_update(struct ahash_request *req)
return omap_sham_enqueue(req, OP_UPDATE); return omap_sham_enqueue(req, OP_UPDATE);
} }
static int omap_sham_shash_digest(struct crypto_shash *shash, u32 flags, static int omap_sham_shash_digest(struct crypto_shash *tfm, u32 flags,
const u8 *data, unsigned int len, u8 *out) const u8 *data, unsigned int len, u8 *out)
{ {
struct { SHASH_DESC_ON_STACK(shash, tfm);
struct shash_desc shash;
char ctx[crypto_shash_descsize(shash)];
} desc;
desc.shash.tfm = shash; shash->tfm = tfm;
desc.shash.flags = flags & CRYPTO_TFM_REQ_MAY_SLEEP; shash->flags = flags & CRYPTO_TFM_REQ_MAY_SLEEP;
return crypto_shash_digest(&desc.shash, data, len, out); return crypto_shash_digest(shash, data, len, out);
} }
static int omap_sham_final_shash(struct ahash_request *req) static int omap_sham_final_shash(struct ahash_request *req)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment