Lines Matching refs:tfm
86 struct crypto_shash *tfm = ima_shash_tfm; in ima_alloc_tfm() local
93 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0); in ima_alloc_tfm()
94 if (IS_ERR(tfm)) { in ima_alloc_tfm()
95 rc = PTR_ERR(tfm); in ima_alloc_tfm()
100 return tfm; in ima_alloc_tfm()
103 static void ima_free_tfm(struct crypto_shash *tfm) in ima_free_tfm() argument
105 if (tfm != ima_shash_tfm) in ima_free_tfm()
106 crypto_free_shash(tfm); in ima_free_tfm()
173 struct crypto_ahash *tfm = ima_ahash_tfm; in ima_alloc_atfm() local
179 if (algo != ima_hash_algo || !tfm) { in ima_alloc_atfm()
180 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0); in ima_alloc_atfm()
181 if (!IS_ERR(tfm)) { in ima_alloc_atfm()
183 ima_ahash_tfm = tfm; in ima_alloc_atfm()
185 rc = PTR_ERR(tfm); in ima_alloc_atfm()
190 return tfm; in ima_alloc_atfm()
193 static void ima_free_atfm(struct crypto_ahash *tfm) in ima_free_atfm() argument
195 if (tfm != ima_ahash_tfm) in ima_free_atfm()
196 crypto_free_ahash(tfm); in ima_free_atfm()
229 struct crypto_ahash *tfm) in ima_calc_file_hash_atfm() argument
239 hash->length = crypto_ahash_digestsize(tfm); in ima_calc_file_hash_atfm()
241 req = ahash_request_alloc(tfm, GFP_KERNEL); in ima_calc_file_hash_atfm()
339 struct crypto_ahash *tfm; in ima_calc_file_ahash() local
342 tfm = ima_alloc_atfm(hash->algo); in ima_calc_file_ahash()
343 if (IS_ERR(tfm)) in ima_calc_file_ahash()
344 return PTR_ERR(tfm); in ima_calc_file_ahash()
346 rc = ima_calc_file_hash_atfm(file, hash, tfm); in ima_calc_file_ahash()
348 ima_free_atfm(tfm); in ima_calc_file_ahash()
355 struct crypto_shash *tfm) in ima_calc_file_hash_tfm() argument
360 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_file_hash_tfm()
362 shash->tfm = tfm; in ima_calc_file_hash_tfm()
365 hash->length = crypto_shash_digestsize(tfm); in ima_calc_file_hash_tfm()
412 struct crypto_shash *tfm; in ima_calc_file_shash() local
415 tfm = ima_alloc_tfm(hash->algo); in ima_calc_file_shash()
416 if (IS_ERR(tfm)) in ima_calc_file_shash()
417 return PTR_ERR(tfm); in ima_calc_file_shash()
419 rc = ima_calc_file_hash_tfm(file, hash, tfm); in ima_calc_file_shash()
421 ima_free_tfm(tfm); in ima_calc_file_shash()
462 struct crypto_shash *tfm) in ima_calc_field_array_hash_tfm() argument
464 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_field_array_hash_tfm()
467 shash->tfm = tfm; in ima_calc_field_array_hash_tfm()
470 hash->length = crypto_shash_digestsize(tfm); in ima_calc_field_array_hash_tfm()
507 struct crypto_shash *tfm; in ima_calc_field_array_hash() local
510 tfm = ima_alloc_tfm(hash->algo); in ima_calc_field_array_hash()
511 if (IS_ERR(tfm)) in ima_calc_field_array_hash()
512 return PTR_ERR(tfm); in ima_calc_field_array_hash()
515 hash, tfm); in ima_calc_field_array_hash()
517 ima_free_tfm(tfm); in ima_calc_field_array_hash()
535 struct crypto_shash *tfm) in ima_calc_boot_aggregate_tfm() argument
539 SHASH_DESC_ON_STACK(shash, tfm); in ima_calc_boot_aggregate_tfm()
541 shash->tfm = tfm; in ima_calc_boot_aggregate_tfm()
561 struct crypto_shash *tfm; in ima_calc_boot_aggregate() local
564 tfm = ima_alloc_tfm(hash->algo); in ima_calc_boot_aggregate()
565 if (IS_ERR(tfm)) in ima_calc_boot_aggregate()
566 return PTR_ERR(tfm); in ima_calc_boot_aggregate()
568 hash->length = crypto_shash_digestsize(tfm); in ima_calc_boot_aggregate()
569 rc = ima_calc_boot_aggregate_tfm(hash->digest, tfm); in ima_calc_boot_aggregate()
571 ima_free_tfm(tfm); in ima_calc_boot_aggregate()