mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Kamil Konieczny <k.konieczny@partner.samsung.com>,
	Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	Sonic Zhang <sonic.zhang@analog.com>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Shawn Guo <shawn.guo@linaro.org>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Jan Engelhardt <jengelh@inai.de>,
	Arvind Yadav <arvind.yadav.cs@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Joakim Bech <joakim.bech@linaro.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 0/5] crypto: ahash.c: Require export/import in ahash
Date: Thu, 15 Feb 2018 19:32:31 +0100	[thread overview]
Message-ID: <14364c45-8f56-e6d6-66f2-8357bf89a894@denx.de> (raw)
In-Reply-To: <cdb62a71-bb7e-8c62-06bc-ab91c9642e06@partner.samsung.com>

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.

>>> 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.

-- 
Best regards,
Marek Vasut

  reply	other threads:[~2018-02-15 18:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20180118183438eucas1p2e2e7be8625ae0950c519e27424f9301a@eucas1p2.samsung.com>
2018-01-18 18:33 ` Kamil Konieczny
     [not found]   ` <CGME20180118183438eucas1p27a0802d5d4ce9013cff72e0ddaccd630@eucas1p2.samsung.com>
2018-01-18 18:34     ` [PATCH v3 1/5] crypto: mxs-dcp: Add empty hash export and import Kamil Konieczny
     [not found]   ` <CGME20180118183439eucas1p26bfb3043619ddcbc25474ac98e5638ff@eucas1p2.samsung.com>
2018-01-18 18:34     ` [PATCH 2/5] crypto: n2_core: " Kamil Konieczny
     [not found]   ` <CGME20180118183440eucas1p21e1a425cbafe3cbb3856d97fd94228e5@eucas1p2.samsung.com>
2018-01-18 18:34     ` [PATCH 3/5] crypto: ux500/hash: Add empty " Kamil Konieczny
     [not found]   ` <CGME20180118183440eucas1p2d435e0100eaf03d3967b28c29a2c91b3@eucas1p2.samsung.com>
2018-01-18 18:34     ` [PATCH 4/5] crypto: bfin_crc: Add empty hash " Kamil Konieczny
     [not found]   ` <CGME20180118183441eucas1p2ee3f046a594945299ea7b75ffb13e2ca@eucas1p2.samsung.com>
2018-01-18 18:34     ` [PATCH 5/5] crypto: ahash.c: Require export/import in ahash Kamil Konieczny
2018-01-18 21:31       ` Marek Vasut
2018-01-19  9:53         ` Kamil Konieczny
2018-01-19 10:08           ` Marek Vasut
2018-01-19 10:53             ` Kamil Konieczny
2018-02-15 15:41   ` [PATCH v3 0/5] " Herbert Xu
2018-02-15 16:27     ` Marek Vasut
2018-02-15 17:00       ` Kamil Konieczny
2018-02-15 17:06         ` Marek Vasut
2018-02-15 18:06           ` Kamil Konieczny
2018-02-15 18:32             ` Marek Vasut [this message]
2018-02-16  9:16               ` Kamil Konieczny
2018-02-16  9:49                 ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14364c45-8f56-e6d6-66f2-8357bf89a894@denx.de \
    --to=marex@denx.de \
    --cc=arvind.yadav.cs@gmail.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=davem@davemloft.net \
    --cc=fabio.estevam@freescale.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jengelh@inai.de \
    --cc=joakim.bech@linaro.org \
    --cc=k.konieczny@partner.samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shawn.guo@linaro.org \
    --cc=sonic.zhang@analog.com \
    --cc=thomas.lendacky@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®