diff options
-rw-r--r-- | crypto/cryptd.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index fbd26f9dd329..2eb705822f2b 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -478,6 +478,29 @@ static int cryptd_hash_final_enqueue(struct ahash_request *req) | |||
478 | return cryptd_hash_enqueue(req, cryptd_hash_final); | 478 | return cryptd_hash_enqueue(req, cryptd_hash_final); |
479 | } | 479 | } |
480 | 480 | ||
481 | static void cryptd_hash_finup(struct crypto_async_request *req_async, int err) | ||
482 | { | ||
483 | struct ahash_request *req = ahash_request_cast(req_async); | ||
484 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | ||
485 | |||
486 | if (unlikely(err == -EINPROGRESS)) | ||
487 | goto out; | ||
488 | |||
489 | err = shash_ahash_finup(req, &rctx->desc); | ||
490 | |||
491 | req->base.complete = rctx->complete; | ||
492 | |||
493 | out: | ||
494 | local_bh_disable(); | ||
495 | rctx->complete(&req->base, err); | ||
496 | local_bh_enable(); | ||
497 | } | ||
498 | |||
499 | static int cryptd_hash_finup_enqueue(struct ahash_request *req) | ||
500 | { | ||
501 | return cryptd_hash_enqueue(req, cryptd_hash_finup); | ||
502 | } | ||
503 | |||
481 | static void cryptd_hash_digest(struct crypto_async_request *req_async, int err) | 504 | static void cryptd_hash_digest(struct crypto_async_request *req_async, int err) |
482 | { | 505 | { |
483 | struct cryptd_hash_ctx *ctx = crypto_tfm_ctx(req_async->tfm); | 506 | struct cryptd_hash_ctx *ctx = crypto_tfm_ctx(req_async->tfm); |
@@ -507,6 +530,20 @@ static int cryptd_hash_digest_enqueue(struct ahash_request *req) | |||
507 | return cryptd_hash_enqueue(req, cryptd_hash_digest); | 530 | return cryptd_hash_enqueue(req, cryptd_hash_digest); |
508 | } | 531 | } |
509 | 532 | ||
533 | static int cryptd_hash_export(struct ahash_request *req, void *out) | ||
534 | { | ||
535 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | ||
536 | |||
537 | return crypto_shash_export(&rctx->desc, out); | ||
538 | } | ||
539 | |||
540 | static int cryptd_hash_import(struct ahash_request *req, const void *in) | ||
541 | { | ||
542 | struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); | ||
543 | |||
544 | return crypto_shash_import(&rctx->desc, in); | ||
545 | } | ||
546 | |||
510 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, | 547 | static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, |
511 | struct cryptd_queue *queue) | 548 | struct cryptd_queue *queue) |
512 | { | 549 | { |
@@ -546,6 +583,9 @@ static int cryptd_create_hash(struct crypto_template *tmpl, struct rtattr **tb, | |||
546 | inst->alg.init = cryptd_hash_init_enqueue; | 583 | inst->alg.init = cryptd_hash_init_enqueue; |
547 | inst->alg.update = cryptd_hash_update_enqueue; | 584 | inst->alg.update = cryptd_hash_update_enqueue; |
548 | inst->alg.final = cryptd_hash_final_enqueue; | 585 | inst->alg.final = cryptd_hash_final_enqueue; |
586 | inst->alg.finup = cryptd_hash_finup_enqueue; | ||
587 | inst->alg.export = cryptd_hash_export; | ||
588 | inst->alg.import = cryptd_hash_import; | ||
549 | inst->alg.setkey = cryptd_hash_setkey; | 589 | inst->alg.setkey = cryptd_hash_setkey; |
550 | inst->alg.digest = cryptd_hash_digest_enqueue; | 590 | inst->alg.digest = cryptd_hash_digest_enqueue; |
551 | 591 | ||