]> git.baikalelectronics.ru Git - kernel.git/commit
ima: use ahash API for file hash calculation
authorDmitry Kasatkin <d.kasatkin@samsung.com>
Wed, 26 Feb 2014 15:05:20 +0000 (17:05 +0200)
committerMimi Zohar <zohar@linux.vnet.ibm.com>
Thu, 17 Jul 2014 13:35:10 +0000 (09:35 -0400)
commitc3c03a79a32d0e4f430382812eb0ca060b50f962
treea45834814cd073987f9605b616e7b8dd094d94fd
parent8c32393cfecafb11d6dc593a6dc9868d2d00c0d8
ima: use ahash API for file hash calculation

Async hash API allows the use of HW acceleration for hash calculation.
It may give significant performance gain and/or reduce power consumption,
which might be very beneficial for battery powered devices.

This patch introduces hash calculation using ahash API. ahash performance
depends on the data size and the particular HW. Depending on the specific
system, shash performance may be better.

This patch defines 'ahash_minsize' module parameter, which is used to
define the minimal file size to use with ahash.  If this minimum file size
is not set or the file is smaller than defined by the parameter, shash will
be used.

Changes in v3:
- kernel parameter replaced with module parameter
- pr_crit replaced with pr_crit_ratelimited
- more comment changes - Mimi

Changes in v2:
- ima_ahash_size became 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 shash if ahash allocation/calculation fails
- complex initialization separated from variable declaration
- improved comments

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Documentation/kernel-parameters.txt
security/integrity/ima/ima_crypto.c