lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 15 Feb 2018 19:06:53 +0100
From:   Kamil Konieczny <k.konieczny@...tner.samsung.com>
To:     Marek Vasut <marex@...x.de>,
        Herbert Xu <herbert@...dor.apana.org.au>
Cc:     linux-crypto@...r.kernel.org,
        "David S. Miller" <davem@...emloft.net>,
        Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>,
        Sonic Zhang <sonic.zhang@...log.com>,
        Fabio Estevam <fabio.estevam@...escale.com>,
        Shawn Guo <shawn.guo@...aro.org>,
        Tom Lendacky <thomas.lendacky@....com>,
        Jan Engelhardt <jengelh@...i.de>,
        Arvind Yadav <arvind.yadav.cs@...il.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Joakim Bech <joakim.bech@...aro.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 0/5] crypto: ahash.c: Require export/import in ahash



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.

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

-- 
Best regards,
Kamil Konieczny
Samsung R&D Institute Poland

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ