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

Configure Feed

Select the types of activity you want to include in your feed.

crypto: ahash - Add core export and import

Add crypto_ahash_export_core and crypto_ahash_import_core. For
now they only differ from the normal export/import functions when
going through shash.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+48 -1
+24 -1
crypto/ahash.c
··· 698 698 return ahash_def_finup_finish1(req, err); 699 699 } 700 700 701 + int crypto_ahash_export_core(struct ahash_request *req, void *out) 702 + { 703 + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 704 + 705 + if (likely(tfm->using_shash)) 706 + return crypto_shash_export_core(ahash_request_ctx(req), out); 707 + return crypto_ahash_alg(tfm)->export(req, out); 708 + } 709 + EXPORT_SYMBOL_GPL(crypto_ahash_export_core); 710 + 701 711 int crypto_ahash_export(struct ahash_request *req, void *out) 702 712 { 703 713 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ··· 718 708 } 719 709 EXPORT_SYMBOL_GPL(crypto_ahash_export); 720 710 711 + int crypto_ahash_import_core(struct ahash_request *req, const void *in) 712 + { 713 + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 714 + 715 + if (likely(tfm->using_shash)) 716 + return crypto_shash_import_core(prepare_shash_desc(req, tfm), 717 + in); 718 + if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) 719 + return -ENOKEY; 720 + return crypto_ahash_alg(tfm)->import(req, in); 721 + } 722 + EXPORT_SYMBOL_GPL(crypto_ahash_import_core); 723 + 721 724 int crypto_ahash_import(struct ahash_request *req, const void *in) 722 725 { 723 726 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); ··· 739 716 return crypto_shash_import(prepare_shash_desc(req, tfm), in); 740 717 if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) 741 718 return -ENOKEY; 742 - return crypto_ahash_alg(tfm)->import(req, in); 719 + return crypto_ahash_import_core(req, in); 743 720 } 744 721 EXPORT_SYMBOL_GPL(crypto_ahash_import); 745 722
+24
include/crypto/hash.h
··· 507 507 int crypto_ahash_export(struct ahash_request *req, void *out); 508 508 509 509 /** 510 + * crypto_ahash_export_core() - extract core state for message digest 511 + * @req: reference to the ahash_request handle whose state is exported 512 + * @out: output buffer of sufficient size that can hold the hash state 513 + * 514 + * Export the hash state without the partial block buffer. 515 + * 516 + * Context: Softirq or process context. 517 + * Return: 0 if the export creation was successful; < 0 if an error occurred 518 + */ 519 + int crypto_ahash_export_core(struct ahash_request *req, void *out); 520 + 521 + /** 510 522 * crypto_ahash_import() - import message digest state 511 523 * @req: reference to ahash_request handle the state is imported into 512 524 * @in: buffer holding the state ··· 530 518 * Return: 0 if the import was successful; < 0 if an error occurred 531 519 */ 532 520 int crypto_ahash_import(struct ahash_request *req, const void *in); 521 + 522 + /** 523 + * crypto_ahash_import_core() - import core state 524 + * @req: reference to ahash_request handle the state is imported into 525 + * @in: buffer holding the state 526 + * 527 + * Import the hash state without the partial block buffer. 528 + * 529 + * Context: Softirq or process context. 530 + * Return: 0 if the import was successful; < 0 if an error occurred 531 + */ 532 + int crypto_ahash_import_core(struct ahash_request *req, const void *in); 533 533 534 534 /** 535 535 * crypto_ahash_init() - (re)initialize message digest handle