Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751757AbeAPKfw (ORCPT + 1 other); Tue, 16 Jan 2018 05:35:52 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:52524 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751611AbeAPKft (ORCPT ); Tue, 16 Jan 2018 05:35:49 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180116103547euoutp0232ee2d9907a6d352f10549456a9c7eda~KQ-W6uhld2262322623euoutp02T X-AuditID: cbfec7f5-f79d06d0000031c7-be-5a5dd5811019 To: Herbert Xu Cc: "David S. Miller" , Bartlomiej Zolnierkiewicz , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org From: Kamil Konieczny Subject: [RFT PATCH] crypto: ahash.c: Require export/import in ahash Message-id: <2a8e710f-9d1c-726b-3355-5d671e04cb68@partner.samsung.com> Date: Tue, 16 Jan 2018 11:35:44 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-version: 1.0 Content-type: text/plain; charset="utf-8" Content-language: en-US Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPIsWRmVeSWpSXmKPExsWy7djPc7pNV2OjDF5uYrXYOGM9q8Wc8y0s Ft2vZCzu3/vJZHF51xw2B1aPLStvMnlsO6Dq0bdlFaPH501yASxRXDYpqTmZZalF+nYJXBnr +5ezFizkreib38rawPiTq4uRk0NCwETi1uuX7BC2mMSFe+vZQGwhgaWMEj9fRnQxcgHZnxkl Xh09xALTsOnVEWaIxDJGiYYPd9khOp4xSny/HwViiwjoSKx8uZgVpIhZYCGjxI/+82BFbALm Eo+2n2ECsYUFXCRmNr5hBLF5Bdwkdp3eBDSVg4NFQFXi5zR3kLCoQIRE17NdrBAlghI/Jt8D O4JZQFPixZdJULa4RHPrTShbXmLzmrdgx0kILGGTmP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LebPJVW8Pt8LJrP3mc9skG3L46 6dal2/e2vLIJ3q8crBMv/OjXp947yz2y922auuuI/rY5T3+r3m90P6Gmsb5MmfetvJuV6g72 P0WN6RaJ3RPdeLt36O+/mLTif0Mgx+Rv/3iUpa6saA+3D8vRNNyQ6vMjdM2hGT33ax99E1S/ Ok/nmBJLcUaioRZzUXEiACiJgJ1bAgAA X-CMS-MailID: 20180116103545eucas1p230af34b97f903f8dc7db5e634297f4f8 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180116103545eucas1p230af34b97f903f8dc7db5e634297f4f8 X-RootMTR: 20180116103545eucas1p230af34b97f903f8dc7db5e634297f4f8 References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: Export and import were optional in async hash. As drivers were rewritten, they become mandatory now, so correct init of ahash transformation. Signed-off-by: Kamil Konieczny --- Tested with crypto run-time self test on Odroid-U3 with Exynos 4412 CPU, with insmod s5p-sss.ko Please test with other crypto hash drivers. crypto/ahash.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/crypto/ahash.c b/crypto/ahash.c index 3a35d67de7d9..7a8906d5af53 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c @@ -434,16 +434,6 @@ static int ahash_def_finup(struct ahash_request *req) return ahash_def_finup_finish1(req, err); } -static int ahash_no_export(struct ahash_request *req, void *out) -{ - return -ENOSYS; -} - -static int ahash_no_import(struct ahash_request *req, const void *in) -{ - return -ENOSYS; -} - static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) { struct crypto_ahash *hash = __crypto_ahash_cast(tfm); @@ -451,8 +441,8 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) hash->setkey = ahash_nosetkey; hash->has_setkey = false; - hash->export = ahash_no_export; - hash->import = ahash_no_import; + hash->export = alg->export; + hash->import = alg->import; if (tfm->__crt_alg->cra_type != &crypto_ahash_type) return crypto_init_shash_ops_async(tfm); @@ -467,10 +457,6 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) hash->setkey = alg->setkey; hash->has_setkey = true; } - if (alg->export) - hash->export = alg->export; - if (alg->import) - hash->import = alg->import; return 0; } -- 2.15.0