mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
evm: crypto hash replaced by shash
Using shash is more efficient, because the algorithm is allocated only once. Only the descriptor to store the hash state needs to be allocated for every operation. Changelog v6: - check for crypto_shash_setkey failure Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@nokia.com> Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
This commit is contained in:
parent
823eb1ccd0
commit
d46eb36995
3 changed files with 56 additions and 44 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <linux/xattr.h>
|
||||
#include <linux/integrity.h>
|
||||
#include <linux/evm.h>
|
||||
#include <crypto/hash.h>
|
||||
#include "evm.h"
|
||||
|
||||
int evm_initialized;
|
||||
|
@ -283,12 +284,10 @@ out:
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(evm_inode_init_security);
|
||||
|
||||
static struct crypto_hash *tfm_hmac; /* preload crypto alg */
|
||||
static int __init init_evm(void)
|
||||
{
|
||||
int error;
|
||||
|
||||
tfm_hmac = crypto_alloc_hash(evm_hmac, 0, CRYPTO_ALG_ASYNC);
|
||||
error = evm_init_secfs();
|
||||
if (error < 0) {
|
||||
printk(KERN_INFO "EVM: Error registering secfs\n");
|
||||
|
@ -301,7 +300,8 @@ err:
|
|||
static void __exit cleanup_evm(void)
|
||||
{
|
||||
evm_cleanup_secfs();
|
||||
crypto_free_hash(tfm_hmac);
|
||||
if (hmac_tfm)
|
||||
crypto_free_shash(hmac_tfm);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue