Skip to content

Commit 9416210

Browse files
ebiggersherbertx
authored andcommitted
crypto: chelsio - stop using crypto_ahash::init
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 <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 4d707a4 commit 9416210

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/crypto/chelsio/chcr_algo.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1920,6 +1920,9 @@ static int chcr_ahash_finup(struct ahash_request *req)
19201920
return error;
19211921
}
19221922

1923+
static int chcr_hmac_init(struct ahash_request *areq);
1924+
static int chcr_sha_init(struct ahash_request *areq);
1925+
19231926
static int chcr_ahash_digest(struct ahash_request *req)
19241927
{
19251928
struct chcr_ahash_req_ctx *req_ctx = ahash_request_ctx(req);
@@ -1938,7 +1941,11 @@ static int chcr_ahash_digest(struct ahash_request *req)
19381941
req_ctx->rxqidx = cpu % ctx->nrxq;
19391942
put_cpu();
19401943

1941-
rtfm->init(req);
1944+
if (is_hmac(crypto_ahash_tfm(rtfm)))
1945+
chcr_hmac_init(req);
1946+
else
1947+
chcr_sha_init(req);
1948+
19421949
bs = crypto_tfm_alg_blocksize(crypto_ahash_tfm(rtfm));
19431950
error = chcr_inc_wrcount(dev);
19441951
if (error)

0 commit comments

Comments
 (0)