H A D | qat_asym_algs.c | 246 struct qat_rsa_request *qat_req = qat_rsa_enc() local 248 struct icp_qat_fw_pke_request *msg = &qat_req->req; qat_rsa_enc() 265 qat_req->ctx = ctx; qat_rsa_enc() 271 qat_req->in.enc.e = ctx->dma_e; qat_rsa_enc() 272 qat_req->in.enc.n = ctx->dma_n; qat_rsa_enc() 283 qat_req->src_align = NULL; qat_rsa_enc() 284 qat_req->in.enc.m = dma_map_single(dev, sg_virt(req->src), qat_rsa_enc() 286 if (unlikely(dma_mapping_error(dev, qat_req->in.enc.m))) qat_rsa_enc() 292 qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz, qat_rsa_enc() 293 &qat_req->in.enc.m, qat_rsa_enc() 295 if (unlikely(!qat_req->src_align)) qat_rsa_enc() 298 scatterwalk_map_and_copy(qat_req->src_align + shift, req->src, qat_rsa_enc() 302 qat_req->dst_align = NULL; qat_rsa_enc() 303 qat_req->out.enc.c = dma_map_single(dev, sg_virt(req->dst), qat_rsa_enc() 307 if (unlikely(dma_mapping_error(dev, qat_req->out.enc.c))) qat_rsa_enc() 311 qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz, qat_rsa_enc() 312 &qat_req->out.enc.c, qat_rsa_enc() 314 if (unlikely(!qat_req->dst_align)) qat_rsa_enc() 318 qat_req->in.in_tab[3] = 0; qat_rsa_enc() 319 qat_req->out.out_tab[1] = 0; qat_rsa_enc() 320 qat_req->phy_in = dma_map_single(dev, &qat_req->in.enc.m, qat_rsa_enc() 323 if (unlikely(dma_mapping_error(dev, qat_req->phy_in))) qat_rsa_enc() 326 qat_req->phy_out = dma_map_single(dev, &qat_req->out.enc.c, qat_rsa_enc() 329 if (unlikely(dma_mapping_error(dev, qat_req->phy_out))) qat_rsa_enc() 332 msg->pke_mid.src_data_addr = qat_req->phy_in; qat_rsa_enc() 333 msg->pke_mid.dest_data_addr = qat_req->phy_out; qat_rsa_enc() 344 if (qat_req->src_align) qat_rsa_enc() 345 dma_free_coherent(dev, ctx->key_sz, qat_req->src_align, qat_rsa_enc() 346 qat_req->in.enc.m); qat_rsa_enc() 348 if (!dma_mapping_error(dev, qat_req->in.enc.m)) qat_rsa_enc() 349 dma_unmap_single(dev, qat_req->in.enc.m, ctx->key_sz, qat_rsa_enc() 352 if (qat_req->dst_align) qat_rsa_enc() 353 dma_free_coherent(dev, ctx->key_sz, qat_req->dst_align, qat_rsa_enc() 354 qat_req->out.enc.c); qat_rsa_enc() 356 if (!dma_mapping_error(dev, qat_req->out.enc.c)) qat_rsa_enc() 357 dma_unmap_single(dev, qat_req->out.enc.c, ctx->key_sz, qat_rsa_enc() 360 if (!dma_mapping_error(dev, qat_req->phy_in)) qat_rsa_enc() 361 dma_unmap_single(dev, qat_req->phy_in, qat_rsa_enc() 364 if (!dma_mapping_error(dev, qat_req->phy_out)) qat_rsa_enc() 365 dma_unmap_single(dev, qat_req->phy_out, qat_rsa_enc() 377 struct qat_rsa_request *qat_req = qat_rsa_dec() local 379 struct icp_qat_fw_pke_request *msg = &qat_req->req; qat_rsa_dec() 396 qat_req->ctx = ctx; qat_rsa_dec() 402 qat_req->in.dec.d = ctx->dma_d; qat_rsa_dec() 403 qat_req->in.dec.n = ctx->dma_n; qat_rsa_dec() 414 qat_req->src_align = NULL; qat_rsa_dec() 415 qat_req->in.dec.c = dma_map_single(dev, sg_virt(req->src), qat_rsa_dec() 417 if (unlikely(dma_mapping_error(dev, qat_req->in.dec.c))) qat_rsa_dec() 423 qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz, qat_rsa_dec() 424 &qat_req->in.dec.c, qat_rsa_dec() 426 if (unlikely(!qat_req->src_align)) qat_rsa_dec() 429 scatterwalk_map_and_copy(qat_req->src_align + shift, req->src, qat_rsa_dec() 433 qat_req->dst_align = NULL; qat_rsa_dec() 434 qat_req->out.dec.m = dma_map_single(dev, sg_virt(req->dst), qat_rsa_dec() 438 if (unlikely(dma_mapping_error(dev, qat_req->out.dec.m))) qat_rsa_dec() 442 qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz, qat_rsa_dec() 443 &qat_req->out.dec.m, qat_rsa_dec() 445 if (unlikely(!qat_req->dst_align)) qat_rsa_dec() 450 qat_req->in.in_tab[3] = 0; qat_rsa_dec() 451 qat_req->out.out_tab[1] = 0; qat_rsa_dec() 452 qat_req->phy_in = dma_map_single(dev, &qat_req->in.dec.c, qat_rsa_dec() 455 if (unlikely(dma_mapping_error(dev, qat_req->phy_in))) qat_rsa_dec() 458 qat_req->phy_out = dma_map_single(dev, &qat_req->out.dec.m, qat_rsa_dec() 461 if (unlikely(dma_mapping_error(dev, qat_req->phy_out))) qat_rsa_dec() 464 msg->pke_mid.src_data_addr = qat_req->phy_in; qat_rsa_dec() 465 msg->pke_mid.dest_data_addr = qat_req->phy_out; qat_rsa_dec() 476 if (qat_req->src_align) qat_rsa_dec() 477 dma_free_coherent(dev, ctx->key_sz, qat_req->src_align, qat_rsa_dec() 478 qat_req->in.dec.c); qat_rsa_dec() 480 if (!dma_mapping_error(dev, qat_req->in.dec.c)) qat_rsa_dec() 481 dma_unmap_single(dev, qat_req->in.dec.c, ctx->key_sz, qat_rsa_dec() 484 if (qat_req->dst_align) qat_rsa_dec() 485 dma_free_coherent(dev, ctx->key_sz, qat_req->dst_align, qat_rsa_dec() 486 qat_req->out.dec.m); qat_rsa_dec() 488 if (!dma_mapping_error(dev, qat_req->out.dec.m)) qat_rsa_dec() 489 dma_unmap_single(dev, qat_req->out.dec.m, ctx->key_sz, qat_rsa_dec() 492 if (!dma_mapping_error(dev, qat_req->phy_in)) qat_rsa_dec() 493 dma_unmap_single(dev, qat_req->phy_in, qat_rsa_dec() 496 if (!dma_mapping_error(dev, qat_req->phy_out)) qat_rsa_dec() 497 dma_unmap_single(dev, qat_req->phy_out, qat_rsa_dec()
|