Lines Matching refs:tfm
144 struct crypto_tfm *tfm; member
248 static inline u32 cipher_cfg_enc(struct crypto_tfm *tfm) in cipher_cfg_enc() argument
250 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_enc; in cipher_cfg_enc()
253 static inline u32 cipher_cfg_dec(struct crypto_tfm *tfm) in cipher_cfg_dec() argument
255 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_dec; in cipher_cfg_dec()
258 static inline const struct ix_hash_algo *ix_hash(struct crypto_tfm *tfm) in ix_hash() argument
260 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->hash; in ix_hash()
354 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in finish_scattered_hmac() local
355 int authsize = crypto_aead_authsize(tfm); in finish_scattered_hmac()
392 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in one_packet() local
393 unsigned int ivsize = crypto_skcipher_ivsize(tfm); in one_packet()
415 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
423 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
613 static int init_tfm(struct crypto_tfm *tfm) in init_tfm() argument
615 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in init_tfm()
629 static int init_tfm_ablk(struct crypto_skcipher *tfm) in init_tfm_ablk() argument
631 struct crypto_tfm *ctfm = crypto_skcipher_tfm(tfm); in init_tfm_ablk()
643 crypto_tfm_alg_driver_name(&tfm->base), in init_tfm_ablk()
647 …crypto_skcipher_set_reqsize(tfm, sizeof(struct ablk_ctx) + crypto_skcipher_reqsize(ctx->fallback_t… in init_tfm_ablk()
648 return init_tfm(crypto_skcipher_tfm(tfm)); in init_tfm_ablk()
651 static int init_tfm_aead(struct crypto_aead *tfm) in init_tfm_aead() argument
653 crypto_aead_set_reqsize(tfm, sizeof(struct aead_ctx)); in init_tfm_aead()
654 return init_tfm(crypto_aead_tfm(tfm)); in init_tfm_aead()
657 static void exit_tfm(struct crypto_tfm *tfm) in exit_tfm() argument
659 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in exit_tfm()
665 static void exit_tfm_ablk(struct crypto_skcipher *tfm) in exit_tfm_ablk() argument
667 struct crypto_tfm *ctfm = crypto_skcipher_tfm(tfm); in exit_tfm_ablk()
671 exit_tfm(crypto_skcipher_tfm(tfm)); in exit_tfm_ablk()
674 static void exit_tfm_aead(struct crypto_aead *tfm) in exit_tfm_aead() argument
676 exit_tfm(crypto_aead_tfm(tfm)); in exit_tfm_aead()
679 static int register_chain_var(struct crypto_tfm *tfm, u8 xpad, u32 target, in register_chain_var() argument
683 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in register_chain_var()
711 crypt->data.tfm = tfm; in register_chain_var()
735 static int setup_auth(struct crypto_tfm *tfm, int encrypt, unsigned int authsize, in setup_auth() argument
743 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in setup_auth()
748 algo = ix_hash(tfm); in setup_auth()
774 ret = register_chain_var(tfm, HMAC_OPAD_VALUE, otarget, in setup_auth()
778 return register_chain_var(tfm, HMAC_IPAD_VALUE, itarget, in setup_auth()
782 static int gen_rev_aes_key(struct crypto_tfm *tfm) in gen_rev_aes_key() argument
785 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in gen_rev_aes_key()
794 crypt->data.tfm = tfm; in gen_rev_aes_key()
810 static int setup_cipher(struct crypto_tfm *tfm, int encrypt, const u8 *key, in setup_cipher() argument
817 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in setup_cipher()
824 cipher_cfg = cipher_cfg_enc(tfm); in setup_cipher()
827 cipher_cfg = cipher_cfg_dec(tfm); in setup_cipher()
845 err = crypto_des_verify_key(tfm, key); in setup_cipher()
863 return gen_rev_aes_key(tfm); in setup_cipher()
900 static int ablk_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_setkey() argument
903 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_setkey()
915 ret = setup_cipher(&tfm->base, 0, key, key_len); in ablk_setkey()
918 ret = setup_cipher(&tfm->base, 1, key, key_len); in ablk_setkey()
925 crypto_skcipher_set_flags(ctx->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); in ablk_setkey()
930 static int ablk_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_des3_setkey() argument
933 return verify_skcipher_des3_key(tfm, key) ?: in ablk_des3_setkey()
934 ablk_setkey(tfm, key, key_len); in ablk_des3_setkey()
937 static int ablk_rfc3686_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_rfc3686_setkey() argument
940 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_rfc3686_setkey()
950 return ablk_setkey(tfm, key, key_len); in ablk_rfc3686_setkey()
955 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in ixp4xx_cipher_fallback() local
956 struct ixp_ctx *op = crypto_skcipher_ctx(tfm); in ixp4xx_cipher_fallback()
974 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in ablk_perform() local
975 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_perform()
976 unsigned int ivsize = crypto_skcipher_ivsize(tfm); in ablk_perform()
1067 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in ablk_rfc3686_crypt() local
1068 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_rfc3686_crypt()
1090 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in aead_perform() local
1091 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_perform()
1092 unsigned int ivsize = crypto_aead_ivsize(tfm); in aead_perform()
1093 unsigned int authsize = crypto_aead_authsize(tfm); in aead_perform()
1201 static int aead_setup(struct crypto_aead *tfm, unsigned int authsize) in aead_setup() argument
1203 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_setup()
1204 unsigned int digest_len = crypto_aead_maxauthsize(tfm); in aead_setup()
1215 ret = setup_cipher(&tfm->base, 0, ctx->enckey, ctx->enckey_len); in aead_setup()
1218 ret = setup_cipher(&tfm->base, 1, ctx->enckey, ctx->enckey_len); in aead_setup()
1221 ret = setup_auth(&tfm->base, 0, authsize, ctx->authkey, in aead_setup()
1225 ret = setup_auth(&tfm->base, 1, authsize, ctx->authkey, in aead_setup()
1233 static int aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize) in aead_setauthsize() argument
1235 int max = crypto_aead_maxauthsize(tfm) >> 2; in aead_setauthsize()
1239 return aead_setup(tfm, authsize); in aead_setauthsize()
1242 static int aead_setkey(struct crypto_aead *tfm, const u8 *key, in aead_setkey() argument
1245 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_setkey()
1263 return aead_setup(tfm, crypto_aead_authsize(tfm)); in aead_setkey()
1269 static int des3_aead_setkey(struct crypto_aead *tfm, const u8 *key, in des3_aead_setkey() argument
1272 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in des3_aead_setkey()
1284 err = verify_aead_des3_key(tfm, keys.enckey, keys.enckeylen); in des3_aead_setkey()
1294 return aead_setup(tfm, crypto_aead_authsize(tfm)); in des3_aead_setkey()