Lines Matching refs:tfm

61 	struct crypto_shash *tfm;
93 struct crypto_shash *tfm = ima_shash_tfm;
100 return tfm;
103 if (ima_algo_array[i].tfm && ima_algo_array[i].algo == algo)
104 return ima_algo_array[i].tfm;
106 tfm = crypto_alloc_shash(hash_algo_name[algo], 0, 0);
107 if (IS_ERR(tfm)) {
108 rc = PTR_ERR(tfm);
112 return tfm;
162 ima_algo_array[i].tfm = ima_shash_tfm;
166 ima_algo_array[i].tfm = ima_alloc_tfm(algo);
167 if (IS_ERR(ima_algo_array[i].tfm)) {
169 rc = PTR_ERR(ima_algo_array[i].tfm);
170 ima_algo_array[i].tfm = NULL;
174 ima_algo_array[i].tfm = NULL;
180 ima_algo_array[ima_sha1_idx].tfm = ima_shash_tfm;
182 ima_algo_array[ima_sha1_idx].tfm =
184 if (IS_ERR(ima_algo_array[ima_sha1_idx].tfm)) {
185 rc = PTR_ERR(ima_algo_array[ima_sha1_idx].tfm);
195 ima_algo_array[ima_hash_algo_idx].tfm = ima_shash_tfm;
202 if (!ima_algo_array[i].tfm ||
203 ima_algo_array[i].tfm == ima_shash_tfm)
206 crypto_free_shash(ima_algo_array[i].tfm);
214 static void ima_free_tfm(struct crypto_shash *tfm)
218 if (tfm == ima_shash_tfm)
222 if (ima_algo_array[i].tfm == tfm)
225 crypto_free_shash(tfm);
292 struct crypto_ahash *tfm = ima_ahash_tfm;
298 if (algo != ima_hash_algo || !tfm) {
299 tfm = crypto_alloc_ahash(hash_algo_name[algo], 0, 0);
300 if (!IS_ERR(tfm)) {
302 ima_ahash_tfm = tfm;
304 rc = PTR_ERR(tfm);
309 return tfm;
312 static void ima_free_atfm(struct crypto_ahash *tfm)
314 if (tfm != ima_ahash_tfm)
315 crypto_free_ahash(tfm);
331 struct crypto_ahash *tfm)
341 hash->length = crypto_ahash_digestsize(tfm);
343 req = ahash_request_alloc(tfm, GFP_KERNEL);
442 struct crypto_ahash *tfm;
445 tfm = ima_alloc_atfm(hash->algo);
446 if (IS_ERR(tfm))
447 return PTR_ERR(tfm);
449 rc = ima_calc_file_hash_atfm(file, hash, tfm);
451 ima_free_atfm(tfm);
458 struct crypto_shash *tfm)
463 SHASH_DESC_ON_STACK(shash, tfm);
465 shash->tfm = tfm;
467 hash->length = crypto_shash_digestsize(tfm);
509 struct crypto_shash *tfm;
512 tfm = ima_alloc_tfm(hash->algo);
513 if (IS_ERR(tfm))
514 return PTR_ERR(tfm);
516 rc = ima_calc_file_hash_tfm(file, hash, tfm);
518 ima_free_tfm(tfm);
587 SHASH_DESC_ON_STACK(shash, ima_algo_array[tfm_idx].tfm);
592 shash->tfm = ima_algo_array[tfm_idx].tfm;
649 if (!ima_algo_array[i].tfm) {
665 struct crypto_ahash *tfm)
672 hash->length = crypto_ahash_digestsize(tfm);
674 req = ahash_request_alloc(tfm, GFP_KERNEL);
706 struct crypto_ahash *tfm;
709 tfm = ima_alloc_atfm(hash->algo);
710 if (IS_ERR(tfm))
711 return PTR_ERR(tfm);
713 rc = calc_buffer_ahash_atfm(buf, len, hash, tfm);
715 ima_free_atfm(tfm);
722 struct crypto_shash *tfm)
724 SHASH_DESC_ON_STACK(shash, tfm);
728 shash->tfm = tfm;
730 hash->length = crypto_shash_digestsize(tfm);
753 struct crypto_shash *tfm;
756 tfm = ima_alloc_tfm(hash->algo);
757 if (IS_ERR(tfm))
758 return PTR_ERR(tfm);
760 rc = calc_buffer_shash_tfm(buf, len, hash, tfm);
762 ima_free_tfm(tfm);
801 struct crypto_shash *tfm)
806 SHASH_DESC_ON_STACK(shash, tfm);
808 shash->tfm = tfm;
822 crypto_shash_digestsize(tfm));
836 crypto_shash_digestsize(tfm));
846 struct crypto_shash *tfm;
871 tfm = ima_alloc_tfm(hash->algo);
872 if (IS_ERR(tfm))
873 return PTR_ERR(tfm);
875 hash->length = crypto_shash_digestsize(tfm);
877 rc = ima_calc_boot_aggregate_tfm(hash->digest, alg_id, tfm);
879 ima_free_tfm(tfm);