linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] ima: use asynchronous hash API for hash calculation
@ 2014-07-01 20:12 Dmitry Kasatkin
  2014-07-01 20:12 ` [PATCH v2 1/3] ima: use ahash API for file " Dmitry Kasatkin
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Dmitry Kasatkin @ 2014-07-01 20:12 UTC (permalink / raw)
  To: zohar, linux-ima-devel, linux-security-module
  Cc: linux-kernel, linux-crypto, Dmitry Kasatkin

Depending on the IMA policy, it might require to measure huge amount of files.
It may be very important to speedup hash calculation or to reduce (bettery)
energy required to do it. Currently IMA uses synchronous hash API (shash)
which is CPU based. CPU based hash calculation is very CPU intensive and on the
battery powered device will be also high energy consuming.

Many platforms provide cryptographic acceleration modules which allow speedup
and/or reduce energy consumption, and provide asynchronous way to calculate
hashes. Defacto way to implement drivers for such accelerators is using
asynchronous hash API (ahash).

The first patch adds use of ahash API to IMA. Performance of using HW
acceleration depends very much on amount of data to hash and it depends
on particular HW. It is usually inefficient for small data due to HW
initialization overhead. In order to make it possible to optimize performance
for particular system, the patch provides kernel parameter
'ima_ahash=<min_file_size>', which allows to specify optimal file size
when start using ahash. By default ahash is disabled until non-zero value
with 'ima_ahash=' is provided.

Second patch introduces multi-page buffers which makes HW acceleration more
efficient. It extends 'ima_ahash' kernel parameter to specify buffer size:
'ima_ahash=<min_file_size>[,<bufsize>]'

Third patch introduces double-buffering which allows to readahead next portion
of data for hashing while calculating the hash.

Changes to v1:
- ima_ahash_size and ima_ahash_bufsize were combined as ima_ahash
- ahash pre-allocation moved out from __init code to be able to use
  ahash crypto modules. Ahash allocated once on the first use.
- hash calculation falls back to sahsh if ahash allocation/calculation fails
- complex initialization separated from variable declaration
- improved comments

- Dmitry


Dmitry Kasatkin (3):
  ima: use ahash API for file hash calculation
  ima: introduce multi-page collect buffers
  ima: provide double buffering for hash calculation

 Documentation/kernel-parameters.txt |   6 +
 security/integrity/ima/ima_crypto.c | 287 +++++++++++++++++++++++++++++++++++-
 2 files changed, 290 insertions(+), 3 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2014-07-02 20:26 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-01 20:12 [PATCH v2 0/3] ima: use asynchronous hash API for hash calculation Dmitry Kasatkin
2014-07-01 20:12 ` [PATCH v2 1/3] ima: use ahash API for file " Dmitry Kasatkin
2014-07-02 16:40   ` Mimi Zohar
2014-07-02 18:20     ` Dmitry Kasatkin
2014-07-02 19:35       ` Mimi Zohar
2014-07-02 17:44   ` Mimi Zohar
2014-07-02 18:21     ` Dmitry Kasatkin
2014-07-02 19:38       ` Mimi Zohar
2014-07-02 18:33   ` Dave Hansen
2014-07-02 18:40     ` Dmitry Kasatkin
2014-07-02 18:52       ` Dave Hansen
2014-07-01 20:12 ` [PATCH v2 2/3] ima: introduce multi-page collect buffers Dmitry Kasatkin
2014-07-02 20:21   ` Mimi Zohar
2014-07-02 20:26     ` Dmitry Kasatkin
2014-07-01 20:12 ` [PATCH v2 3/3] ima: provide double buffering for hash calculation Dmitry Kasatkin

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