Lines Matching refs:hash

10  *	Calculates md5/sha1 file hash, template hash, boot-aggreate hash
21 #include <crypto/hash.h>
86 pr_info("Allocated hash algorithm: %s\n",
330 struct ima_digest_data *hash,
341 hash->length = crypto_ahash_digestsize(tfm);
432 ahash_request_set_crypt(req, NULL, hash->digest, 0);
440 static int ima_calc_file_ahash(struct file *file, struct ima_digest_data *hash)
445 tfm = ima_alloc_atfm(hash->algo);
449 rc = ima_calc_file_hash_atfm(file, hash, tfm);
457 struct ima_digest_data *hash,
467 hash->length = crypto_shash_digestsize(tfm);
503 rc = crypto_shash_final(shash, hash->digest);
507 static int ima_calc_file_shash(struct file *file, struct ima_digest_data *hash)
512 tfm = ima_alloc_tfm(hash->algo);
516 rc = ima_calc_file_hash_tfm(file, hash, tfm);
524 * ima_calc_file_hash - calculate file hash
526 * Asynchronous hash (ahash) allows using HW acceleration for calculating
527 * a hash. ahash performance varies for different data sizes on different
533 * shash for the hash calculation. If ahash fails, it falls back to using
536 int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)
548 hash->length = hash_digest_size[ima_hash_algo];
549 hash->algo = ima_hash_algo;
568 rc = ima_calc_file_ahash(f, hash);
573 rc = ima_calc_file_shash(f, hash);
581 * Calculate the hash of template data
664 struct ima_digest_data *hash,
672 hash->length = crypto_ahash_digestsize(tfm);
695 ahash_request_set_crypt(req, NULL, hash->digest, 0);
704 struct ima_digest_data *hash)
709 tfm = ima_alloc_atfm(hash->algo);
713 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm);
721 struct ima_digest_data *hash,
730 hash->length = crypto_shash_digestsize(tfm);
746 rc = crypto_shash_final(shash, hash->digest);
751 struct ima_digest_data *hash)
756 tfm = ima_alloc_tfm(hash->algo);
760 rc = calc_buffer_shash_tfm(buf, len, hash, tfm);
767 struct ima_digest_data *hash)
772 rc = calc_buffer_ahash(buf, len, hash);
777 return calc_buffer_shash(buf, len, hash);
790 * The boot_aggregate is a cumulative hash over TPM registers 0 - 7. With
792 * TPM 2.0 hash agility, TPM chips could support multiple TPM PCR banks,
797 * hash algorithm for reading the TPM PCRs as for calculating the boot
844 int ima_calc_boot_aggregate(struct ima_digest_data *hash)
852 if (crypto_id == hash->algo) {
869 hash->algo = ima_tpm_chip->allocated_banks[bank_idx].crypto_id;
871 tfm = ima_alloc_tfm(hash->algo);
875 hash->length = crypto_shash_digestsize(tfm);
877 rc = ima_calc_boot_aggregate_tfm(hash->digest, alg_id, tfm);