Lines Matching refs:tfm

286 	struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);  in skcipher_walk_virt()  local
291 alg = crypto_skcipher_alg(tfm); in skcipher_walk_virt()
308 walk->blocksize = crypto_skcipher_blocksize(tfm); in skcipher_walk_virt()
309 walk->ivsize = crypto_skcipher_ivsize(tfm); in skcipher_walk_virt()
310 walk->alignmask = crypto_skcipher_alignmask(tfm); in skcipher_walk_virt()
325 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in skcipher_walk_aead_common() local
341 walk->blocksize = crypto_aead_blocksize(tfm); in skcipher_walk_aead_common()
342 walk->stride = crypto_aead_chunksize(tfm); in skcipher_walk_aead_common()
343 walk->ivsize = crypto_aead_ivsize(tfm); in skcipher_walk_aead_common()
344 walk->alignmask = crypto_aead_alignmask(tfm); in skcipher_walk_aead_common()
363 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in skcipher_walk_aead_decrypt() local
365 walk->total = req->cryptlen - crypto_aead_authsize(tfm); in skcipher_walk_aead_decrypt()
371 static void skcipher_set_needkey(struct crypto_skcipher *tfm) in skcipher_set_needkey() argument
373 if (crypto_skcipher_max_keysize(tfm) != 0) in skcipher_set_needkey()
374 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_NEED_KEY); in skcipher_set_needkey()
377 static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm, in skcipher_setkey_unaligned() argument
380 unsigned long alignmask = crypto_skcipher_alignmask(tfm); in skcipher_setkey_unaligned()
381 struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); in skcipher_setkey_unaligned()
393 ret = cipher->setkey(tfm, alignbuffer, keylen); in skcipher_setkey_unaligned()
398 int crypto_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, in crypto_skcipher_setkey() argument
401 struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); in crypto_skcipher_setkey()
402 unsigned long alignmask = crypto_skcipher_alignmask(tfm); in crypto_skcipher_setkey()
406 struct crypto_lskcipher **ctx = crypto_skcipher_ctx(tfm); in crypto_skcipher_setkey()
410 crypto_skcipher_get_flags(tfm) & in crypto_skcipher_setkey()
420 err = skcipher_setkey_unaligned(tfm, key, keylen); in crypto_skcipher_setkey()
422 err = cipher->setkey(tfm, key, keylen); in crypto_skcipher_setkey()
426 skcipher_set_needkey(tfm); in crypto_skcipher_setkey()
430 crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); in crypto_skcipher_setkey()
437 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_encrypt() local
438 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_encrypt()
440 if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) in crypto_skcipher_encrypt()
450 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_decrypt() local
451 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_decrypt()
453 if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) in crypto_skcipher_decrypt()
463 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_lskcipher_export() local
466 ivs = PTR_ALIGN(ivs, crypto_skcipher_alignmask(tfm) + 1); in crypto_lskcipher_export()
468 memcpy(out, ivs + crypto_skcipher_ivsize(tfm), in crypto_lskcipher_export()
469 crypto_skcipher_statesize(tfm)); in crypto_lskcipher_export()
476 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_lskcipher_import() local
479 ivs = PTR_ALIGN(ivs, crypto_skcipher_alignmask(tfm) + 1); in crypto_lskcipher_import()
481 memcpy(ivs + crypto_skcipher_ivsize(tfm), in, in crypto_lskcipher_import()
482 crypto_skcipher_statesize(tfm)); in crypto_lskcipher_import()
499 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_export() local
500 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_export()
510 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_import() local
511 struct skcipher_alg *alg = crypto_skcipher_alg(tfm); in crypto_skcipher_import()
519 static void crypto_skcipher_exit_tfm(struct crypto_tfm *tfm) in crypto_skcipher_exit_tfm() argument
521 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_skcipher_exit_tfm()
527 static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm) in crypto_skcipher_init_tfm() argument
529 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_skcipher_init_tfm()
534 if (tfm->__crt_alg->cra_type != &crypto_skcipher_type) { in crypto_skcipher_init_tfm()
543 return crypto_init_lskcipher_ops_sg(tfm); in crypto_skcipher_init_tfm()
546 crypto_skcipher_set_reqsize(skcipher, crypto_tfm_alg_reqsize(tfm)); in crypto_skcipher_init_tfm()
647 struct crypto_skcipher *tfm; in crypto_alloc_sync_skcipher() local
653 tfm = crypto_alloc_tfm(alg_name, &crypto_skcipher_type, type, mask); in crypto_alloc_sync_skcipher()
659 if (!IS_ERR(tfm) && WARN_ON(crypto_skcipher_reqsize(tfm) > in crypto_alloc_sync_skcipher()
661 crypto_free_skcipher(tfm); in crypto_alloc_sync_skcipher()
665 return (struct crypto_sync_skcipher *)tfm; in crypto_alloc_sync_skcipher()
783 static int skcipher_setkey_simple(struct crypto_skcipher *tfm, const u8 *key, in skcipher_setkey_simple() argument
786 struct crypto_cipher *cipher = skcipher_cipher_simple(tfm); in skcipher_setkey_simple()
789 crypto_cipher_set_flags(cipher, crypto_skcipher_get_flags(tfm) & in skcipher_setkey_simple()
794 static int skcipher_init_tfm_simple(struct crypto_skcipher *tfm) in skcipher_init_tfm_simple() argument
796 struct skcipher_instance *inst = skcipher_alg_instance(tfm); in skcipher_init_tfm_simple()
798 struct skcipher_ctx_simple *ctx = crypto_skcipher_ctx(tfm); in skcipher_init_tfm_simple()
809 static void skcipher_exit_tfm_simple(struct crypto_skcipher *tfm) in skcipher_exit_tfm_simple() argument
811 struct skcipher_ctx_simple *ctx = crypto_skcipher_ctx(tfm); in skcipher_exit_tfm_simple()