Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752045AbeAPMUT (ORCPT + 1 other); Tue, 16 Jan 2018 07:20:19 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:17790 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbeAPMUR (ORCPT ); Tue, 16 Jan 2018 07:20:17 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20180116122015epoutp01514e6bba3a83b96a8fa42849a6ac18b8~KSakViD2T0053400534epoutp01S X-AuditID: b6c32a46-995ff700000010ee-e7-5a5dedfe5726 From: Bartlomiej Zolnierkiewicz To: Kamil Konieczny Cc: Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFT PATCH] crypto: ahash.c: Require export/import in ahash Date: Tue, 16 Jan 2018 13:20:12 +0100 Message-id: <2041364.q1qUov6bzd@amdc3058> User-Agent: KMail/4.13.3 (Linux/3.13.0-96-generic; KDE/4.13.3; x86_64; ; ) In-reply-to: <2a8e710f-9d1c-726b-3355-5d671e04cb68@partner.samsung.com> MIME-version: 1.0 Content-transfer-encoding: 7Bit Content-type: text/plain; charset="us-ascii" X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsWy7bCmue6/t7FRBmsnWFrMOd/CYtH9Ssai b99/Rov7934yWVzeNYfNgdVjy8qbTB7bDqh6HHy3h8nj8ya5AJYoLpuU1JzMstQifbsEroye 3RfYCg6KVPye+Zy5gfGuQBcjJ4eEgInE28M3mLsYuTiEBHYwSrzespUFJCEk8J1R4tTGRJii xp4ljBBFGxglpi2eA+V8ZZRo//abGaSKTcBKYmL7KkYQW0TAVOLR6gZWkCJmgamMEuuurGMH SQgLeEicmL8LzGYRUJVo3NAPZvMKaEq8ezGdDcQWFfCS2LKvnQnE5hRwl/i/7zwzRI2gxI/J 98DOYxaQl9i3fyorhK0jcfbYOrCLJAR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imCwTB6dUA6PY6V/bJtz+PPdEcSjXC+Po11GvWnf8 lHp4vH+2vvHmFP39x0/yhJcq3JLiCri+rlpN8Hm32DvZZ/1F7/bY6v01Yoti+Gb9bcPS/1zJ CznTXV5G3JGSPeLPwTQr8Emac4xU9LT/jWl/NI2vajbXvZn41FlZLe+E5O80Bl3xPs05ykf/ X++qfKjEUpyRaKjFXFScCACK45o2VwIAAA== X-CMS-MailID: 20180116122014epcas2p2bb3c8b19a00d4676cafcf614f8683ab4 X-Msg-Generator: CA CMS-TYPE: 102P X-CMS-RootMailID: 20180116103545eucas1p230af34b97f903f8dc7db5e634297f4f8 X-RootMTR: 20180116103545eucas1p230af34b97f903f8dc7db5e634297f4f8 References: <2a8e710f-9d1c-726b-3355-5d671e04cb68@partner.samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Tuesday, January 16, 2018 11:35:44 AM Kamil Konieczny wrote: > 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. Testing all existing ahash drivers is impossible so the code audit should be done instead. From the quick look there are 3 hash drivers left that still don't implement ->import/->export methods: drivers/crypto/mxs-dcp.c drivers/crypto/n2_core.c drivers/crypto/ux500/hash/hash_core.c It seems that after this patch they will OOPS, currently they now return errors on ->import/->export attempts. Please verify this and if necessary add dummy ->import/->export implementations to affected drivers + contact their maintainers (or authors if there is no maintainer assigned) to make them aware of the problem (maybe some drivers should be removed now?). > 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; > } Best regards, -- Bartlomiej Zolnierkiewicz Samsung R&D Institute Poland Samsung Electronics