From patchwork Tue Jan 16 18:38:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kamil Konieczny X-Patchwork-Id: 10167907 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DB42A601E7 for ; Tue, 16 Jan 2018 18:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE3102623D for ; Tue, 16 Jan 2018 18:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BF68E26CFC; Tue, 16 Jan 2018 18:38:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A77872623D for ; Tue, 16 Jan 2018 18:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750846AbeAPSil (ORCPT ); Tue, 16 Jan 2018 13:38:41 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:45660 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbeAPSik (ORCPT ); Tue, 16 Jan 2018 13:38:40 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180116183837euoutp0110e89bcc622821b8e8656713c21b433e~KXk70xic12156921569euoutp01F; Tue, 16 Jan 2018 18:38:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180116183837euoutp0110e89bcc622821b8e8656713c21b433e~KXk70xic12156921569euoutp01F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1516127917; bh=5qKl12bTBvLu6E/tDcaZxkS245e7y80lCUSmK6ipVlk=; h=From:Subject:To:Cc:Date:References:From; b=Iel7ikEw2a4hWrQVMcyFZuBvHdsG66VJbMzAf+DOqxstpQ3pdHJ73+rK1DncaYyne W03+VvWs5aSXTM0agFh/9LbRE0tX3bInNk9ShbV7rn6aY288skDhXKBea9qpIHLuWd wPo/EXAMXkInDADsDblqm8geZc2kt4f9ZWPUTEW0= Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180116183837eucas1p18b145dd41f2bdc7b1d47dafac20f4292~KXk7KvoB70924209242eucas1p1V; Tue, 16 Jan 2018 18:38:37 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges2.samsung.com (EUCPMTA) with SMTP id EE.3C.12907.CA64E5A5; Tue, 16 Jan 2018 18:38:36 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53~KXk6Nh1Z70862808628eucas1p1q; Tue, 16 Jan 2018 18:38:36 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-f1-5a5e46acb25e Received: from eusync1.samsung.com ( [203.254.199.211]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 6A.2C.18832.BA64E5A5; Tue, 16 Jan 2018 18:38:36 +0000 (GMT) Received: from [106.120.51.18] by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P2N0076IVSB6Y20@eusync1.samsung.com>; Tue, 16 Jan 2018 18:38:35 +0000 (GMT) From: Kamil Konieczny Subject: [PATCH v2] crypto/ahash: Require export/import in ahash To: Herbert Xu Cc: "David S. Miller" , Bartlomiej Zolnierkiewicz , linux-crypto@vger.kernel.org, linux-kernel Message-id: Date: Tue, 16 Jan 2018 19:38:35 +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+NgFmpileLIzCtJLcpLzFFi42LZduznOd01bnFRBv2HDC02zljPajHnfAuL RfcrGYv7934yWVzeNYfNgdVjy8qbTB7bDqh69G1ZxejxeZNcAEsUl01Kak5mWWqRvl0CV8aC z6/YCh4IVHz/2M7ewPiZt4uRk0NCwERi8s4mFghbTOLCvfVsXYxcHEICSxkl3v7/AOV8ZpT4 1beOBabj24frjBCJZYwSE45dZIZwnjFKfO9cwgxSxSZgLvFo+xkmEFtYwEHi8K0bYLaIgI7E ypeLWUEamAU2MErsuHQTLMEr4CbRPWcdK4jNIqAq8b31FhuILSoQIdH1bBcrRI2gxI/J98DO YBbQlHjxZRKULS7R3HoTypaX2LzmLTPEqUvYJA62JELYLhILH8xghLCFJV4d38IOYctIdHYc ZAI5SEKgn1Fi+Y1T7BDOFEaJ49OuMkFUWUscPn6RFWIDn8SkbdOBNnAAxXklOtqEIEo8JG69 XwA11FHi7IOXYOVCArES93e9YZ3AKDcLyQ+zkPwwC8kPs5D8sICRZRWjSGppcW56arGRXnFi bnFpXrpecn7uJkZgyjj97/jHHYzvT1gdYhTgYFTi4WX4ExslxJpYVlyZe4hRgoNZSYS3MTgm Sog3JbGyKrUoP76oNCe1+BCjNAeLkjivbVRbpJBAemJJanZqakFqEUyWiYNTqoGx5uC+ykNl smlb5iQkcNTWXBbx1hdk+Mh0tOPhDL5ATbnfCUyflz2P37Oi1+Daz69rN88/F9ETyZv7dJ7I sxuz/mx+yDphYvptZWHWbcc9jQ7O4vBuW+Zf9X1R97yZtx0u7JiV5+t53LbjayGP5+S7d0Jd cvaUJK9hZv10Rl9810c2raUTeLVPKLEUZyQaajEXFScCAAuh9PUVAwAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrJLMWRmVeSWpSXmKPExsVy+t/xy7pr3OKiDFb0MFpsnLGe1WLO+RYW i+5XMhb37/1ksri8aw6bA6vHlpU3mTy2HVD16NuyitHj8ya5AJYoLpuU1JzMstQifbsErowF n1+xFTwQqPj+sZ29gfEzbxcjJ4eEgInEtw/XGSFsMYkL99azdTFycQgJLGGU+HP3JzuE84xR 4urbx6wgVWwC5hKPtp9hArGFBRwkDt+6AWaLCOhIrHy5mBWkgVlgA6PEznsrWUASvAJuEt1z 1oE1swioSnxvvcUGYosKREg0zZzLClEjKPFj8j2geg6gZnWJKVNyQcLMAuISza03WSBseYnN a94yT2Dkn4WkYxZCxywkHbOQdCxgZFnFKJJaWpybnltsqFecmFtcmpeul5yfu4kRGMDbjv3c vIPx0sbgQ4wCHIxKPLwMf2KjhFgTy4orcw8xSnAwK4nwNgbHRAnxpiRWVqUW5ccXleakFh9i lOZgURLn7d2zOlJIID2xJDU7NbUgtQgmy8TBKdXA6CP5sdmCl+fLk/0qmXcZNzU+n7BnbfOK pwcafwbIT12/Vuegx9W9i5ourbhq45ZvUrX2AYeA4t5Ty+LZwvJaZJY2T7pS8P29oalq1DOe ixf+2bsHn0lZ+T24r8mt6l4zz53jh3N0ZSJEYi5e4Nf2ff9K5K9n2/GuR/85b/eaW848/Cz/ 9AtBTyWW4oxEQy3mouJEAIGZdkVcAgAA X-CMS-MailID: 20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53 X-RootMTR: 20180116183836eucas1p18da0aa4ef25452069e8f64ef95950f53 References: Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Export and import were optional in async hash. As most drivers were rewritten, they become mandatory now, so correct init of ahash transformation. Signed-off-by: Kamil Konieczny --- This is resend of previous patch. As Bartlomiej Zolnierkiewicz pointed out, there are still three crypto drivers that didn't have export/import implemented: drivers/crypto/mxs-dcp.c drivers/crypto/n2_core.c drivers/crypto/ux500/hash/hash_core.c I have no documentation for them, so I sended patches with the behaviour taken from crypto framework, but maybe that hardware is capable of import/export, so proper implementation is possible. Unfortunatly, there is no maintainer for any of these files. Please take this patch after these remainig drivers will be patched. 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; }