summaryrefslogtreecommitdiffstats
path: root/security/integrity/ima/ima_api.c
diff options
context:
space:
mode:
authorDmitry Kasatkin2013-06-07 12:16:24 +0200
committerMimi Zohar2013-10-25 23:17:01 +0200
commitea593993d361748e795f5eb783a5fb5144fb2df9 (patch)
tree387915941a654ae6b23199d372c73afede8d19e1 /security/integrity/ima/ima_api.c
parentima: provide dedicated hash algo allocation function (diff)
downloadkernel-qcow2-linux-ea593993d361748e795f5eb783a5fb5144fb2df9.tar.gz
kernel-qcow2-linux-ea593993d361748e795f5eb783a5fb5144fb2df9.tar.xz
kernel-qcow2-linux-ea593993d361748e795f5eb783a5fb5144fb2df9.zip
ima: support arbitrary hash algorithms in ima_calc_buffer_hash
ima_calc_buffer_hash will be used with different hash algorithms. This patch provides support for arbitrary hash algorithms in ima_calc_buffer_hash. Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security/integrity/ima/ima_api.c')
-rw-r--r--security/integrity/ima/ima_api.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c
index 2cc5dcc6bdeb..bc1d1282a06f 100644
--- a/security/integrity/ima/ima_api.c
+++ b/security/integrity/ima/ima_api.c
@@ -18,6 +18,7 @@
#include <linux/fs.h>
#include <linux/xattr.h>
#include <linux/evm.h>
+#include <crypto/hash_info.h>
#include "ima.h"
static const char *IMA_TEMPLATE_NAME = "ima";
@@ -54,6 +55,8 @@ int ima_store_template(struct ima_template_entry *entry,
entry->template_len = sizeof(entry->template);
if (!violation) {
+ /* this function uses default algo */
+ hash.hdr.algo = HASH_ALGO_SHA1;
result = ima_calc_buffer_hash(&entry->template,
entry->template_len, &hash.hdr);
if (result < 0) {