Skip to content

Commit

Permalink
crypto: chelsio - stop using crypto_ahash::init
Browse files Browse the repository at this point in the history
The function pointer crypto_ahash::init is an internal implementation
detail of the ahash API that exists to help it support both ahash and
shash algorithms.  With an upcoming refactoring of how the ahash API
supports shash algorithms, this field will be removed.

Some drivers are invoking crypto_ahash::init to call into their own
code, which is unnecessary and inefficient.  The chelsio driver is one
of those drivers.  Make it just call its own code directly.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
  • Loading branch information
Eric Biggers authored and Herbert Xu committed Oct 27, 2023
1 parent 4d707a4 commit 9416210
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/crypto/chelsio/chcr_algo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,9 @@ static int chcr_ahash_finup(struct ahash_request *req)
return error;
}

static int chcr_hmac_init(struct ahash_request *areq);
static int chcr_sha_init(struct ahash_request *areq);

static int chcr_ahash_digest(struct ahash_request *req)
{
struct chcr_ahash_req_ctx *req_ctx = ahash_request_ctx(req);
Expand All @@ -1938,7 +1941,11 @@ static int chcr_ahash_digest(struct ahash_request *req)
req_ctx->rxqidx = cpu % ctx->nrxq;
put_cpu();

rtfm->init(req);
if (is_hmac(crypto_ahash_tfm(rtfm)))
chcr_hmac_init(req);
else
chcr_sha_init(req);

bs = crypto_tfm_alg_blocksize(crypto_ahash_tfm(rtfm));
error = chcr_inc_wrcount(dev);
if (error)
Expand Down

0 comments on commit 9416210

Please sign in to comment.