Skip to content

Commit 9826d1d

Browse files
ebiggersherbertx
authored andcommitted
crypto: talitos - 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 talitos 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 9416210 commit 9826d1d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

drivers/crypto/talitos.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2119,13 +2119,14 @@ static int ahash_finup(struct ahash_request *areq)
21192119

21202120
static int ahash_digest(struct ahash_request *areq)
21212121
{
2122-
struct talitos_ahash_req_ctx *req_ctx = ahash_request_ctx(areq);
2123-
struct crypto_ahash *ahash = crypto_ahash_reqtfm(areq);
2124-
2125-
ahash->init(areq);
2126-
req_ctx->last = 1;
2122+
ahash_init(areq);
2123+
return ahash_finup(areq);
2124+
}
21272125

2128-
return ahash_process_req(areq, areq->nbytes);
2126+
static int ahash_digest_sha224_swinit(struct ahash_request *areq)
2127+
{
2128+
ahash_init_sha224_swinit(areq);
2129+
return ahash_finup(areq);
21292130
}
21302131

21312132
static int ahash_export(struct ahash_request *areq, void *out)
@@ -3240,6 +3241,8 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
32403241
(!strcmp(alg->cra_name, "sha224") ||
32413242
!strcmp(alg->cra_name, "hmac(sha224)"))) {
32423243
t_alg->algt.alg.hash.init = ahash_init_sha224_swinit;
3244+
t_alg->algt.alg.hash.digest =
3245+
ahash_digest_sha224_swinit;
32433246
t_alg->algt.desc_hdr_template =
32443247
DESC_HDR_TYPE_COMMON_NONSNOOP_NO_AFEU |
32453248
DESC_HDR_SEL0_MDEUA |

0 commit comments

Comments
 (0)