Lines Matching defs:tfm

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