get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/51786/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 51786,
    "url": "http://patches.dpdk.org/api/patches/51786/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190327111720.13732-5-arkadiuszx.kusztal@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20190327111720.13732-5-arkadiuszx.kusztal@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190327111720.13732-5-arkadiuszx.kusztal@intel.com",
    "date": "2019-03-27T11:17:20",
    "name": "[v4,4/4] crypto/qat: add modular inverse to qat asym pmd",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "e884de712d6bed415cca162d9f089e4622baef2f",
    "submitter": {
        "id": 452,
        "url": "http://patches.dpdk.org/api/people/452/?format=api",
        "name": "Arkadiusz Kusztal",
        "email": "arkadiuszx.kusztal@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190327111720.13732-5-arkadiuszx.kusztal@intel.com/mbox/",
    "series": [
        {
            "id": 3944,
            "url": "http://patches.dpdk.org/api/series/3944/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=3944",
            "date": "2019-03-27T11:17:16",
            "name": "Add PMD for asymmetric cryptography operations using Intel QuickAssist Technology devices",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/3944/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/51786/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/51786/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 58B921B13F;\n\tWed, 27 Mar 2019 12:21:19 +0100 (CET)",
            "from mga02.intel.com (mga02.intel.com [134.134.136.20])\n\tby dpdk.org (Postfix) with ESMTP id 993111B119\n\tfor <dev@dpdk.org>; Wed, 27 Mar 2019 12:21:10 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n\tby orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t27 Mar 2019 04:21:10 -0700",
            "from akusztax-mobl.ger.corp.intel.com ([10.104.116.172])\n\tby fmsmga002.fm.intel.com with ESMTP; 27 Mar 2019 04:21:08 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.60,276,1549958400\"; d=\"scan'208\";a=\"155639851\"",
        "From": "Arek Kusztal <arkadiuszx.kusztal@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "akhil.goyal@nxp.com, fiona.trahe@intel.com,\n\tArek Kusztal <arkadiuszx.kusztal@intel.com>",
        "Date": "Wed, 27 Mar 2019 12:17:20 +0100",
        "Message-Id": "<20190327111720.13732-5-arkadiuszx.kusztal@intel.com>",
        "X-Mailer": "git-send-email 2.19.1.windows.1",
        "In-Reply-To": "<20190327111720.13732-1-arkadiuszx.kusztal@intel.com>",
        "References": "<20190327111720.13732-1-arkadiuszx.kusztal@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v4 4/4] crypto/qat: add modular inverse to qat\n\tasym pmd",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This commit adds modular multiplicative inverse to Intel\nQuickAssist Technology driver. For capabilities or limitations\nplease refer to qat.rst or qat_asym_capabilities.h.\n\nSigned-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>\n---\n doc/guides/cryptodevs/qat.rst                      |  1 +\n .../qat/qat_adf/qat_pke_functionality_arrays.h     |  4 +-\n drivers/crypto/qat/qat_asym.c                      | 85 +++++++++++++++++++++-\n drivers/crypto/qat/qat_asym.h                      |  3 +\n drivers/crypto/qat/qat_asym_capabilities.h         | 16 ++++\n 5 files changed, 106 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst\nindex e09ae8b..3c2467d 100644\n--- a/doc/guides/cryptodevs/qat.rst\n+++ b/doc/guides/cryptodevs/qat.rst\n@@ -107,6 +107,7 @@ Asymmetric Crypto Service on QAT\n The QAT Asym PMD has support for:\n \n * ``Modular exponentiation``\n+* ``Modular multiplicative inverse``\n \n Limitations\n ~~~~~~~~~~~\ndiff --git a/drivers/common/qat/qat_adf/qat_pke_functionality_arrays.h b/drivers/common/qat/qat_adf/qat_pke_functionality_arrays.h\nindex ffea27e..8adf209 100644\n--- a/drivers/common/qat/qat_adf/qat_pke_functionality_arrays.h\n+++ b/drivers/common/qat/qat_adf/qat_pke_functionality_arrays.h\n@@ -21,7 +21,7 @@ static const uint32_t MOD_EXP_SIZE[][2] = {\n \t\t{ 4096, MATHS_MODEXP_L4096 }\n };\n \n-static const uint32_t __rte_unused MOD_INV_IDS_ODD[][2] = {\n+static const uint32_t MOD_INV_IDS_ODD[][2] = {\n \t\t{ 128,\tMATHS_MODINV_ODD_L128 },\n \t\t{ 192,\tMATHS_MODINV_ODD_L192 },\n \t\t{ 256,  MATHS_MODINV_ODD_L256 },\n@@ -35,7 +35,7 @@ static const uint32_t __rte_unused MOD_INV_IDS_ODD[][2] = {\n \t\t{ 4096, MATHS_MODINV_ODD_L4096 },\n };\n \n-static const uint32_t __rte_unused MOD_INV_IDS_EVEN[][2] = {\n+static const uint32_t MOD_INV_IDS_EVEN[][2] = {\n \t\t{ 128,\tMATHS_MODINV_EVEN_L128 },\n \t\t{ 192,\tMATHS_MODINV_EVEN_L192 },\n \t\t{ 256,\tMATHS_MODINV_EVEN_L256 },\ndiff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c\nindex 733aab4..dc4c959 100644\n--- a/drivers/crypto/qat/qat_asym.c\n+++ b/drivers/crypto/qat/qat_asym.c\n@@ -54,6 +54,9 @@ static void qat_asym_build_req_tmpl(void *sess_private_data,\n \tif (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODEX) {\n \t\tqat_req->output_param_count = 1;\n \t\tqat_req->input_param_count = 3;\n+\t} else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {\n+\t\tqat_req->output_param_count = 1;\n+\t\tqat_req->input_param_count = 2;\n \t}\n }\n \n@@ -147,7 +150,8 @@ qat_asym_build_request(void *in_op,\n \tif (ctx->alg == QAT_PKE_MODEXP) {\n \t\terr = qat_asym_check_nonzero(ctx->sess_alg_params.mod_exp.n);\n \t\tif (err) {\n-\t\t\tQAT_LOG(ERR, \"Empty modulus, aborting this operation\");\n+\t\t\tQAT_LOG(ERR, \"Empty modulus in modular exponentiation,\"\n+\t\t\t\t\t\" aborting this operation\");\n \t\t\tgoto error;\n \t\t}\n \n@@ -189,6 +193,56 @@ qat_asym_build_request(void *in_op,\n \t\t\t\tcookie->input_array[2],\n \t\t\t\talg_size_in_bytes);\n #endif\n+\t} else if (ctx->alg == QAT_PKE_MODINV) {\n+\t\terr = qat_asym_check_nonzero(ctx->sess_alg_params.mod_inv.n);\n+\t\tif (err) {\n+\t\t\tQAT_LOG(ERR, \"Empty modulus in modular multiplicative\"\n+\t\t\t\t\t\" inverse, aborting this operation\");\n+\t\t\tgoto error;\n+\t\t}\n+\n+\t\talg_size_in_bytes = max_of(2, asym_op->modinv.base.length,\n+\t\t\t\tctx->sess_alg_params.mod_inv.n.length);\n+\t\talg_size = alg_size_in_bytes << 3;\n+\n+\t\tif (ctx->sess_alg_params.mod_inv.n.data[\n+\t\t\t\tctx->sess_alg_params.mod_inv.n.length - 1] & 0x01) {\n+\t\t\tif (qat_asym_get_sz_and_func_id(MOD_INV_IDS_ODD,\n+\t\t\t\t\tsizeof(MOD_INV_IDS_ODD)/\n+\t\t\t\t\tsizeof(*MOD_INV_IDS_ODD),\n+\t\t\t\t\t&alg_size, &func_id)) {\n+\t\t\t\terr = QAT_ASYM_ERROR_INVALID_PARAM;\n+\t\t\t\tgoto error;\n+\t\t\t}\n+\t\t} else {\n+\t\t\tif (qat_asym_get_sz_and_func_id(MOD_INV_IDS_EVEN,\n+\t\t\t\t\tsizeof(MOD_INV_IDS_EVEN)/\n+\t\t\t\t\tsizeof(*MOD_INV_IDS_EVEN),\n+\t\t\t\t\t&alg_size, &func_id)) {\n+\t\t\t\terr = QAT_ASYM_ERROR_INVALID_PARAM;\n+\t\t\t\tgoto error;\n+\t\t\t}\n+\t\t}\n+\n+\t\talg_size_in_bytes = alg_size >> 3;\n+\t\trte_memcpy(cookie->input_array[0] + alg_size_in_bytes -\n+\t\t\tasym_op->modinv.base.length\n+\t\t\t\t, asym_op->modinv.base.data,\n+\t\t\t\tasym_op->modinv.base.length);\n+\t\trte_memcpy(cookie->input_array[1] + alg_size_in_bytes -\n+\t\t\t\tctx->sess_alg_params.mod_inv.n.length\n+\t\t\t\t, ctx->sess_alg_params.mod_inv.n.data,\n+\t\t\t\tctx->sess_alg_params.mod_inv.n.length);\n+\t\tcookie->alg_size = alg_size;\n+\t\tqat_req->pke_hdr.cd_pars.func_id = func_id;\n+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n+\t\tQAT_DP_HEXDUMP_LOG(DEBUG, \"base\",\n+\t\t\t\tcookie->input_array[0],\n+\t\t\t\talg_size_in_bytes);\n+\t\tQAT_DP_HEXDUMP_LOG(DEBUG, \"modulus\",\n+\t\t\t\tcookie->input_array[1],\n+\t\t\t\talg_size_in_bytes);\n+#endif\n \t}\n \n #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n@@ -261,6 +315,26 @@ qat_asym_process_response(void **op, uint8_t *resp,\n \t\t}\n \t\tqat_clear_arrays(cookie, 3, 1, alg_size_in_bytes,\n \t\t\t\talg_size_in_bytes);\n+\t} else if (ctx->alg == QAT_PKE_MODINV) {\n+\t\talg_size = cookie->alg_size;\n+\t\talg_size_in_bytes = alg_size >> 3;\n+\t\tuint8_t *modinv_result = asym_op->modinv.result.data;\n+\n+\t\tif (rx_op->status == RTE_CRYPTO_OP_STATUS_NOT_PROCESSED) {\n+\t\t\trte_memcpy(modinv_result + (asym_op->modinv.result.length\n+\t\t\t\t- ctx->sess_alg_params.mod_inv.n.length),\n+\t\t\t\tcookie->output_array[0] + alg_size_in_bytes\n+\t\t\t\t- ctx->sess_alg_params.mod_inv.n.length,\n+\t\t\t\tctx->sess_alg_params.mod_inv.n.length);\n+\t\t\trx_op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;\n+#if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n+\t\t\tQAT_DP_HEXDUMP_LOG(DEBUG, \"modinv_result\",\n+\t\t\t\t\tcookie->output_array[0],\n+\t\t\t\t\talg_size_in_bytes);\n+#endif\n+\t\t}\n+\t\tqat_clear_arrays(cookie, 2, 1, alg_size_in_bytes,\n+\t\t\talg_size_in_bytes);\n \t}\n \n #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG\n@@ -297,6 +371,15 @@ qat_asym_session_configure(struct rte_cryptodev *dev,\n \t\t\terr = -EINVAL;\n \t\t\tgoto error;\n \t\t}\n+\t} else if (xform->xform_type == RTE_CRYPTO_ASYM_XFORM_MODINV) {\n+\t\tsession->sess_alg_params.mod_inv.n = xform->modinv.modulus;\n+\t\tsession->alg = QAT_PKE_MODINV;\n+\n+\t\tif (xform->modinv.modulus.length == 0) {\n+\t\t\tQAT_LOG(ERR, \"Invalid mod inv input parameter\");\n+\t\t\terr = -EINVAL;\n+\t\t\tgoto error;\n+\t\t}\n \t} else {\n \t\tQAT_LOG(ERR, \"Invalid asymmetric crypto xform\");\n \t\terr = -EINVAL;\ndiff --git a/drivers/crypto/qat/qat_asym.h b/drivers/crypto/qat/qat_asym.h\nindex 228d2f7..ce4839b 100644\n--- a/drivers/crypto/qat/qat_asym.h\n+++ b/drivers/crypto/qat/qat_asym.h\n@@ -50,6 +50,9 @@ struct qat_asym_session {\n \t\t\trte_crypto_param n;\n \t\t\trte_crypto_param e;\n \t\t} mod_exp;\n+\t\tstruct {\n+\t\t\trte_crypto_param n;\n+\t\t} mod_inv;\n \t} sess_alg_params;\n };\n \ndiff --git a/drivers/crypto/qat/qat_asym_capabilities.h b/drivers/crypto/qat/qat_asym_capabilities.h\nindex 1d6323f..f43c025 100644\n--- a/drivers/crypto/qat/qat_asym_capabilities.h\n+++ b/drivers/crypto/qat/qat_asym_capabilities.h\n@@ -21,6 +21,22 @@\n \t\t\t}\t\t\t\t\t\t\t\\\n \t\t},\t\t\t\t\t\t\t\t\\\n \t\t}\t\t\t\t\t\t\t\t\\\n+\t},\t\t\t\t\t\t\t\t\t\\\n+\t{\t/* modinv */\t\t\t\t\t\t\t\\\n+\t\t.op = RTE_CRYPTO_OP_TYPE_ASYMMETRIC,\t\t\t\t\\\n+\t\t{.asym = {\t\t\t\t\t\t\t\\\n+\t\t\t.xform_capa = {\t\t\t\t\t\t\\\n+\t\t\t\t.xform_type = RTE_CRYPTO_ASYM_XFORM_MODINV,\t\\\n+\t\t\t\t.op_types = 0,\t\t\t\t\t\\\n+\t\t\t\t{\t\t\t\t\t\t\\\n+\t\t\t\t.modlen = {\t\t\t\t\t\\\n+\t\t\t\t.min = 1,\t\t\t\t\t\\\n+\t\t\t\t.max = 512,\t\t\t\t\t\\\n+\t\t\t\t.increment = 1\t\t\t\t\t\\\n+\t\t\t\t}, }\t\t\t\t\t\t\\\n+\t\t\t}\t\t\t\t\t\t\t\\\n+\t\t},\t\t\t\t\t\t\t\t\\\n+\t\t}\t\t\t\t\t\t\t\t\\\n \t}\t\t\t\t\t\t\t\t\t\\\n \n #endif /* _QAT_ASYM_CAPABILITIES_H_ */\n",
    "prefixes": [
        "v4",
        "4/4"
    ]
}