Lines Matching refs:tfm
451 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in skcipher_walk_skcipher() local
468 walk->blocksize = crypto_skcipher_blocksize(tfm); in skcipher_walk_skcipher()
469 walk->stride = crypto_skcipher_walksize(tfm); in skcipher_walk_skcipher()
470 walk->ivsize = crypto_skcipher_ivsize(tfm); in skcipher_walk_skcipher()
471 walk->alignmask = crypto_skcipher_alignmask(tfm); in skcipher_walk_skcipher()
513 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in skcipher_walk_aead_common() local
539 walk->blocksize = crypto_aead_blocksize(tfm); in skcipher_walk_aead_common()
540 walk->stride = crypto_aead_chunksize(tfm); in skcipher_walk_aead_common()
541 walk->ivsize = crypto_aead_ivsize(tfm); in skcipher_walk_aead_common()
542 walk->alignmask = crypto_aead_alignmask(tfm); in skcipher_walk_aead_common()
573 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in skcipher_walk_aead_decrypt() local
575 walk->total = req->cryptlen - crypto_aead_authsize(tfm); in skcipher_walk_aead_decrypt()
592 static void skcipher_set_needkey(struct crypto_skcipher *tfm) in skcipher_set_needkey() argument
594 if (tfm->keysize) in skcipher_set_needkey()
595 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_NEED_KEY); in skcipher_set_needkey()
598 static int skcipher_setkey_blkcipher(struct crypto_skcipher *tfm, in skcipher_setkey_blkcipher() argument
601 struct crypto_blkcipher **ctx = crypto_skcipher_ctx(tfm); in skcipher_setkey_blkcipher()
606 crypto_blkcipher_set_flags(blkcipher, crypto_skcipher_get_flags(tfm) & in skcipher_setkey_blkcipher()
609 crypto_skcipher_set_flags(tfm, crypto_blkcipher_get_flags(blkcipher) & in skcipher_setkey_blkcipher()
612 skcipher_set_needkey(tfm); in skcipher_setkey_blkcipher()
616 crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); in skcipher_setkey_blkcipher()
626 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in skcipher_crypt_blkcipher() local
627 struct crypto_blkcipher **ctx = crypto_skcipher_ctx(tfm); in skcipher_crypt_blkcipher()
629 .tfm = *ctx, in skcipher_crypt_blkcipher()
641 struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher); in skcipher_encrypt_blkcipher() local
642 struct blkcipher_alg *alg = &tfm->__crt_alg->cra_blkcipher; in skcipher_encrypt_blkcipher()
650 struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher); in skcipher_decrypt_blkcipher() local
651 struct blkcipher_alg *alg = &tfm->__crt_alg->cra_blkcipher; in skcipher_decrypt_blkcipher()
656 static void crypto_exit_skcipher_ops_blkcipher(struct crypto_tfm *tfm) in crypto_exit_skcipher_ops_blkcipher() argument
658 struct crypto_blkcipher **ctx = crypto_tfm_ctx(tfm); in crypto_exit_skcipher_ops_blkcipher()
663 static int crypto_init_skcipher_ops_blkcipher(struct crypto_tfm *tfm) in crypto_init_skcipher_ops_blkcipher() argument
665 struct crypto_alg *calg = tfm->__crt_alg; in crypto_init_skcipher_ops_blkcipher()
666 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_init_skcipher_ops_blkcipher()
667 struct crypto_blkcipher **ctx = crypto_tfm_ctx(tfm); in crypto_init_skcipher_ops_blkcipher()
683 tfm->exit = crypto_exit_skcipher_ops_blkcipher; in crypto_init_skcipher_ops_blkcipher()
697 static int skcipher_setkey_ablkcipher(struct crypto_skcipher *tfm, in skcipher_setkey_ablkcipher() argument
700 struct crypto_ablkcipher **ctx = crypto_skcipher_ctx(tfm); in skcipher_setkey_ablkcipher()
706 crypto_skcipher_get_flags(tfm) & in skcipher_setkey_ablkcipher()
709 crypto_skcipher_set_flags(tfm, in skcipher_setkey_ablkcipher()
713 skcipher_set_needkey(tfm); in skcipher_setkey_ablkcipher()
717 crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); in skcipher_setkey_ablkcipher()
724 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in skcipher_crypt_ablkcipher() local
725 struct crypto_ablkcipher **ctx = crypto_skcipher_ctx(tfm); in skcipher_crypt_ablkcipher()
740 struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher); in skcipher_encrypt_ablkcipher() local
741 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in skcipher_encrypt_ablkcipher()
749 struct crypto_tfm *tfm = crypto_skcipher_tfm(skcipher); in skcipher_decrypt_ablkcipher() local
750 struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher; in skcipher_decrypt_ablkcipher()
755 static void crypto_exit_skcipher_ops_ablkcipher(struct crypto_tfm *tfm) in crypto_exit_skcipher_ops_ablkcipher() argument
757 struct crypto_ablkcipher **ctx = crypto_tfm_ctx(tfm); in crypto_exit_skcipher_ops_ablkcipher()
762 static int crypto_init_skcipher_ops_ablkcipher(struct crypto_tfm *tfm) in crypto_init_skcipher_ops_ablkcipher() argument
764 struct crypto_alg *calg = tfm->__crt_alg; in crypto_init_skcipher_ops_ablkcipher()
765 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_init_skcipher_ops_ablkcipher()
766 struct crypto_ablkcipher **ctx = crypto_tfm_ctx(tfm); in crypto_init_skcipher_ops_ablkcipher()
781 tfm->exit = crypto_exit_skcipher_ops_ablkcipher; in crypto_init_skcipher_ops_ablkcipher()
797 static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm, in skcipher_setkey_unaligned() argument
800 unsigned long alignmask = crypto_skcipher_alignmask(tfm); in skcipher_setkey_unaligned()
801 struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); in skcipher_setkey_unaligned()
813 ret = cipher->setkey(tfm, alignbuffer, keylen); in skcipher_setkey_unaligned()
818 static int skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, in skcipher_setkey() argument
821 struct skcipher_alg *cipher = crypto_skcipher_alg(tfm); in skcipher_setkey()
822 unsigned long alignmask = crypto_skcipher_alignmask(tfm); in skcipher_setkey()
826 crypto_skcipher_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN); in skcipher_setkey()
831 err = skcipher_setkey_unaligned(tfm, key, keylen); in skcipher_setkey()
833 err = cipher->setkey(tfm, key, keylen); in skcipher_setkey()
836 skcipher_set_needkey(tfm); in skcipher_setkey()
840 crypto_skcipher_clear_flags(tfm, CRYPTO_TFM_NEED_KEY); in skcipher_setkey()
846 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_encrypt() local
847 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_skcipher_encrypt()
852 if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) in crypto_skcipher_encrypt()
855 ret = tfm->encrypt(req); in crypto_skcipher_encrypt()
863 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_skcipher_decrypt() local
864 struct crypto_alg *alg = tfm->base.__crt_alg; in crypto_skcipher_decrypt()
869 if (crypto_skcipher_get_flags(tfm) & CRYPTO_TFM_NEED_KEY) in crypto_skcipher_decrypt()
872 ret = tfm->decrypt(req); in crypto_skcipher_decrypt()
878 static void crypto_skcipher_exit_tfm(struct crypto_tfm *tfm) in crypto_skcipher_exit_tfm() argument
880 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_skcipher_exit_tfm()
886 static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm) in crypto_skcipher_init_tfm() argument
888 struct crypto_skcipher *skcipher = __crypto_skcipher_cast(tfm); in crypto_skcipher_init_tfm()
891 if (tfm->__crt_alg->cra_type == &crypto_blkcipher_type) in crypto_skcipher_init_tfm()
892 return crypto_init_skcipher_ops_blkcipher(tfm); in crypto_skcipher_init_tfm()
894 if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type) in crypto_skcipher_init_tfm()
895 return crypto_init_skcipher_ops_ablkcipher(tfm); in crypto_skcipher_init_tfm()
999 struct crypto_skcipher *tfm; in crypto_alloc_sync_skcipher() local
1004 tfm = crypto_alloc_tfm(alg_name, &crypto_skcipher_type2, type, mask); in crypto_alloc_sync_skcipher()
1010 if (!IS_ERR(tfm) && WARN_ON(crypto_skcipher_reqsize(tfm) > in crypto_alloc_sync_skcipher()
1012 crypto_free_skcipher(tfm); in crypto_alloc_sync_skcipher()
1016 return (struct crypto_sync_skcipher *)tfm; in crypto_alloc_sync_skcipher()
1108 static int skcipher_setkey_simple(struct crypto_skcipher *tfm, const u8 *key, in skcipher_setkey_simple() argument
1111 struct crypto_cipher *cipher = skcipher_cipher_simple(tfm); in skcipher_setkey_simple()
1115 crypto_cipher_set_flags(cipher, crypto_skcipher_get_flags(tfm) & in skcipher_setkey_simple()
1118 crypto_skcipher_set_flags(tfm, crypto_cipher_get_flags(cipher) & in skcipher_setkey_simple()
1123 static int skcipher_init_tfm_simple(struct crypto_skcipher *tfm) in skcipher_init_tfm_simple() argument
1125 struct skcipher_instance *inst = skcipher_alg_instance(tfm); in skcipher_init_tfm_simple()
1127 struct skcipher_ctx_simple *ctx = crypto_skcipher_ctx(tfm); in skcipher_init_tfm_simple()
1138 static void skcipher_exit_tfm_simple(struct crypto_skcipher *tfm) in skcipher_exit_tfm_simple() argument
1140 struct skcipher_ctx_simple *ctx = crypto_skcipher_ctx(tfm); in skcipher_exit_tfm_simple()