Lines Matching full:hash

10  *	Calculates md5/sha1 file hash, template hash, boot-aggreate hash
21 #include <crypto/hash.h>
81 pr_info("Allocated hash algorithm: %s\n", in ima_init_ima_crypto()
325 struct ima_digest_data *hash, in ima_calc_file_hash_atfm() argument
336 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
427 ahash_request_set_crypt(req, NULL, hash->digest, 0); in ima_calc_file_hash_atfm()
435 static int ima_calc_file_ahash(struct file *file, struct ima_digest_data *hash) in ima_calc_file_ahash() argument
440 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
444 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
452 struct ima_digest_data *hash, in ima_calc_file_hash_tfm() argument
462 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
498 rc = crypto_shash_final(shash, hash->digest); in ima_calc_file_hash_tfm()
502 static int ima_calc_file_shash(struct file *file, struct ima_digest_data *hash) in ima_calc_file_shash() argument
507 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
511 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
519 * ima_calc_file_hash - calculate file hash
521 * Asynchronous hash (ahash) allows using HW acceleration for calculating
522 * a hash. ahash performance varies for different data sizes on different
528 * shash for the hash calculation. If ahash fails, it falls back to using
531 int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) in ima_calc_file_hash() argument
543 hash->length = hash_digest_size[ima_hash_algo]; in ima_calc_file_hash()
544 hash->algo = ima_hash_algo; in ima_calc_file_hash()
563 rc = ima_calc_file_ahash(f, hash); in ima_calc_file_hash()
568 rc = ima_calc_file_shash(f, hash); in ima_calc_file_hash()
576 * Calculate the hash of template data
659 struct ima_digest_data *hash, in calc_buffer_ahash_atfm() argument
667 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
690 ahash_request_set_crypt(req, NULL, hash->digest, 0); in calc_buffer_ahash_atfm()
699 struct ima_digest_data *hash) in calc_buffer_ahash() argument
704 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
708 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
716 struct ima_digest_data *hash, in calc_buffer_shash_tfm() argument
725 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
741 rc = crypto_shash_final(shash, hash->digest); in calc_buffer_shash_tfm()
746 struct ima_digest_data *hash) in calc_buffer_shash() argument
751 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
755 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
762 struct ima_digest_data *hash) in ima_calc_buffer_hash() argument
767 rc = calc_buffer_ahash(buf, len, hash); in ima_calc_buffer_hash()
772 return calc_buffer_shash(buf, len, hash); in ima_calc_buffer_hash()
785 * The boot_aggregate is a cumulative hash over TPM registers 0 - 7. With
787 * TPM 2.0 hash agility, TPM chips could support multiple TPM PCR banks,
792 * hash algorithm for reading the TPM PCRs as for calculating the boot
839 int ima_calc_boot_aggregate(struct ima_digest_data *hash) in ima_calc_boot_aggregate() argument
847 if (crypto_id == hash->algo) { in ima_calc_boot_aggregate()
864 hash->algo = ima_tpm_chip->allocated_banks[bank_idx].crypto_id; in ima_calc_boot_aggregate()
866 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
870 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
872 rc = ima_calc_boot_aggregate_tfm(hash->digest, alg_id, tfm); in ima_calc_boot_aggregate()