Commit e29ba412 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: omap-sham - use crypto_shash_tfm_digest()

Instead of manually allocating a 'struct shash_desc' on the stack and
calling crypto_shash_digest(), switch to using the new helper function
crypto_shash_tfm_digest() which does this for us.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent ce8e0488
...@@ -1245,16 +1245,6 @@ static int omap_sham_update(struct ahash_request *req) ...@@ -1245,16 +1245,6 @@ 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 *tfm, u32 flags,
const u8 *data, unsigned int len, u8 *out)
{
SHASH_DESC_ON_STACK(shash, tfm);
shash->tfm = tfm;
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)
{ {
struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm); struct omap_sham_ctx *tctx = crypto_tfm_ctx(req->base.tfm);
...@@ -1270,9 +1260,8 @@ static int omap_sham_final_shash(struct ahash_request *req) ...@@ -1270,9 +1260,8 @@ static int omap_sham_final_shash(struct ahash_request *req)
!test_bit(FLAGS_AUTO_XOR, &ctx->dd->flags)) !test_bit(FLAGS_AUTO_XOR, &ctx->dd->flags))
offset = get_block_size(ctx); offset = get_block_size(ctx);
return omap_sham_shash_digest(tctx->fallback, req->base.flags, return crypto_shash_tfm_digest(tctx->fallback, ctx->buffer + offset,
ctx->buffer + offset, ctx->bufcnt - offset, req->result);
ctx->bufcnt - offset, req->result);
} }
static int omap_sham_final(struct ahash_request *req) static int omap_sham_final(struct ahash_request *req)
...@@ -1351,9 +1340,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key, ...@@ -1351,9 +1340,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key,
return err; return err;
if (keylen > bs) { if (keylen > bs) {
err = omap_sham_shash_digest(bctx->shash, err = crypto_shash_tfm_digest(bctx->shash, key, keylen,
crypto_shash_get_flags(bctx->shash), bctx->ipad);
key, keylen, bctx->ipad);
if (err) if (err)
return err; return err;
keylen = ds; keylen = ds;
......
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