Lines Matching refs:tfm_ctx
80 struct zynqmp_aead_tfm_ctx *tfm_ctx = crypto_aead_ctx(aead); in zynqmp_aes_aead_cipher() local
82 struct device *dev = tfm_ctx->dev; in zynqmp_aes_aead_cipher()
92 if (tfm_ctx->keysrc == ZYNQMP_AES_KUP_KEY) in zynqmp_aes_aead_cipher()
116 hwreq->keysrc = tfm_ctx->keysrc; in zynqmp_aes_aead_cipher()
126 tfm_ctx->key, ZYNQMP_AES_KEY_SIZE); in zynqmp_aes_aead_cipher()
177 static int zynqmp_fallback_check(struct zynqmp_aead_tfm_ctx *tfm_ctx, in zynqmp_fallback_check() argument
183 if (tfm_ctx->authsize != ZYNQMP_AES_AUTH_SIZE) in zynqmp_fallback_check()
186 if (tfm_ctx->keysrc == ZYNQMP_AES_KUP_KEY && in zynqmp_fallback_check()
187 tfm_ctx->keylen != ZYNQMP_AES_KEY_SIZE) { in zynqmp_fallback_check()
210 struct zynqmp_aead_tfm_ctx *tfm_ctx = crypto_aead_ctx(aead); in zynqmp_handle_aes_req() local
216 need_fallback = zynqmp_fallback_check(tfm_ctx, areq); in zynqmp_handle_aes_req()
219 aead_request_set_tfm(subreq, tfm_ctx->fbk_cipher); in zynqmp_handle_aes_req()
242 struct zynqmp_aead_tfm_ctx *tfm_ctx = in zynqmp_aes_aead_setkey() local
251 tfm_ctx->keysrc = (enum zynqmp_aead_keysrc)keysrc; in zynqmp_aes_aead_setkey()
253 tfm_ctx->keylen = keylen; in zynqmp_aes_aead_setkey()
256 tfm_ctx->keylen = keylen; in zynqmp_aes_aead_setkey()
258 tfm_ctx->keysrc = ZYNQMP_AES_KUP_KEY; in zynqmp_aes_aead_setkey()
259 memcpy(tfm_ctx->key, key, keylen); in zynqmp_aes_aead_setkey()
263 tfm_ctx->fbk_cipher->base.crt_flags &= ~CRYPTO_TFM_REQ_MASK; in zynqmp_aes_aead_setkey()
264 tfm_ctx->fbk_cipher->base.crt_flags |= (aead->base.crt_flags & in zynqmp_aes_aead_setkey()
267 return crypto_aead_setkey(tfm_ctx->fbk_cipher, key, keylen); in zynqmp_aes_aead_setkey()
274 struct zynqmp_aead_tfm_ctx *tfm_ctx = in zynqmp_aes_aead_setauthsize() local
277 tfm_ctx->authsize = authsize; in zynqmp_aes_aead_setauthsize()
278 return crypto_aead_setauthsize(tfm_ctx->fbk_cipher, authsize); in zynqmp_aes_aead_setauthsize()
310 struct zynqmp_aead_tfm_ctx *tfm_ctx = in zynqmp_aes_aead_init() local
316 tfm_ctx->dev = drv_ctx->dev; in zynqmp_aes_aead_init()
318 tfm_ctx->engine_ctx.op.do_one_request = zynqmp_handle_aes_req; in zynqmp_aes_aead_init()
319 tfm_ctx->engine_ctx.op.prepare_request = NULL; in zynqmp_aes_aead_init()
320 tfm_ctx->engine_ctx.op.unprepare_request = NULL; in zynqmp_aes_aead_init()
322 tfm_ctx->fbk_cipher = crypto_alloc_aead(drv_ctx->alg.aead.base.cra_name, in zynqmp_aes_aead_init()
326 if (IS_ERR(tfm_ctx->fbk_cipher)) { in zynqmp_aes_aead_init()
329 return PTR_ERR(tfm_ctx->fbk_cipher); in zynqmp_aes_aead_init()
335 crypto_aead_reqsize(tfm_ctx->fbk_cipher))); in zynqmp_aes_aead_init()
342 struct zynqmp_aead_tfm_ctx *tfm_ctx = in zynqmp_aes_aead_exit() local
345 if (tfm_ctx->fbk_cipher) { in zynqmp_aes_aead_exit()
346 crypto_free_aead(tfm_ctx->fbk_cipher); in zynqmp_aes_aead_exit()
347 tfm_ctx->fbk_cipher = NULL; in zynqmp_aes_aead_exit()
349 memzero_explicit(tfm_ctx, sizeof(struct zynqmp_aead_tfm_ctx)); in zynqmp_aes_aead_exit()