Lines Matching refs:tfm

130 static int ahash_setkey_unaligned(struct crypto_ahash *tfm, const u8 *key,  in ahash_setkey_unaligned()  argument
133 unsigned long alignmask = crypto_ahash_alignmask(tfm); in ahash_setkey_unaligned()
145 ret = tfm->setkey(tfm, alignbuffer, keylen); in ahash_setkey_unaligned()
150 static int ahash_nosetkey(struct crypto_ahash *tfm, const u8 *key, in ahash_nosetkey() argument
156 static void ahash_set_needkey(struct crypto_ahash *tfm) in ahash_set_needkey() argument
158 const struct hash_alg_common *alg = crypto_hash_alg_common(tfm); in ahash_set_needkey()
160 if (tfm->setkey != ahash_nosetkey && in ahash_set_needkey()
162 crypto_ahash_set_flags(tfm, CRYPTO_TFM_NEED_KEY); in ahash_set_needkey()
165 int crypto_ahash_setkey(struct crypto_ahash *tfm, const u8 *key, in crypto_ahash_setkey() argument
168 unsigned long alignmask = crypto_ahash_alignmask(tfm); in crypto_ahash_setkey()
172 err = ahash_setkey_unaligned(tfm, key, keylen); in crypto_ahash_setkey()
174 err = tfm->setkey(tfm, key, keylen); in crypto_ahash_setkey()
177 ahash_set_needkey(tfm); in crypto_ahash_setkey()
181 crypto_ahash_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); in crypto_ahash_setkey()
189 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in ahash_save_req() local
190 unsigned long alignmask = crypto_ahash_alignmask(tfm); in ahash_save_req()
191 unsigned int ds = crypto_ahash_digestsize(tfm); in ahash_save_req()
200 reqsize = crypto_ahash_reqsize(tfm); in ahash_save_req()
212 ahash_request_set_tfm(subreq, tfm); in ahash_save_req()
223 state = kmalloc(crypto_ahash_statesize(tfm), gfp); in ahash_save_req()
290 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in crypto_ahash_op() local
291 unsigned long alignmask = crypto_ahash_alignmask(tfm); in crypto_ahash_op()
299 return crypto_hash_errstat(crypto_hash_alg_common(tfm), err); in crypto_ahash_op()
304 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in crypto_ahash_final() local
305 struct hash_alg_common *alg = crypto_hash_alg_common(tfm); in crypto_ahash_final()
310 return crypto_ahash_op(req, tfm->final, true); in crypto_ahash_final()
316 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in crypto_ahash_finup() local
317 struct hash_alg_common *alg = crypto_hash_alg_common(tfm); in crypto_ahash_finup()
326 return crypto_ahash_op(req, tfm->finup, true); in crypto_ahash_finup()
332 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in crypto_ahash_digest() local
333 struct hash_alg_common *alg = crypto_hash_alg_common(tfm); in crypto_ahash_digest()
342 if (crypto_ahash_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) in crypto_ahash_digest()
345 return crypto_ahash_op(req, tfm->digest, false); in crypto_ahash_digest()
400 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in ahash_def_finup() local
407 err = tfm->update(req->priv); in ahash_def_finup()
414 static void crypto_ahash_exit_tfm(struct crypto_tfm *tfm) in crypto_ahash_exit_tfm() argument
416 struct crypto_ahash *hash = __crypto_ahash_cast(tfm); in crypto_ahash_exit_tfm()
422 static int crypto_ahash_init_tfm(struct crypto_tfm *tfm) in crypto_ahash_init_tfm() argument
424 struct crypto_ahash *hash = __crypto_ahash_cast(tfm); in crypto_ahash_init_tfm()
431 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) in crypto_ahash_init_tfm()
432 return crypto_init_shash_ops_async(tfm); in crypto_ahash_init_tfm()
448 tfm->exit = crypto_ahash_exit_tfm; in crypto_ahash_init_tfm()
545 struct crypto_tfm *tfm = crypto_ahash_tfm(hash); in crypto_clone_ahash() local
551 tfm = crypto_tfm_get(tfm); in crypto_clone_ahash()
552 if (IS_ERR(tfm)) in crypto_clone_ahash()
553 return ERR_CAST(tfm); in crypto_clone_ahash()
558 nhash = crypto_clone_tfm(&crypto_ahash_type, tfm); in crypto_clone_ahash()
574 if (tfm->__crt_alg->cra_type != &crypto_ahash_type) in crypto_clone_ahash()