linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Kasatkin <d.kasatkin@samsung.com>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: linux-ima-devel@lists.sourceforge.net,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	dmitry.kasatkin@gmail.com
Subject: Re: [PATCH v3 1/3] ima: use ahash API for file hash calculation
Date: Tue, 08 Jul 2014 11:07:16 +0300	[thread overview]
Message-ID: <53BBA6B4.7030705@samsung.com> (raw)
In-Reply-To: <1404750875.3029.79.camel@dhcp-9-2-203-236.watson.ibm.com>

On 07/07/14 19:34, Mimi Zohar wrote:
> On Mon, 2014-07-07 at 19:11 +0300, Dmitry Kasatkin wrote: 
>> On 07/07/14 18:44, Mimi Zohar wrote:
>>> On Mon, 2014-07-07 at 16:37 +0300, Dmitry Kasatkin wrote: 
>>>> On 07/07/14 14:56, Mimi Zohar wrote:
>>>>> On Fri, 2014-07-04 at 15:05 +0300, Dmitry Kasatkin wrote: 
>>>>>> +/**
>>>>> This is the kernel-doc delimiter.
>>>>>
>>>>>> + * ima_calc_file_hash - calculae file hash
>>>>>> + *
>>>>> Missing kernel-doc argument descriptions.  Refer to
>>>>> Documentation/kernel-doc-nano-HOWTO.txt.
>>> Not defining the arguments results in a kernel-doc warning.  Providing
>>> kernel-doc is nice, but is unnecessary in this case, as it isn't an
>>> exported loadable module, nor an externally visible function to other
>>> kernel files.  Either remove the extra asterisk, making it a regular
>>> comment, or add the arguments.
>>>
>>>> There is no need to explain arguments as they self-evident.
>>>>
>>>>>> + * if ima_ahash_minsize parameter is non-zero, this function uses
>>>>>> + * ahash for hash caclulation. ahash performance varies for different
>>>>>> + * data sizes on different crypto accelerators. shash performance might
>>>>>> + * be better for small file. 'ima.ahash_minsize' module parameter allows
>>>>>> + * to specify the best value for the system.
>>>>>> + *
>>>>>> + * If ahash fails, it fallbacks to shash.
>>>>>> + */
>>>>>> +int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
>>>>>> +{
>>>>>> +	loff_t i_size;
>>>>>> +	int rc;
>>>>>> +
>>>>>> +	i_size = i_size_read(file_inode(file));
>>>>>> +
>>>>>> +	if (ima_ahash_minsize && i_size >= ima_ahash_minsize) {
>>>>>> +		rc = ima_calc_file_ahash(file, hash);
>>>>>> +		if (!rc)
>>>>>> +			return 0;
>>>>>> +	}
>>>>>> +
>>>>>> +	return ima_calc_file_shash(file, hash);
>>>>>> +}
>>>>> If the crypto accelerator fails, it falls back to using shash.  Is their
>>>>> any indication that the HW error is intermittent or persistent?  Should
>>>>> ima_ahash_minsize be reset?
>>>> If hw constantly does not work then it is simply broken.
>>> True
>>>
>>>> You want to be protected from "random" failures.
>>>> For me it is not the case either... If it works then it works...
>>> This discussion isn't about your particular HW environment, but a
>>> general question.  For example, suppose we were discussing a laptop with
>>> a HW crypto accelerator.  If the HW crypto broke, I would at least want
>>> to be able to quiesce the system properly.  I'd most likely want to be
>>> able to continue using my laptop with software crypto.
>> Driver probing code will detect that HW is not responding and driver
>> will not be enabled...
>>
>> IMA will not be able to use it...
>>
>> It is the same story as with any other HW and driver in the system.
> Right, but my concern is not about unloading the kernel module, but
> about the IMA module parameters left initialized.  The existing code
> will continue using ahash (software version), even though the kernel
> module was unloaded, not shash.  My question is about the software
> implementations of ahash vs. shash performance.
>
> Mimi

If HW driver will not be available, ahash loads generic driver which is
using shash.
Performance of that will be the same as for using shash directly.

- Dmitry

>

  reply	other threads:[~2014-07-08  8:08 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-04 12:05 [PATCH v3 0/3] ima: use asynchronous hash API for hash calculation Dmitry Kasatkin
2014-07-04 12:05 ` [PATCH v3 1/3] ima: use ahash API for file " Dmitry Kasatkin
2014-07-07 11:56   ` Mimi Zohar
2014-07-07 13:37     ` Dmitry Kasatkin
2014-07-07 15:44       ` Mimi Zohar
2014-07-07 16:11         ` Dmitry Kasatkin
2014-07-07 16:34           ` Mimi Zohar
2014-07-08  8:07             ` Dmitry Kasatkin [this message]
2014-07-09 21:00               ` Marek Vasut
2014-07-09 23:05                 ` Dmitry Kasatkin
2014-07-10  8:02                   ` Marek Vasut
2014-07-10 11:18                     ` Dmitry Kasatkin
2014-07-10 11:31                       ` Marek Vasut
2014-07-04 12:05 ` [PATCH v3 2/3] ima: introduce multi-page collect buffers Dmitry Kasatkin
2014-07-04 12:05 ` [PATCH v3 3/3] ima: provide double buffering for hash calculation Dmitry Kasatkin

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=53BBA6B4.7030705@samsung.com \
    --to=d.kasatkin@samsung.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-ima-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).