Lines Matching refs:tfm
34 int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
41 static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
44 struct shash_alg *shash = crypto_shash_alg(tfm);
45 unsigned long alignmask = crypto_shash_alignmask(tfm);
57 err = shash->setkey(tfm, alignbuffer, keylen);
62 static void shash_set_needkey(struct crypto_shash *tfm, struct shash_alg *alg)
65 crypto_shash_set_flags(tfm, CRYPTO_TFM_NEED_KEY);
68 int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key,
71 struct shash_alg *shash = crypto_shash_alg(tfm);
72 unsigned long alignmask = crypto_shash_alignmask(tfm);
76 err = shash_setkey_unaligned(tfm, key, keylen);
78 err = shash->setkey(tfm, key, keylen);
81 shash_set_needkey(tfm, shash);
85 crypto_shash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY);
93 struct crypto_shash *tfm = desc->tfm;
94 struct shash_alg *shash = crypto_shash_alg(tfm);
95 unsigned long alignmask = crypto_shash_alignmask(tfm);
123 struct crypto_shash *tfm = desc->tfm;
124 struct shash_alg *shash = crypto_shash_alg(tfm);
125 unsigned long alignmask = crypto_shash_alignmask(tfm);
142 struct crypto_shash *tfm = desc->tfm;
143 unsigned long alignmask = crypto_shash_alignmask(tfm);
144 struct shash_alg *shash = crypto_shash_alg(tfm);
145 unsigned int ds = crypto_shash_digestsize(tfm);
170 struct crypto_shash *tfm = desc->tfm;
171 struct shash_alg *shash = crypto_shash_alg(tfm);
172 unsigned long alignmask = crypto_shash_alignmask(tfm);
197 struct crypto_shash *tfm = desc->tfm;
198 struct shash_alg *shash = crypto_shash_alg(tfm);
199 unsigned long alignmask = crypto_shash_alignmask(tfm);
230 struct crypto_shash *tfm = desc->tfm;
231 struct shash_alg *shash = crypto_shash_alg(tfm);
232 unsigned long alignmask = crypto_shash_alignmask(tfm);
242 if (crypto_shash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY)
253 int crypto_shash_tfm_digest(struct crypto_shash *tfm, const u8 *data,
256 SHASH_DESC_ON_STACK(desc, tfm);
259 desc->tfm = tfm;
271 memcpy(out, shash_desc_ctx(desc), crypto_shash_descsize(desc->tfm));
277 memcpy(shash_desc_ctx(desc), in, crypto_shash_descsize(desc->tfm));
281 static int shash_async_setkey(struct crypto_ahash *tfm, const u8 *key,
284 struct crypto_shash **ctx = crypto_ahash_ctx(tfm);
294 desc->tfm = *ctx;
348 desc->tfm = *ctx;
382 desc->tfm = *ctx;
397 desc->tfm = *ctx;
402 static void crypto_exit_shash_ops_async(struct crypto_tfm *tfm)
404 struct crypto_shash **ctx = crypto_tfm_ctx(tfm);
409 int crypto_init_shash_ops_async(struct crypto_tfm *tfm)
411 struct crypto_alg *calg = tfm->__crt_alg;
413 struct crypto_ahash *crt = __crypto_ahash_cast(tfm);
414 struct crypto_shash **ctx = crypto_tfm_ctx(tfm);
427 tfm->exit = crypto_exit_shash_ops_async;
466 static void crypto_shash_exit_tfm(struct crypto_tfm *tfm)
468 struct crypto_shash *hash = __crypto_shash_cast(tfm);
474 static int crypto_shash_init_tfm(struct crypto_tfm *tfm)
476 struct crypto_shash *hash = __crypto_shash_cast(tfm);
485 tfm->exit = crypto_shash_exit_tfm;
587 struct crypto_tfm *tfm = crypto_shash_tfm(hash);
593 tfm = crypto_tfm_get(tfm);
594 if (IS_ERR(tfm))
595 return ERR_CAST(tfm);
603 nhash = crypto_clone_tfm(&crypto_shash_type, tfm);