diff options
| author | Dmitry Kasatkin <dmitry.kasatkin@intel.com> | 2012-05-14 07:13:56 -0400 |
|---|---|---|
| committer | Mimi Zohar <zohar@linux.vnet.ibm.com> | 2013-02-06 10:41:13 -0500 |
| commit | 50af554466804bf51a52fa3d1d0a76f96bd33929 (patch) | |
| tree | b7a3737c726a690ddefa60fdc01427d46d1d08b2 /security | |
| parent | 76bb28f6126f20ee987b9d2570fa653d95d30ae9 (diff) | |
ima: rename hash calculation functions
Rename hash calculation functions to reflect meaning
and change argument order in conventional way.
Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
Diffstat (limited to 'security')
| -rw-r--r-- | security/integrity/ima/ima.h | 4 | ||||
| -rw-r--r-- | security/integrity/ima/ima_api.c | 6 | ||||
| -rw-r--r-- | security/integrity/ima/ima_crypto.c | 8 |
3 files changed, 9 insertions, 9 deletions
diff --git a/security/integrity/ima/ima.h b/security/integrity/ima/ima.h index 5a94f9c92605..6e69697fd530 100644 --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h | |||
| @@ -84,8 +84,8 @@ void ima_fs_cleanup(void); | |||
| 84 | int ima_inode_alloc(struct inode *inode); | 84 | int ima_inode_alloc(struct inode *inode); |
| 85 | int ima_add_template_entry(struct ima_template_entry *entry, int violation, | 85 | int ima_add_template_entry(struct ima_template_entry *entry, int violation, |
| 86 | const char *op, struct inode *inode); | 86 | const char *op, struct inode *inode); |
| 87 | int ima_calc_hash(struct file *file, char *digest); | 87 | int ima_calc_file_hash(struct file *file, char *digest); |
| 88 | int ima_calc_template_hash(int template_len, void *template, char *digest); | 88 | int ima_calc_buffer_hash(const void *data, int len, char *digest); |
| 89 | int ima_calc_boot_aggregate(char *digest); | 89 | int ima_calc_boot_aggregate(char *digest); |
| 90 | void ima_add_violation(struct inode *inode, const unsigned char *filename, | 90 | void ima_add_violation(struct inode *inode, const unsigned char *filename, |
| 91 | const char *op, const char *cause); | 91 | const char *op, const char *cause); |
diff --git a/security/integrity/ima/ima_api.c b/security/integrity/ima/ima_api.c index 9382a4c568b2..d9030b29d84d 100644 --- a/security/integrity/ima/ima_api.c +++ b/security/integrity/ima/ima_api.c | |||
| @@ -50,8 +50,8 @@ int ima_store_template(struct ima_template_entry *entry, | |||
| 50 | entry->template_len = sizeof(entry->template); | 50 | entry->template_len = sizeof(entry->template); |
| 51 | 51 | ||
| 52 | if (!violation) { | 52 | if (!violation) { |
| 53 | result = ima_calc_template_hash(entry->template_len, | 53 | result = ima_calc_buffer_hash(&entry->template, |
| 54 | &entry->template, | 54 | entry->template_len, |
| 55 | entry->digest); | 55 | entry->digest); |
| 56 | if (result < 0) { | 56 | if (result < 0) { |
| 57 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, | 57 | integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, |
| @@ -148,7 +148,7 @@ int ima_collect_measurement(struct integrity_iint_cache *iint, | |||
| 148 | u64 i_version = file->f_dentry->d_inode->i_version; | 148 | u64 i_version = file->f_dentry->d_inode->i_version; |
| 149 | 149 | ||
| 150 | iint->ima_xattr.type = IMA_XATTR_DIGEST; | 150 | iint->ima_xattr.type = IMA_XATTR_DIGEST; |
| 151 | result = ima_calc_hash(file, iint->ima_xattr.digest); | 151 | result = ima_calc_file_hash(file, iint->ima_xattr.digest); |
| 152 | if (!result) { | 152 | if (!result) { |
| 153 | iint->version = i_version; | 153 | iint->version = i_version; |
| 154 | iint->flags |= IMA_COLLECTED; | 154 | iint->flags |= IMA_COLLECTED; |
diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c index 920f49cfbf13..b691e0f3830c 100644 --- a/security/integrity/ima/ima_crypto.c +++ b/security/integrity/ima/ima_crypto.c | |||
| @@ -40,7 +40,7 @@ int ima_init_crypto(void) | |||
| 40 | /* | 40 | /* |
| 41 | * Calculate the MD5/SHA1 file digest | 41 | * Calculate the MD5/SHA1 file digest |
| 42 | */ | 42 | */ |
| 43 | int ima_calc_hash(struct file *file, char *digest) | 43 | int ima_calc_file_hash(struct file *file, char *digest) |
| 44 | { | 44 | { |
| 45 | loff_t i_size, offset = 0; | 45 | loff_t i_size, offset = 0; |
| 46 | char *rbuf; | 46 | char *rbuf; |
| @@ -93,9 +93,9 @@ out: | |||
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | /* | 95 | /* |
| 96 | * Calculate the hash of a given template | 96 | * Calculate the hash of a given buffer |
| 97 | */ | 97 | */ |
| 98 | int ima_calc_template_hash(int template_len, void *template, char *digest) | 98 | int ima_calc_buffer_hash(const void *data, int len, char *digest) |
| 99 | { | 99 | { |
| 100 | struct { | 100 | struct { |
| 101 | struct shash_desc shash; | 101 | struct shash_desc shash; |
| @@ -105,7 +105,7 @@ int ima_calc_template_hash(int template_len, void *template, char *digest) | |||
| 105 | desc.shash.tfm = ima_shash_tfm; | 105 | desc.shash.tfm = ima_shash_tfm; |
| 106 | desc.shash.flags = 0; | 106 | desc.shash.flags = 0; |
| 107 | 107 | ||
| 108 | return crypto_shash_digest(&desc.shash, template, template_len, digest); | 108 | return crypto_shash_digest(&desc.shash, data, len, digest); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | static void __init ima_pcrread(int idx, u8 *pcr) | 111 | static void __init ima_pcrread(int idx, u8 *pcr) |
