Lines Matching defs:tctx

119 static struct ocs_aes_dev *kmb_ocs_aes_find_dev(struct ocs_aes_tctx *tctx)
125 if (tctx->aes_dev) {
126 aes_dev = tctx->aes_dev;
132 tctx->aes_dev = aes_dev;
165 static int save_key(struct ocs_aes_tctx *tctx, const u8 *in_key, size_t key_len,
174 memcpy(tctx->key, in_key, key_len);
175 tctx->key_len = key_len;
176 tctx->cipher = cipher;
185 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
188 tctx->use_fallback = (cipher == OCS_AES &&
191 if (!tctx->use_fallback)
192 return save_key(tctx, in_key, key_len, cipher);
194 crypto_sync_skcipher_clear_flags(tctx->sw_cipher.sk,
196 crypto_sync_skcipher_set_flags(tctx->sw_cipher.sk,
200 return crypto_sync_skcipher_setkey(tctx->sw_cipher.sk, in_key, key_len);
207 struct ocs_aes_tctx *tctx = crypto_aead_ctx(tfm);
210 tctx->use_fallback = (cipher == OCS_AES &&
213 if (!tctx->use_fallback)
214 return save_key(tctx, in_key, key_len, cipher);
216 crypto_aead_clear_flags(tctx->sw_cipher.aead, CRYPTO_TFM_REQ_MASK);
217 crypto_aead_set_flags(tctx->sw_cipher.aead,
220 return crypto_aead_setkey(tctx->sw_cipher.aead, in_key, key_len);
315 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
319 if (tctx->use_fallback) {
320 SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, tctx->sw_cipher.sk);
322 skcipher_request_set_sync_tfm(subreq, tctx->sw_cipher.sk);
350 aes_dev = kmb_ocs_aes_find_dev(tctx);
354 if (cipher != tctx->cipher)
378 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
379 struct device *dev = tctx->aes_dev->dev;
402 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
424 rctx->dst_dma_count = dma_map_sg(tctx->aes_dev->dev, req->dst,
427 dev_err(tctx->aes_dev->dev, "Failed to map destination sg\n");
432 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
451 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
459 rctx->src_dma_count = dma_map_sg(tctx->aes_dev->dev, req->src,
462 dev_err(tctx->aes_dev->dev, "Failed to map source sg\n");
467 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->src,
474 rctx->dst_dma_count = dma_map_sg(tctx->aes_dev->dev, req->dst,
477 dev_err(tctx->aes_dev->dev, "Failed to map destination sg\n");
482 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
499 rc = ocs_aes_bypass_op(tctx->aes_dev, rctx->dst_dll.dma_addr,
518 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
519 struct ocs_aes_dev *aes_dev = tctx->aes_dev;
549 rc = ocs_aes_op(aes_dev, rctx->mode, tctx->cipher, rctx->instruction,
640 struct ocs_aes_tctx *tctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
645 if (tctx->use_fallback) {
648 aead_request_set_tfm(subreq, tctx->sw_cipher.aead);
654 rc = crypto_aead_setauthsize(tctx->sw_cipher.aead,
668 dd = kmb_ocs_aes_find_dev(tctx);
672 if (cipher != tctx->cipher)
684 struct ocs_aes_tctx *tctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
686 struct device *dev = tctx->aes_dev->dev;
721 struct ocs_aes_tctx *tctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
790 rctx->dst_dma_count = dma_map_sg(tctx->aes_dev->dev, req->dst,
795 dev_err(tctx->aes_dev->dev, "Failed to map destination sg\n");
800 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
808 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
833 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
839 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->dst,
851 rctx->src_dma_count = dma_map_sg(tctx->aes_dev->dev, req->src,
854 dev_err(tctx->aes_dev->dev, "Failed to map source sg\n");
859 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->src,
867 rc = ocs_create_linked_list_from_sg(tctx->aes_dev, req->src,
878 rc = ocs_aes_bypass_op(tctx->aes_dev, rctx->aad_dst_dll.dma_addr,
881 dev_err(tctx->aes_dev->dev,
889 struct ocs_aes_tctx *tctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
901 rc = ocs_aes_ccm_op(tctx->aes_dev, tctx->cipher,
910 rc = ocs_aes_gcm_op(tctx->aes_dev, tctx->cipher,
951 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
954 if (!tctx->aes_dev) {
959 err = ocs_aes_set_key(tctx->aes_dev, tctx->key_len, tctx->key,
960 tctx->cipher);
977 struct ocs_aes_tctx *tctx = crypto_aead_ctx(crypto_aead_reqtfm(req));
980 if (!tctx->aes_dev)
983 err = ocs_aes_set_key(tctx->aes_dev, tctx->key_len, tctx->key,
984 tctx->cipher);
991 crypto_finalize_aead_request(tctx->aes_dev->engine, req, err);
1151 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
1159 tctx->sw_cipher.sk = blk;
1173 static inline void clear_key(struct ocs_aes_tctx *tctx)
1175 memzero_explicit(tctx->key, OCS_AES_KEYSIZE_256);
1178 if (tctx->aes_dev)
1179 ocs_aes_set_key(tctx->aes_dev, OCS_AES_KEYSIZE_256,
1180 tctx->key, OCS_AES);
1185 struct ocs_aes_tctx *tctx = crypto_skcipher_ctx(tfm);
1187 clear_key(tctx);
1189 if (tctx->sw_cipher.sk) {
1190 crypto_free_sync_skcipher(tctx->sw_cipher.sk);
1191 tctx->sw_cipher.sk = NULL;
1198 struct ocs_aes_tctx *tctx = crypto_aead_ctx(tfm);
1206 tctx->sw_cipher.aead = blk;
1211 crypto_aead_reqsize(tctx->sw_cipher.aead))));
1248 struct ocs_aes_tctx *tctx = crypto_aead_ctx(tfm);
1250 clear_key(tctx);
1252 if (tctx->sw_cipher.aead) {
1253 crypto_free_aead(tctx->sw_cipher.aead);
1254 tctx->sw_cipher.aead = NULL;