Lines Matching refs:tfm

83 	struct crypto_shash *tfm = ima_shash_tfm;  in ima_alloc_tfm()  local
90 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0); in ima_alloc_tfm()
91 if (IS_ERR(tfm)) { in ima_alloc_tfm()
92 rc = PTR_ERR(tfm); in ima_alloc_tfm()
97 return tfm; in ima_alloc_tfm()
100 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
102 if (tfm != ima_shash_tfm) in ima_free_tfm()
103 crypto_free_shash(tfm); in ima_free_tfm()
170 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
176 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
177 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
178 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
180 ima_ahash_tfm = tfm; in ima_alloc_atfm()
182 rc = PTR_ERR(tfm); in ima_alloc_atfm()
187 return tfm; in ima_alloc_atfm()
190 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
192 if (tfm != ima_ahash_tfm) in ima_free_atfm()
193 crypto_free_ahash(tfm); in ima_free_atfm()
209 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
219 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
221 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
319 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
322 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
323 if (IS_ERR(tfm)) in ima_calc_file_ahash()
324 return PTR_ERR(tfm); in ima_calc_file_ahash()
326 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
328 ima_free_atfm(tfm); in ima_calc_file_ahash()
335 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
340 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
342 shash->tfm = tfm; in ima_calc_file_hash_tfm()
345 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
392 struct crypto_shash *tfm; in ima_calc_file_shash() local
395 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
396 if (IS_ERR(tfm)) in ima_calc_file_shash()
397 return PTR_ERR(tfm); in ima_calc_file_shash()
399 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
401 ima_free_tfm(tfm); in ima_calc_file_shash()
452 struct crypto_shash *tfm) in ima_calc_field_array_hash_tfm() argument
454 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_field_array_hash_tfm()
457 shash->tfm = tfm; in ima_calc_field_array_hash_tfm()
460 hash->length = crypto_shash_digestsize(tfm); in ima_calc_field_array_hash_tfm()
499 struct crypto_shash *tfm; in ima_calc_field_array_hash() local
502 tfm = ima_alloc_tfm(hash->algo); in ima_calc_field_array_hash()
503 if (IS_ERR(tfm)) in ima_calc_field_array_hash()
504 return PTR_ERR(tfm); in ima_calc_field_array_hash()
507 hash, tfm); in ima_calc_field_array_hash()
509 ima_free_tfm(tfm); in ima_calc_field_array_hash()
516 struct crypto_ahash *tfm) in calc_buffer_ahash_atfm() argument
523 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
525 req = ahash_request_alloc(tfm, GFP_KERNEL); in calc_buffer_ahash_atfm()
557 struct crypto_ahash *tfm; in calc_buffer_ahash() local
560 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
561 if (IS_ERR(tfm)) in calc_buffer_ahash()
562 return PTR_ERR(tfm); in calc_buffer_ahash()
564 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
566 ima_free_atfm(tfm); in calc_buffer_ahash()
573 struct crypto_shash *tfm) in calc_buffer_shash_tfm() argument
575 SHASH_DESC_ON_STACK(shash, tfm); in calc_buffer_shash_tfm()
579 shash->tfm = tfm; in calc_buffer_shash_tfm()
582 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
605 struct crypto_shash *tfm; in calc_buffer_shash() local
608 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
609 if (IS_ERR(tfm)) in calc_buffer_shash()
610 return PTR_ERR(tfm); in calc_buffer_shash()
612 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
614 ima_free_tfm(tfm); in calc_buffer_shash()
645 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
649 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
651 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
671 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
674 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
675 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
676 return PTR_ERR(tfm); in ima_calc_boot_aggregate()
678 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
679 rc = ima_calc_boot_aggregate_tfm(hash->digest, tfm); in ima_calc_boot_aggregate()
681 ima_free_tfm(tfm); in ima_calc_boot_aggregate()