Lines Matching refs:tfmctx
29 static int sun8i_ss_hashkey(struct sun8i_ss_hash_tfm_ctx *tfmctx, const u8 *key, in sun8i_ss_hashkey() argument
51 dev_err(tfmctx->ss->dev, "shash init error ret=%d\n", ret); in sun8i_ss_hashkey()
54 ret = crypto_shash_finup(sdesc, key, keylen, tfmctx->key); in sun8i_ss_hashkey()
56 dev_err(tfmctx->ss->dev, "shash finup error\n"); in sun8i_ss_hashkey()
67 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(ahash); in sun8i_ss_hmac_setkey() local
75 ret = sun8i_ss_hashkey(tfmctx, key, keylen); in sun8i_ss_hmac_setkey()
78 tfmctx->keylen = digestsize; in sun8i_ss_hmac_setkey()
80 tfmctx->keylen = keylen; in sun8i_ss_hmac_setkey()
81 memcpy(tfmctx->key, key, keylen); in sun8i_ss_hmac_setkey()
84 tfmctx->ipad = kzalloc(bs, GFP_KERNEL); in sun8i_ss_hmac_setkey()
85 if (!tfmctx->ipad) in sun8i_ss_hmac_setkey()
87 tfmctx->opad = kzalloc(bs, GFP_KERNEL); in sun8i_ss_hmac_setkey()
88 if (!tfmctx->opad) { in sun8i_ss_hmac_setkey()
93 memset(tfmctx->key + tfmctx->keylen, 0, bs - tfmctx->keylen); in sun8i_ss_hmac_setkey()
94 memcpy(tfmctx->ipad, tfmctx->key, tfmctx->keylen); in sun8i_ss_hmac_setkey()
95 memcpy(tfmctx->opad, tfmctx->key, tfmctx->keylen); in sun8i_ss_hmac_setkey()
97 tfmctx->ipad[i] ^= HMAC_IPAD_VALUE; in sun8i_ss_hmac_setkey()
98 tfmctx->opad[i] ^= HMAC_OPAD_VALUE; in sun8i_ss_hmac_setkey()
101 ret = crypto_ahash_setkey(tfmctx->fallback_tfm, key, keylen); in sun8i_ss_hmac_setkey()
105 memzero_explicit(tfmctx->key, keylen); in sun8i_ss_hmac_setkey()
106 kfree_sensitive(tfmctx->opad); in sun8i_ss_hmac_setkey()
108 kfree_sensitive(tfmctx->ipad); in sun8i_ss_hmac_setkey()
152 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_exit_tfm() local
154 kfree_sensitive(tfmctx->ipad); in sun8i_ss_hash_exit_tfm()
155 kfree_sensitive(tfmctx->opad); in sun8i_ss_hash_exit_tfm()
157 crypto_free_ahash(tfmctx->fallback_tfm); in sun8i_ss_hash_exit_tfm()
158 pm_runtime_put_sync_suspend(tfmctx->ss->dev); in sun8i_ss_hash_exit_tfm()
165 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_init() local
169 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_init()
179 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_export() local
181 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_export()
191 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_import() local
193 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_import()
203 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_final() local
205 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_final()
229 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_update() local
231 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_update()
244 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_finup() local
246 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_finup()
273 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_digest_fb() local
275 ahash_request_set_tfm(&rctx->fallback_req, tfmctx->fallback_tfm); in sun8i_ss_hash_digest_fb()
494 struct sun8i_ss_hash_tfm_ctx *tfmctx = crypto_ahash_ctx(tfm); in sun8i_ss_hash_run() local
587 if (tfmctx->keylen && hmac == 0) { in sun8i_ss_hash_run()
596 addr_xpad = dma_map_single(ss->dev, tfmctx->ipad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()
609 if (tfmctx->keylen && hmac == 2) { in sun8i_ss_hash_run()
623 addr_xpad = dma_map_single(ss->dev, tfmctx->opad, bs, DMA_TO_DEVICE); in sun8i_ss_hash_run()