Lines Matching refs:tfm
61 struct crypto_shash *tfm; member
93 struct crypto_shash *tfm = ima_shash_tfm; in ima_alloc_tfm() local
100 return tfm; in ima_alloc_tfm()
103 if (ima_algo_array[i].tfm && ima_algo_array[i].algo == algo) in ima_alloc_tfm()
104 return ima_algo_array[i].tfm; in ima_alloc_tfm()
106 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0); in ima_alloc_tfm()
107 if (IS_ERR(tfm)) { in ima_alloc_tfm()
108 rc = PTR_ERR(tfm); in ima_alloc_tfm()
112 return tfm; in ima_alloc_tfm()
162 ima_algo_array[i].tfm = ima_shash_tfm; in ima_init_crypto()
166 ima_algo_array[i].tfm = ima_alloc_tfm(algo); in ima_init_crypto()
167 if (IS_ERR(ima_algo_array[i].tfm)) { in ima_init_crypto()
169 rc = PTR_ERR(ima_algo_array[i].tfm); in ima_init_crypto()
170 ima_algo_array[i].tfm = NULL; in ima_init_crypto()
174 ima_algo_array[i].tfm = NULL; in ima_init_crypto()
180 ima_algo_array[ima_sha1_idx].tfm = ima_shash_tfm; in ima_init_crypto()
182 ima_algo_array[ima_sha1_idx].tfm = in ima_init_crypto()
184 if (IS_ERR(ima_algo_array[ima_sha1_idx].tfm)) { in ima_init_crypto()
185 rc = PTR_ERR(ima_algo_array[ima_sha1_idx].tfm); in ima_init_crypto()
195 ima_algo_array[ima_hash_algo_idx].tfm = ima_shash_tfm; in ima_init_crypto()
202 if (!ima_algo_array[i].tfm || in ima_init_crypto()
203 ima_algo_array[i].tfm == ima_shash_tfm) in ima_init_crypto()
206 crypto_free_shash(ima_algo_array[i].tfm); in ima_init_crypto()
214 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
218 if (tfm == ima_shash_tfm) in ima_free_tfm()
222 if (ima_algo_array[i].tfm == tfm) in ima_free_tfm()
225 crypto_free_shash(tfm); in ima_free_tfm()
292 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
298 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
299 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
300 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
302 ima_ahash_tfm = tfm; in ima_alloc_atfm()
304 rc = PTR_ERR(tfm); in ima_alloc_atfm()
309 return tfm; in ima_alloc_atfm()
312 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
314 if (tfm != ima_ahash_tfm) in ima_free_atfm()
315 crypto_free_ahash(tfm); in ima_free_atfm()
331 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
341 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
343 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
442 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
445 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
446 if (IS_ERR(tfm)) in ima_calc_file_ahash()
447 return PTR_ERR(tfm); in ima_calc_file_ahash()
449 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
451 ima_free_atfm(tfm); in ima_calc_file_ahash()
458 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
463 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
465 shash->tfm = tfm; in ima_calc_file_hash_tfm()
467 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
509 struct crypto_shash *tfm; in ima_calc_file_shash() local
512 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
513 if (IS_ERR(tfm)) in ima_calc_file_shash()
514 return PTR_ERR(tfm); in ima_calc_file_shash()
516 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
518 ima_free_tfm(tfm); in ima_calc_file_shash()
587 SHASH_DESC_ON_STACK(shash, ima_algo_array[tfm_idx].tfm); in ima_calc_field_array_hash_tfm()
592 shash->tfm = ima_algo_array[tfm_idx].tfm; in ima_calc_field_array_hash_tfm()
649 if (!ima_algo_array[i].tfm) { in ima_calc_field_array_hash()
665 struct crypto_ahash *tfm) in calc_buffer_ahash_atfm() argument
672 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
674 req = ahash_request_alloc(tfm, GFP_KERNEL); in calc_buffer_ahash_atfm()
706 struct crypto_ahash *tfm; in calc_buffer_ahash() local
709 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
710 if (IS_ERR(tfm)) in calc_buffer_ahash()
711 return PTR_ERR(tfm); in calc_buffer_ahash()
713 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
715 ima_free_atfm(tfm); in calc_buffer_ahash()
722 struct crypto_shash *tfm) in calc_buffer_shash_tfm() argument
724 SHASH_DESC_ON_STACK(shash, tfm); in calc_buffer_shash_tfm()
728 shash->tfm = tfm; in calc_buffer_shash_tfm()
730 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
753 struct crypto_shash *tfm; in calc_buffer_shash() local
756 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
757 if (IS_ERR(tfm)) in calc_buffer_shash()
758 return PTR_ERR(tfm); in calc_buffer_shash()
760 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
762 ima_free_tfm(tfm); in calc_buffer_shash()
801 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
806 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
808 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
822 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
836 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
846 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
871 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
872 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
873 return PTR_ERR(tfm); in ima_calc_boot_aggregate()
875 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
877 rc = ima_calc_boot_aggregate_tfm(hash->digest, alg_id, tfm); in ima_calc_boot_aggregate()
879 ima_free_tfm(tfm); in ima_calc_boot_aggregate()