Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
9416210f 4d707a47

+8 -1
+8 -1
drivers/crypto/chelsio/chcr_algo.c
··· 1920 1920 return error; 1921 1921 } 1922 1922 1923 + static int chcr_hmac_init(struct ahash_request *areq); 1924 + static int chcr_sha_init(struct ahash_request *areq); 1925 + 1923 1926 static int chcr_ahash_digest(struct ahash_request *req) 1924 1927 { 1925 1928 struct chcr_ahash_req_ctx *req_ctx = ahash_request_ctx(req); ··· 1941 1938 req_ctx->rxqidx = cpu % ctx->nrxq; 1942 1939 put_cpu(); 1943 1940 1944 - rtfm->init(req); 1941 + if (is_hmac(crypto_ahash_tfm(rtfm))) 1942 + chcr_hmac_init(req); 1943 + else 1944 + chcr_sha_init(req); 1945 + 1945 1946 bs = crypto_tfm_alg_blocksize(crypto_ahash_tfm(rtfm)); 1946 1947 error = chcr_inc_wrcount(dev); 1947 1948 if (error)