Lines Matching refs:tfm

88 	struct crypto_shash *tfm = ima_shash_tfm;  in ima_alloc_tfm()  local
95 return tfm; in ima_alloc_tfm()
98 if (ima_algo_array[i].tfm && ima_algo_array[i].algo == algo) in ima_alloc_tfm()
99 return ima_algo_array[i].tfm; in ima_alloc_tfm()
101 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0); in ima_alloc_tfm()
102 if (IS_ERR(tfm)) { in ima_alloc_tfm()
103 rc = PTR_ERR(tfm); in ima_alloc_tfm()
107 return tfm; in ima_alloc_tfm()
157 ima_algo_array[i].tfm = ima_shash_tfm; in ima_init_crypto()
161 ima_algo_array[i].tfm = ima_alloc_tfm(algo); in ima_init_crypto()
162 if (IS_ERR(ima_algo_array[i].tfm)) { in ima_init_crypto()
164 rc = PTR_ERR(ima_algo_array[i].tfm); in ima_init_crypto()
165 ima_algo_array[i].tfm = NULL; in ima_init_crypto()
169 ima_algo_array[i].tfm = NULL; in ima_init_crypto()
175 ima_algo_array[ima_sha1_idx].tfm = ima_shash_tfm; in ima_init_crypto()
177 ima_algo_array[ima_sha1_idx].tfm = in ima_init_crypto()
179 if (IS_ERR(ima_algo_array[ima_sha1_idx].tfm)) { in ima_init_crypto()
180 rc = PTR_ERR(ima_algo_array[ima_sha1_idx].tfm); in ima_init_crypto()
190 ima_algo_array[ima_hash_algo_idx].tfm = ima_shash_tfm; in ima_init_crypto()
197 if (!ima_algo_array[i].tfm || in ima_init_crypto()
198 ima_algo_array[i].tfm == ima_shash_tfm) in ima_init_crypto()
201 crypto_free_shash(ima_algo_array[i].tfm); in ima_init_crypto()
209 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
213 if (tfm == ima_shash_tfm) in ima_free_tfm()
217 if (ima_algo_array[i].tfm == tfm) in ima_free_tfm()
220 crypto_free_shash(tfm); in ima_free_tfm()
287 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
293 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
294 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
295 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
297 ima_ahash_tfm = tfm; in ima_alloc_atfm()
299 rc = PTR_ERR(tfm); in ima_alloc_atfm()
304 return tfm; in ima_alloc_atfm()
307 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
309 if (tfm != ima_ahash_tfm) in ima_free_atfm()
310 crypto_free_ahash(tfm); in ima_free_atfm()
326 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
336 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
338 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
437 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
440 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
441 if (IS_ERR(tfm)) in ima_calc_file_ahash()
442 return PTR_ERR(tfm); in ima_calc_file_ahash()
444 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
446 ima_free_atfm(tfm); in ima_calc_file_ahash()
453 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
458 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
460 shash->tfm = tfm; in ima_calc_file_hash_tfm()
462 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
504 struct crypto_shash *tfm; in ima_calc_file_shash() local
507 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
508 if (IS_ERR(tfm)) in ima_calc_file_shash()
509 return PTR_ERR(tfm); in ima_calc_file_shash()
511 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
513 ima_free_tfm(tfm); in ima_calc_file_shash()
582 SHASH_DESC_ON_STACK(shash, ima_algo_array[tfm_idx].tfm); in ima_calc_field_array_hash_tfm()
587 shash->tfm = ima_algo_array[tfm_idx].tfm; in ima_calc_field_array_hash_tfm()
644 if (!ima_algo_array[i].tfm) { in ima_calc_field_array_hash()
660 struct crypto_ahash *tfm) in calc_buffer_ahash_atfm() argument
667 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
669 req = ahash_request_alloc(tfm, GFP_KERNEL); in calc_buffer_ahash_atfm()
701 struct crypto_ahash *tfm; in calc_buffer_ahash() local
704 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
705 if (IS_ERR(tfm)) in calc_buffer_ahash()
706 return PTR_ERR(tfm); in calc_buffer_ahash()
708 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
710 ima_free_atfm(tfm); in calc_buffer_ahash()
717 struct crypto_shash *tfm) in calc_buffer_shash_tfm() argument
719 SHASH_DESC_ON_STACK(shash, tfm); in calc_buffer_shash_tfm()
723 shash->tfm = tfm; in calc_buffer_shash_tfm()
725 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
748 struct crypto_shash *tfm; in calc_buffer_shash() local
751 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
752 if (IS_ERR(tfm)) in calc_buffer_shash()
753 return PTR_ERR(tfm); in calc_buffer_shash()
755 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
757 ima_free_tfm(tfm); in calc_buffer_shash()
796 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
801 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
803 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
817 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
831 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
841 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
866 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
867 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
868 return PTR_ERR(tfm); 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()
874 ima_free_tfm(tfm); in ima_calc_boot_aggregate()