Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751550AbeAPSio (ORCPT + 1 other); Tue, 16 Jan 2018 13:38:44 -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 DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180116183837euoutp0110e89bcc622821b8e8656713c21b433e~KXk70xic12156921569euoutp01F X-AuditID: cbfec7f1-f793a6d00000326b-f1-5a5e46acb25e 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+Y1T7BDOFEaJ49OuMkFUWU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Ty+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-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 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; } -- 2.15.0