Lines Matching refs:tfm

80 	struct crypto_shash *tfm = ima_shash_tfm;  in ima_alloc_tfm()  local
87 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0); in ima_alloc_tfm()
88 if (IS_ERR(tfm)) { in ima_alloc_tfm()
89 rc = PTR_ERR(tfm); in ima_alloc_tfm()
94 return tfm; in ima_alloc_tfm()
97 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
99 if (tfm != ima_shash_tfm) in ima_free_tfm()
100 crypto_free_shash(tfm); in ima_free_tfm()
167 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
173 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
174 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
175 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
177 ima_ahash_tfm = tfm; in ima_alloc_atfm()
179 rc = PTR_ERR(tfm); in ima_alloc_atfm()
184 return tfm; in ima_alloc_atfm()
187 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
189 if (tfm != ima_ahash_tfm) in ima_free_atfm()
190 crypto_free_ahash(tfm); in ima_free_atfm()
206 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
216 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
218 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
317 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
320 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
321 if (IS_ERR(tfm)) in ima_calc_file_ahash()
322 return PTR_ERR(tfm); in ima_calc_file_ahash()
324 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
326 ima_free_atfm(tfm); in ima_calc_file_ahash()
333 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
338 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
340 shash->tfm = tfm; in ima_calc_file_hash_tfm()
342 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
382 struct crypto_shash *tfm; in ima_calc_file_shash() local
385 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
386 if (IS_ERR(tfm)) in ima_calc_file_shash()
387 return PTR_ERR(tfm); in ima_calc_file_shash()
389 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
391 ima_free_tfm(tfm); in ima_calc_file_shash()
470 struct crypto_shash *tfm) in ima_calc_field_array_hash_tfm() argument
472 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_field_array_hash_tfm()
475 shash->tfm = tfm; in ima_calc_field_array_hash_tfm()
477 hash->length = crypto_shash_digestsize(tfm); in ima_calc_field_array_hash_tfm()
516 struct crypto_shash *tfm; in ima_calc_field_array_hash() local
519 tfm = ima_alloc_tfm(hash->algo); in ima_calc_field_array_hash()
520 if (IS_ERR(tfm)) in ima_calc_field_array_hash()
521 return PTR_ERR(tfm); in ima_calc_field_array_hash()
524 hash, tfm); in ima_calc_field_array_hash()
526 ima_free_tfm(tfm); in ima_calc_field_array_hash()
533 struct crypto_ahash *tfm) in calc_buffer_ahash_atfm() argument
540 hash->length = crypto_ahash_digestsize(tfm); in calc_buffer_ahash_atfm()
542 req = ahash_request_alloc(tfm, GFP_KERNEL); in calc_buffer_ahash_atfm()
574 struct crypto_ahash *tfm; in calc_buffer_ahash() local
577 tfm = ima_alloc_atfm(hash->algo); in calc_buffer_ahash()
578 if (IS_ERR(tfm)) in calc_buffer_ahash()
579 return PTR_ERR(tfm); in calc_buffer_ahash()
581 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm); in calc_buffer_ahash()
583 ima_free_atfm(tfm); in calc_buffer_ahash()
590 struct crypto_shash *tfm) in calc_buffer_shash_tfm() argument
592 SHASH_DESC_ON_STACK(shash, tfm); in calc_buffer_shash_tfm()
596 shash->tfm = tfm; in calc_buffer_shash_tfm()
598 hash->length = crypto_shash_digestsize(tfm); in calc_buffer_shash_tfm()
621 struct crypto_shash *tfm; in calc_buffer_shash() local
624 tfm = ima_alloc_tfm(hash->algo); in calc_buffer_shash()
625 if (IS_ERR(tfm)) in calc_buffer_shash()
626 return PTR_ERR(tfm); in calc_buffer_shash()
628 rc = calc_buffer_shash_tfm(buf, len, hash, tfm); in calc_buffer_shash()
630 ima_free_tfm(tfm); in calc_buffer_shash()
661 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
666 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
668 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
687 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
690 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
691 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
692 return PTR_ERR(tfm); in ima_calc_boot_aggregate()
694 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
695 rc = ima_calc_boot_aggregate_tfm(hash->digest, tfm); in ima_calc_boot_aggregate()
697 ima_free_tfm(tfm); in ima_calc_boot_aggregate()