Received: by 10.223.185.116 with SMTP id b49csp1016969wrg; Fri, 16 Feb 2018 10:53:21 -0800 (PST) X-Google-Smtp-Source: AH8x224OWhhhKEEDumcyA45IsrAayfsNJS91wX4Cm0XiQ0OshwNAh3bLceKFy06DhXe03tqWVYci X-Received: by 2002:a17:902:8487:: with SMTP id c7-v6mr6629691plo.7.1518807201647; Fri, 16 Feb 2018 10:53:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518807201; cv=none; d=google.com; s=arc-20160816; b=JTXSeAW08J6zzL9PiuJn4MMe0SN6ZhaIN/ES+Z3eJq3xKf2g4xUSzvNQ7PQw1uO3N2 eXS5I2ongZ5cYU7g+E66YXsR1Ljzz1HyrvVAxeLg1kCwlwkrOBjnpKELPt2al7cnvVLr JLVGlqyt/DCpz+UK9/rm/iuENNp2+9oYQ43rJq7J660bOVGoiDd0zp9AZpH8aOL0AZ4W U+XC14dJQ4YNMnMORCIib6Ox0ATsjxRNXhnRNqZB2nirtfQ8i3QPTuB9W4oYnAlvHE7U cWDnJA+Y7AXYm8u7f0vFlBOnGmzw/xWNHfHphAC2VooBcA6JhnD0KE/7uaxyEvtR1J07 be4w== 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=zTo7G5UmODKcuGZl74NLHl0qNmWeuge3PAKg6mnCj3U=; b=H5KbJTPTILGpL/iwrTFVljxhRMedmSG0n7pdw9anUjteAY6izs1Lz/jKB2uML/EJjY pvGaEphMUoqlBCKof/f+r3N6sl1iX9vYEZcO4nK1sDcuDIKzf7LgLCK0gwbiTwuo0zS+ SFny+YCX3PDFys+DZbHcmRI8inShAnYC7vBxVz7o4gn1mAL2VkOxUQTADejuE06Y+Nmn Ahcr7Iw/JDrhu0PHSP+vMwafU0kKcp6R/GbsI5ke/+k1pVjMCQmM1pYotUhNzIvLYdLO up3y/fN+qxwNHmp9AtQhscqDfaQbhmzl154XLkq7hCauuy+nDvWA8tn3IuDLIeH6BmPY M5RQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=M3BNmltJ; 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 g67si1289350pgc.690.2018.02.16.10.53.07; Fri, 16 Feb 2018 10:53:21 -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=M3BNmltJ; 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 S1757773AbeBPJQl (ORCPT + 99 others); Fri, 16 Feb 2018 04:16:41 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:47022 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757760AbeBPJQi (ORCPT ); Fri, 16 Feb 2018 04:16:38 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180216091636euoutp0246762172a03f2ce4eb698be078f40c7f~Tw6EjxObH3234532345euoutp02R; Fri, 16 Feb 2018 09:16:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180216091636euoutp0246762172a03f2ce4eb698be078f40c7f~Tw6EjxObH3234532345euoutp02R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1518772596; bh=zTo7G5UmODKcuGZl74NLHl0qNmWeuge3PAKg6mnCj3U=; h=Subject:To:Cc:From:Date:In-reply-to:References:From; b=M3BNmltJmqc2dQ7jqmg6yXfeJBgZrQRwTa8vZaxir9VFhDNwUDEQQ93hwE69gi5pu g/CgwzGFDtJkEmgFj0Ktplg608NJmLPVq444Z2XQMpHiAkEgUdkvyoBHLWtkFpBlSN r9DOQbhR6P8hgn3fVHxIlkof7k9U6FcxbNeQxNHY= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180216091634eucas1p2323534115efa149d771db6b9dba67966~Tw6C_ac5v0380303803eucas1p2F; Fri, 16 Feb 2018 09:16:34 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id E5.EA.17380.071A68A5; Fri, 16 Feb 2018 09:16:32 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180216091631eucas1p1e7b2cbe2e730580dc1b4e1c33599e1fe~Tw5-tbJNW2453424534eucas1p1o; Fri, 16 Feb 2018 09:16:31 +0000 (GMT) X-AuditID: cbfec7f4-b4fc79c0000043e4-ce-5a86a1707466 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 8D.E5.04183.E61A68A5; Fri, 16 Feb 2018 09:16:30 +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 <0P4800HG1KFI0M80@eusync3.samsung.com>; Fri, 16 Feb 2018 09:16:30 +0000 (GMT) Subject: Re: [PATCH v3 0/5] crypto: ahash.c: Require export/import in ahash To: Marek Vasut , Herbert Xu Cc: linux-crypto@vger.kernel.org, "David S. Miller" , Bartlomiej Zolnierkiewicz , Sonic Zhang , Fabio Estevam , Shawn Guo , Tom Lendacky , Jan Engelhardt , Arvind Yadav , Linus Walleij , Joakim Bech , linux-kernel@vger.kernel.org From: Kamil Konieczny Message-id: <77b4e0a0-0e2c-af7a-690e-4d516d616717@partner.samsung.com> Date: Fri, 16 Feb 2018 10:16:29 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-version: 1.0 In-reply-to: <14364c45-8f56-e6d6-66f2-8357bf89a894@denx.de> Content-type: text/plain; charset="utf-8" Content-language: en-US Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Sa0hTYRiA+3bOmWfW8njMfDHRmAoZaTehA6UkSB3xT78q98NaelJR59jU LtDF8paXVnPehoVCpJl5a1pZqc2hRi2p4UhTK0VLa5DNSk0tt6Pgv+fle14+no+PxGgz4Ukm yFM5pVyWJBE6463dc32Biqps6S7TU3fGUliFMU1lDQRT0ZeJM7q8QCZ/you5MmkVMLbacZzR LlQLmI8jcwLG3FYhZL5nZyBmvP4Oxgy1XBUyRm07cXAjm/VuUchO9Yex+nsDAva2rhdnl7rU AvaJbtiJbe30Z5smvuDskOWZkL2ur0Wsrdn7yHqp84FYLikhnVPuDD3pHG/VTGCKBp+zBbP0 ZfQT8pCIBCoYcqy9TnnImaSpGgSTOeUYP9gQvKy2CFctY6dmxbqLYOJ+JcEPEwiMesvyCkm6 UZEwv0DZFzZREfC5I9fhYNQoBpoXD5D9QEjtg9FHrwV2FlOH4PdihoNxyh/6r807HHfqOFQV jyPecYXZohHcziJqP3z/kE/YGaMC4OuMBufZA65mDaywDzysszoSgLrrBKWNFgGfEA5arQnj 2Q2mevROPHuBuSgf5xfUCNS3ywl+KEMw1mQieGs/dPW8Xbl6I2haSx3JQIkhN5vmFRb+Gq2I 5zBofT618kRmDJozzN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jbXZ6eA620vJ1+Wsqv/kmrcQiYr tm+ofKthp71G7WVMf/Bfddm78Xouddtl2Df2Xja+917t5K6ld0T9am/IXPn4+iqD0H3py5J/ 3YPNOowDNxy667ampkrrEF/Tvqw/YsnnEudEub97YynD+373SYdZQblKLMUZiYZazEXFiQDq rprZtQIAAA== X-CMS-MailID: 20180216091631eucas1p1e7b2cbe2e730580dc1b4e1c33599e1fe X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180118183438eucas1p2e2e7be8625ae0950c519e27424f9301a X-RootMTR: 20180118183438eucas1p2e2e7be8625ae0950c519e27424f9301a References: <20180118183404.12583-1-k.konieczny@partner.samsung.com> <20180215154132.GA7352@gondor.apana.org.au> <6b29116a-c39c-9813-34a0-d5c05bd30c9d@denx.de> <32069edc-e816-6ab0-f057-b1dab5d30db4@partner.samsung.com> <14364c45-8f56-e6d6-66f2-8357bf89a894@denx.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15.02.2018 19:32, Marek Vasut wrote: > On 02/15/2018 07:06 PM, Kamil Konieczny wrote: >> >> >> On 15.02.2018 18:06, Marek Vasut wrote: >>> On 02/15/2018 06:00 PM, Kamil Konieczny wrote: >>>> >>>> >>>> On 15.02.2018 17:27, Marek Vasut wrote: >>>>> On 02/15/2018 04:41 PM, Herbert Xu wrote: >>>>>> On Thu, Jan 18, 2018 at 07:33:59PM +0100, Kamil Konieczny wrote: >>>>>>> First four patches add empty hash export and import functions to each driver, >>>>>>> with the same behaviour as in crypto framework. The last one drops them from >>>>>>> crypto framework. Last one for ahash.c depends on all previous. >>>>>>> >>>>>>> Changes in v3: >>>>>>> added change for bfin_crc.c >>>>>>> make this a patchset, instead of unreleated patches >>>>>>> make commit message more descriptive >>>>>>> >>>>>>> Kamil Konieczny (5): >>>>>>> crypto: mxs-dcp: Add empty hash export and import >>>>>>> crypto: n2_core: Add empty hash export and import >>>>>>> crypto: ux500/hash: Add empty export and import >>>>>>> crypto: bfin_crc: Add empty hash export and import >>>>>>> crypto: ahash.c: Require export/import in ahash >>>>>>> >>>>>>> crypto/ahash.c | 18 ++---------------- >>>>>>> drivers/crypto/bfin_crc.c | 12 ++++++++++++ >>>>>>> drivers/crypto/mxs-dcp.c | 14 ++++++++++++++ >>>>>>> drivers/crypto/n2_core.c | 12 ++++++++++++ >>>>>>> drivers/crypto/ux500/hash/hash_core.c | 18 ++++++++++++++++++ >>>>>>> 5 files changed, 58 insertions(+), 16 deletions(-) >>>>>> >>>>>> All applied. Thanks. >>>>> >>>>> This makes no sense, cfr my comment on 5/5 >>>>> >>>>> 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. >>>> >>>> The bug can only be in driver which will not implement those two functions, >>>> but we already had all drivers with those due to patches 1..4 >>>> All other drivers do have them. >>> >>> The core can very well check if these functions are not populated and >>> return ENOSYS >>> >>>> Additionally, with crypto we want minimize code and run as fast as possible. >>> >>> So you remove all NULL pointer checks ? Esp. in security-sensitive code? >>> What is the impact of this non-critical path code on performance? >>> >>> Come on ... >>> >> >> Why you want checks for something that not exist ? >> >> Those without them will not work and will do Oops in crypto testmgr, >> so such drivers should not be used nor accepted in drivers/crypto >> >> Ask yourself why crypto do not check for NULL in ahash digest or other >> required ahash functions. > > Are you suggesting that the kernel code should NOT perform NULL pointer > checks ? > > Are you suggesting each driver should implement every single callback > available and if it is not implemented, return -ENOSYS ? This looks like > a MASSIVE code duplication. It is source code duplication. One do not load all crypto drivers at once, simple because one board has only one crypto HW (or few closely related), and if one even try, almost none of them will initialize on given hardware. E.g. on Exynos board only exynos drivers will load, on board with omap crypto only omap crypto will load. >>>> Moving checks out of core will impose on driver author need for implement >>>> those functions, or declare them empty, but in case of empty ones >>>> crypto will not work properly with such driver. >>> >>> You can very well impose that in the core, except you don't duplicate >>> the code. >> >> Now size of crypto core is reduced. > > You implemented the same code thrice, it surely is not reduced. As I said above, it reduces binary size at cost of more source code in few drivers. -- Best regards, Kamil Konieczny Samsung R&D Institute Poland