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()
213 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
217 if (tfm == ima_shash_tfm) in ima_free_tfm()
221 if (ima_algo_array[i].tfm == tfm) in ima_free_tfm()
224 crypto_free_shash(tfm); in ima_free_tfm()
291 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
297 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
298 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
299 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
301 ima_ahash_tfm = tfm; in ima_alloc_atfm()
303 rc = PTR_ERR(tfm); in ima_alloc_atfm()
308 return tfm; in ima_alloc_atfm()
311 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
313 if (tfm != ima_ahash_tfm) in ima_free_atfm()
314 crypto_free_ahash(tfm); in ima_free_atfm()
330 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
340 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
342 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
441 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
444 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
445 if (IS_ERR(tfm)) in ima_calc_file_ahash()
446 return PTR_ERR(tfm); in ima_calc_file_ahash()
448 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
450 ima_free_atfm(tfm); in ima_calc_file_ahash()
457 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
462 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
464 shash->tfm = tfm; in ima_calc_file_hash_tfm()
466 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
508 struct crypto_shash *tfm; in ima_calc_file_shash() local
511 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
512 if (IS_ERR(tfm)) in ima_calc_file_shash()
513 return PTR_ERR(tfm); in ima_calc_file_shash()
515 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
517 ima_free_tfm(tfm); in ima_calc_file_shash()
586 SHASH_DESC_ON_STACK(shash, ima_algo_array[tfm_idx].tfm); in ima_calc_field_array_hash_tfm()
591 shash->tfm = ima_algo_array[tfm_idx].tfm; in ima_calc_field_array_hash_tfm()
648 if (!ima_algo_array[i].tfm) { in ima_calc_field_array_hash()
664 struct crypto_ahash *tfm) in calc_buffer_ahash_atfm() argument
671 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
673 req = ahash_request_alloc(tfm, GFP_KERNEL); in calc_buffer_ahash_atfm()
705 struct crypto_ahash *tfm; in calc_buffer_ahash() local
708 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
709 if (IS_ERR(tfm)) in calc_buffer_ahash()
710 return PTR_ERR(tfm); in calc_buffer_ahash()
712 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
714 ima_free_atfm(tfm); in calc_buffer_ahash()
721 struct crypto_shash *tfm) in calc_buffer_shash_tfm() argument
723 SHASH_DESC_ON_STACK(shash, tfm); in calc_buffer_shash_tfm()
727 shash->tfm = tfm; in calc_buffer_shash_tfm()
729 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
752 struct crypto_shash *tfm; in calc_buffer_shash() local
755 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
756 if (IS_ERR(tfm)) in calc_buffer_shash()
757 return PTR_ERR(tfm); in calc_buffer_shash()
759 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
761 ima_free_tfm(tfm); in calc_buffer_shash()
800 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
805 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
807 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
821 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
835 crypto_shash_digestsize(tfm)); in ima_calc_boot_aggregate_tfm()
845 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
870 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
871 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
872 return PTR_ERR(tfm); in ima_calc_boot_aggregate()
874 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
876 rc = ima_calc_boot_aggregate_tfm(hash->digest, alg_id, tfm); in ima_calc_boot_aggregate()
878 ima_free_tfm(tfm); in ima_calc_boot_aggregate()