Received: by 10.223.176.46 with SMTP id f43csp843617wra; Fri, 19 Jan 2018 02:55:28 -0800 (PST) X-Google-Smtp-Source: ACJfBov2gaCkA9QqlizkO6AOK1LPRmesCq8bK1mFxxs17jG6VPxPMl5GwGg67D+jFAdv4cia9GdI X-Received: by 2002:a17:902:24e:: with SMTP id 72-v6mr1387892plc.278.1516359328578; Fri, 19 Jan 2018 02:55:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516359328; cv=none; d=google.com; s=arc-20160816; b=wsTAy4K5ujOhWJi6tB+35GuENj+cTyrZeRQLipl1Kqg7MTjbtpU3UzhdkKQTSyFQy/ kjk6lcahAxhlXZ8yE6y/gA8+Sk/+gq6X+p2ByJhMXh5/yj2l0GwfJ5jMVWySHAzp/NQh vULW5THf847e3qUcXorepqetrrF9xKzlCMdBxAurS2DhW9LbqL1GD/oAv3BCeRVmYRFK YQR3Vuq0Y6wCOhT8jA8M1zbdCw5qo8Ucp/n9lcFjvA1jAWf2aqrKaCDK9JhwQ4Kf0XxS 4GuanAAlgtD8MQ6a9O/ULqbnbVXH+uY3dP+IztTl/Ed5mS0N7lMER0S6sclPMVc2poJl IPXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter:arc-authentication-results; bh=8oPkJNSE3dL9gC9vWW4/18Lqi6fa86h6oNgkfEhi2nQ=; b=UJINXtBJFzN4nyeVRYWzaxAS9O2D/aTcNZeW3iDIJBBleCwV4qa5Cb4CBjaVp5/Rkb zEJmx5qclQNkPypdBTUiUHysFnAdh7VmTWy85lfDIF1Sc5xEw26xUeEz86h+wvFVzs5L gyJ6PdA2PzQ7vKLc5Fx8y1I5anoyNdIDUIDNLfaYSLioRTbyjrzhiO5y9lq0qltr0dnr g086PKYy/U3fcQlG6K3lhCFegEumDLnWWP/8TZM1V4n3k1NALtrI258W0MdaM+RV8t0t ypghAxwboCbZt9sgyXZSiLzwJgYrP1rdjRzEDUP1d86WLryvpCULoKisYGr49fHEFwmo 4fEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QsBWo0jA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si736491pli.708.2018.01.19.02.55.14; Fri, 19 Jan 2018 02:55:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QsBWo0jA; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755285AbeASKxv (ORCPT + 99 others); Fri, 19 Jan 2018 05:53:51 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:40896 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754860AbeASKxc (ORCPT ); Fri, 19 Jan 2018 05:53:32 -0500 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180119105329euoutp01e8289871a5b94ea8d863142a26098d37~LMKrSJoK31015110151euoutp01q; Fri, 19 Jan 2018 10:53:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180119105329euoutp01e8289871a5b94ea8d863142a26098d37~LMKrSJoK31015110151euoutp01q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1516359209; bh=8oPkJNSE3dL9gC9vWW4/18Lqi6fa86h6oNgkfEhi2nQ=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=QsBWo0jAvn9PwGHx5CI7jmjsgpi5KMJVA/owMm1EHwNMKhUvTxPmKqU/jZrAcynXM uykrGuJBT3BVaVPm1SgQr+IDf3TdtTyJbTVA3G1QED8cMOQtaCr0X9gFQ8ldMEk0vx 041Dhtzj1LjXy8bK02YRJKISZQpCec9qdNmUWxws= Received: from eusmges3.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180119105329eucas1p196c1760ab87f923d904868bd14fcab39~LMKqq509x2870028700eucas1p1l; Fri, 19 Jan 2018 10:53:29 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3.samsung.com (EUCPMTA) with SMTP id CA.5B.12867.82EC16A5; Fri, 19 Jan 2018 10:53:28 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180119105328eucas1p18fbfa8331718d782d1448c0b508c4478~LMKpxgjKX2588025880eucas1p1h; Fri, 19 Jan 2018 10:53:28 +0000 (GMT) X-AuditID: cbfec7f2-f793b6d000003243-2a-5a61ce280b8c Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 89.78.20118.82EC16A5; Fri, 19 Jan 2018 10:53:28 +0000 (GMT) Received: from [106.120.51.18] by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0P2S00BBHU93V6D0@eusync3.samsung.com>; Fri, 19 Jan 2018 10:53:28 +0000 (GMT) Subject: Re: [PATCH 5/5] crypto: ahash.c: Require export/import in ahash To: Marek Vasut , linux-crypto@vger.kernel.org Cc: "David S. Miller" , Bartlomiej Zolnierkiewicz , Fabio Estevam , Shawn Guo , Tom Lendacky , Jan Engelhardt , Arvind Yadav , Linus Walleij , Joakim Bech , linux-kernel@vger.kernel.org, Herbert Xu From: Kamil Konieczny Message-id: <4099d611-ccc6-6097-9d4a-99b2306a26e5@partner.samsung.com> Date: Fri, 19 Jan 2018 11:53:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-version: 1.0 In-reply-to: <1ac2ca10-7017-7e44-5651-e53a8a613177@denx.de> Content-type: text/plain; charset="utf-8" Content-language: en-US Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTYRjmO+fs7DhcHKfmm0nGwChhlml4sLILFgf6E4FgI8jRDmo6lR0V lX6YN2xampcuw8K01Jlo2lwqJqaWZqHdvJFOk7by1o8tQUkt3Vngv+d93uf5Hp6Xj8JlIyJv KjYhmdMmqOLlpIQwvVkdUuwfUikPrU8dZkZvPsKZ5ntNIqZiOIdg9DoFUzDvw2TNLWGMvd5C MGVrtRgzbV7FmM8dFSSzmHcdMZbGxzjTV9YlOillcz+tk6zRMIGxD/UDBLvRW4Sx7fopMWvq 9mObrT8IdnK0k2RvGesRa2/Zc16ilBxTc/GxqZz2YFiUJObvWjmRNOSd1p5vEWeiZk8dcqGA DoaRufuYgHfCB3MTqUMSSkY/QWC1jDsHO4Kx0mHsv6PyVY1IWNQgePDtNSYMVgQlfzKJLZU7 zcKnzjqHw4M+DlnGNmJLhNMDOJhvGhwLkg6B2RfvHVhKn4WZ1m7xFiZoPyhcMzse8qQjQWft EAkaN1gpFXgX+igsTK46vDh9AH7+LiEE7AXZuRNO7AvPG5bwrWCga8TwdcYsFjqEg86QjQTs DvP9RifvA59LCwjBUISgdnxQLAxlCPrvjDgvcBR6+z+KhIgdUGK6uxlBbfJSyM+TCRIWTE+q nPJT8MV+SyzcyIZB7mIhUYx89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uyc8279KpA/wZ QktO+Z5SEOpL4lJ1zPgvfO3ok6SUJ8W57nUO76abmanLn3iePsu/6ZHOzB7+wtnCj7kW3Vzx vjuk4ZH0wmWlvHKvdZalJ+26+WwHo0e3Nody5DTbH/tD3AOsTAQTpiixFGckGmoxFxUnAgAg aTbKuQIAAA== X-CMS-MailID: 20180119105328eucas1p18fbfa8331718d782d1448c0b508c4478 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180118183441eucas1p2ee3f046a594945299ea7b75ffb13e2ca X-RootMTR: 20180118183441eucas1p2ee3f046a594945299ea7b75ffb13e2ca References: <20180118183404.12583-1-k.konieczny@partner.samsung.com> <20180118183404.12583-6-k.konieczny@partner.samsung.com> <5db6f843-cc51-09f2-f388-8dade440c6bc@denx.de> <9246bbcb-6cd0-8bc9-8286-02c44e6d01bc@partner.samsung.com> <1ac2ca10-7017-7e44-5651-e53a8a613177@denx.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19.01.2018 11:08, Marek Vasut wrote: > On 01/19/2018 10:53 AM, Kamil Konieczny wrote: >> On 18.01.2018 22:31, Marek Vasut wrote: >>> On 01/18/2018 07:34 PM, Kamil Konieczny wrote: >>>> Export and import are mandatory in async hash. As drivers were >>>> rewritten, drop empty wrappers and correct init of ahash transformation. >>> >>> Are you moving checks from the core subsystem to drivers ? This looks >>> really nonsensical and the commit message doesn't explain the rationale >>> for that at all. >> >> I am removing checks from core. Export and import were optional in beginnig >> of crypto framework, but as time goes on they become mandatory. > > Seems like if the driver doesn't implement those, the core can easily > detect that and perform the necessary action. Moving the checks out of > core seems like the wrong thing to do, rather you should enhance the > checks in core if they're insufficient in my opinion. I removed all checks. No checks in driver and no checks in crypto framework. If you would like any check, I think the place to add them is in ahash alg registraction, in function ahash_prepare_alg add something like: if ((alg->init == NULL) || (alg->digest == NULL) || (alg->final == NULL) || (alg->update == NULL) || (alg->export == NULL) || (alg->import == NULL)) return -EINVAL; The only downsize is this will be usefull in backport (to prevent NULL dereference), as any new driver will have all those pointers sets. >>>> Signed-off-by: Kamil Konieczny >>>> --- >>>> crypto/ahash.c | 18 ++---------------- >>>> 1 file changed, 2 insertions(+), 16 deletions(-) >>>> >>>> diff --git a/crypto/ahash.c b/crypto/ahash.c >>>> index 3a35d67de7d9..c3cce508c1d4 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,6 @@ 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; >>>> >>>> if (tfm->__crt_alg->cra_type != &crypto_ahash_type) >>>> return crypto_init_shash_ops_async(tfm); >>>> @@ -462,15 +450,13 @@ static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) >>>> hash->final = alg->final; >>>> hash->finup = alg->finup ?: ahash_def_finup; >>>> hash->digest = alg->digest; >>>> + hash->export = alg->export; >>>> + hash->import = alg->import; >>>> >>>> if (alg->setkey) { >>>> 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, Kamil Konieczny Samsung R&D Institute Poland