Lines Matching refs:tfm
143 struct crypto_tfm *tfm; member
247 static inline u32 cipher_cfg_enc(struct crypto_tfm *tfm) in cipher_cfg_enc() argument
249 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_enc; in cipher_cfg_enc()
252 static inline u32 cipher_cfg_dec(struct crypto_tfm *tfm) in cipher_cfg_dec() argument
254 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->cfg_dec; in cipher_cfg_dec()
257 static inline const struct ix_hash_algo *ix_hash(struct crypto_tfm *tfm) in ix_hash() argument
259 return container_of(tfm->__crt_alg, struct ixp_alg, crypto.base)->hash; in ix_hash()
355 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in finish_scattered_hmac() local
356 int authsize = crypto_aead_authsize(tfm); in finish_scattered_hmac()
393 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in one_packet() local
394 unsigned int ivsize = crypto_skcipher_ivsize(tfm); in one_packet()
416 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
424 ctx = crypto_tfm_ctx(crypt->data.tfm); in one_packet()
614 static int init_tfm(struct crypto_tfm *tfm) in init_tfm() argument
616 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in init_tfm()
630 static int init_tfm_ablk(struct crypto_skcipher *tfm) in init_tfm_ablk() argument
632 struct crypto_tfm *ctfm = crypto_skcipher_tfm(tfm); in init_tfm_ablk()
644 crypto_tfm_alg_driver_name(&tfm->base), in init_tfm_ablk()
648 …crypto_skcipher_set_reqsize(tfm, sizeof(struct ablk_ctx) + crypto_skcipher_reqsize(ctx->fallback_t… in init_tfm_ablk()
649 return init_tfm(crypto_skcipher_tfm(tfm)); in init_tfm_ablk()
652 static int init_tfm_aead(struct crypto_aead *tfm) in init_tfm_aead() argument
654 crypto_aead_set_reqsize(tfm, sizeof(struct aead_ctx)); in init_tfm_aead()
655 return init_tfm(crypto_aead_tfm(tfm)); in init_tfm_aead()
658 static void exit_tfm(struct crypto_tfm *tfm) in exit_tfm() argument
660 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in exit_tfm()
666 static void exit_tfm_ablk(struct crypto_skcipher *tfm) in exit_tfm_ablk() argument
668 struct crypto_tfm *ctfm = crypto_skcipher_tfm(tfm); in exit_tfm_ablk()
672 exit_tfm(crypto_skcipher_tfm(tfm)); in exit_tfm_ablk()
675 static void exit_tfm_aead(struct crypto_aead *tfm) in exit_tfm_aead() argument
677 exit_tfm(crypto_aead_tfm(tfm)); in exit_tfm_aead()
680 static int register_chain_var(struct crypto_tfm *tfm, u8 xpad, u32 target, in register_chain_var() argument
684 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in register_chain_var()
712 crypt->data.tfm = tfm; in register_chain_var()
736 static int setup_auth(struct crypto_tfm *tfm, int encrypt, unsigned int authsize, in setup_auth() argument
744 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in setup_auth()
749 algo = ix_hash(tfm); in setup_auth()
775 ret = register_chain_var(tfm, HMAC_OPAD_VALUE, otarget, in setup_auth()
779 return register_chain_var(tfm, HMAC_IPAD_VALUE, itarget, in setup_auth()
783 static int gen_rev_aes_key(struct crypto_tfm *tfm) in gen_rev_aes_key() argument
786 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in gen_rev_aes_key()
795 crypt->data.tfm = tfm; in gen_rev_aes_key()
811 static int setup_cipher(struct crypto_tfm *tfm, int encrypt, const u8 *key, in setup_cipher() argument
818 struct ixp_ctx *ctx = crypto_tfm_ctx(tfm); in setup_cipher()
825 cipher_cfg = cipher_cfg_enc(tfm); in setup_cipher()
828 cipher_cfg = cipher_cfg_dec(tfm); in setup_cipher()
846 err = crypto_des_verify_key(tfm, key); in setup_cipher()
864 return gen_rev_aes_key(tfm); in setup_cipher()
901 static int ablk_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_setkey() argument
904 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_setkey()
916 ret = setup_cipher(&tfm->base, 0, key, key_len); in ablk_setkey()
919 ret = setup_cipher(&tfm->base, 1, key, key_len); in ablk_setkey()
926 crypto_skcipher_set_flags(ctx->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK); in ablk_setkey()
931 static int ablk_des3_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_des3_setkey() argument
934 return verify_skcipher_des3_key(tfm, key) ?: in ablk_des3_setkey()
935 ablk_setkey(tfm, key, key_len); in ablk_des3_setkey()
938 static int ablk_rfc3686_setkey(struct crypto_skcipher *tfm, const u8 *key, in ablk_rfc3686_setkey() argument
941 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_rfc3686_setkey()
951 return ablk_setkey(tfm, key, key_len); in ablk_rfc3686_setkey()
956 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq); in ixp4xx_cipher_fallback() local
957 struct ixp_ctx *op = crypto_skcipher_ctx(tfm); in ixp4xx_cipher_fallback()
975 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in ablk_perform() local
976 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_perform()
977 unsigned int ivsize = crypto_skcipher_ivsize(tfm); in ablk_perform()
1068 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in ablk_rfc3686_crypt() local
1069 struct ixp_ctx *ctx = crypto_skcipher_ctx(tfm); in ablk_rfc3686_crypt()
1091 struct crypto_aead *tfm = crypto_aead_reqtfm(req); in aead_perform() local
1092 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_perform()
1093 unsigned int ivsize = crypto_aead_ivsize(tfm); in aead_perform()
1094 unsigned int authsize = crypto_aead_authsize(tfm); in aead_perform()
1203 static int aead_setup(struct crypto_aead *tfm, unsigned int authsize) in aead_setup() argument
1205 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_setup()
1206 unsigned int digest_len = crypto_aead_maxauthsize(tfm); in aead_setup()
1217 ret = setup_cipher(&tfm->base, 0, ctx->enckey, ctx->enckey_len); in aead_setup()
1220 ret = setup_cipher(&tfm->base, 1, ctx->enckey, ctx->enckey_len); in aead_setup()
1223 ret = setup_auth(&tfm->base, 0, authsize, ctx->authkey, in aead_setup()
1227 ret = setup_auth(&tfm->base, 1, authsize, ctx->authkey, in aead_setup()
1235 static int aead_setauthsize(struct crypto_aead *tfm, unsigned int authsize) in aead_setauthsize() argument
1237 int max = crypto_aead_maxauthsize(tfm) >> 2; in aead_setauthsize()
1241 return aead_setup(tfm, authsize); in aead_setauthsize()
1244 static int aead_setkey(struct crypto_aead *tfm, const u8 *key, in aead_setkey() argument
1247 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in aead_setkey()
1265 return aead_setup(tfm, crypto_aead_authsize(tfm)); in aead_setkey()
1271 static int des3_aead_setkey(struct crypto_aead *tfm, const u8 *key, in des3_aead_setkey() argument
1274 struct ixp_ctx *ctx = crypto_aead_ctx(tfm); in des3_aead_setkey()
1286 err = verify_aead_des3_key(tfm, keys.enckey, keys.enckeylen); in des3_aead_setkey()
1296 return aead_setup(tfm, crypto_aead_authsize(tfm)); in des3_aead_setkey()