get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 136203,
    "url": "http://patches.dpdk.org/api/patches/136203/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20240129185950.14346-3-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": "<20240129185950.14346-3-arkadiuszx.kusztal@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20240129185950.14346-3-arkadiuszx.kusztal@intel.com",
    "date": "2024-01-29T18:59:50",
    "name": "[3/3] app/test: add test sm2 C1/Kp test cases",
    "commit_ref": null,
    "pull_url": null,
    "state": "deferred",
    "archived": false,
    "hash": "c7a46c225a69904a1edff6c296e5052202a15776",
    "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/20240129185950.14346-3-arkadiuszx.kusztal@intel.com/mbox/",
    "series": [
        {
            "id": 30930,
            "url": "http://patches.dpdk.org/api/series/30930/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30930",
            "date": "2024-01-29T18:59:48",
            "name": "[1/3] cryptodev: add ec points to sm2 op",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/30930/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/136203/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/136203/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id C468343A00;\n\tMon, 29 Jan 2024 20:00:12 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 29A5841101;\n\tMon, 29 Jan 2024 20:00:05 +0100 (CET)",
            "from mgamail.intel.com (mgamail.intel.com [198.175.65.11])\n by mails.dpdk.org (Postfix) with ESMTP id 96386410FD\n for <dev@dpdk.org>; Mon, 29 Jan 2024 20:00:02 +0100 (CET)",
            "from orviesa002.jf.intel.com ([10.64.159.142])\n by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 29 Jan 2024 11:00:02 -0800",
            "from silpixa00400308.ir.intel.com ([10.237.214.154])\n by orviesa002.jf.intel.com with ESMTP; 29 Jan 2024 11:00:00 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1706554803; x=1738090803;\n h=from:to:cc:subject:date:message-id:in-reply-to: references;\n bh=2gmMC2wH5617lnrVt7DJyM3Ap6825ERHpmBKwH4/ciI=;\n b=Yysn7MigIx+sXrK2yDp4XFsXTk53hbFdT4CzkQsPHMLpOaVT0v9DWgMx\n POz4/eBAvxhG6+7UM2Mndq/iJ1eLtiIPJtZcx3GepfsoXQBx7r185kKFk\n wI8QzlvM6ySbWBa5kZqTx/O/0Bawh3FE/iJJ7lwYH9nbwaJG6Bn6aebq0\n wtn7JTE6ipaZi85qnot3r0fx9O2MLS2BSK2uidEAFU1GRHRLbJbcB1DqQ\n L3XqMfFBLezRGRFmdHQZZid41HQmIJkHPMltL+DWgdH9OI9Yb4JXqZG6b\n qP+tOiy5rXfKVldX9uG2k58VcRYazpJgYQf9vfsEvLKDxjsOADcGUDm7B g==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6600,9927,10968\"; a=\"9696148\"",
            "E=Sophos;i=\"6.05,227,1701158400\";\n   d=\"scan'208\";a=\"9696148\"",
            "E=Sophos;i=\"6.05,227,1701158400\"; d=\"scan'208\";a=\"29632964\""
        ],
        "X-ExtLoop1": "1",
        "From": "Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "gakhil@marvell.com, ciara.power@intel.com,\n Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>",
        "Subject": "[PATCH 3/3] app/test: add test sm2 C1/Kp test cases",
        "Date": "Mon, 29 Jan 2024 18:59:50 +0000",
        "Message-Id": "<20240129185950.14346-3-arkadiuszx.kusztal@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20240129185950.14346-1-arkadiuszx.kusztal@intel.com>",
        "References": "<20240129185950.14346-1-arkadiuszx.kusztal@intel.com>",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "This commit adds tests cases to be used when C1 or kP elliptic\ncurve points need to be computed.\n\nSigned-off-by: Arkadiusz Kusztal <arkadiuszx.kusztal@intel.com>\n---\n app/test/test_cryptodev_asym.c             | 116 ++++++++++++++++++++-\n app/test/test_cryptodev_sm2_test_vectors.h | 112 +++++++++++++++++++-\n 2 files changed, 224 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/app/test/test_cryptodev_asym.c b/app/test/test_cryptodev_asym.c\nindex 17daf734e8..20da0fd815 100644\n--- a/app/test/test_cryptodev_asym.c\n+++ b/app/test/test_cryptodev_asym.c\n@@ -2639,6 +2639,8 @@ test_sm2_sign(void)\n \t\tasym_op->sm2.k.data = input_params.k.data;\n \t\tasym_op->sm2.k.length = input_params.k.length;\n \t}\n+\tasym_op->sm2.k.data = input_params.k.data;\n+\tasym_op->sm2.k.length = input_params.k.length;\n \n \t/* Init out buf */\n \tasym_op->sm2.r.data = output_buf_r;\n@@ -3188,7 +3190,7 @@ static int send_one(void)\n \t\tticks++;\n \t\tif (ticks >= DEQ_TIMEOUT) {\n \t\t\tRTE_LOG(ERR, USER1,\n-\t\t\t\t\"line %u FAILED: Cannot dequeue the crypto op on device %d\",\n+\t\t\t\t\"line %u FAILED: Cannot dequeue the crypto op on device, timeout %d\",\n \t\t\t\t__LINE__, params->valid_devs[0]);\n \t\t\treturn TEST_FAILED;\n \t\t}\n@@ -3467,6 +3469,110 @@ KAT_RSA_Decrypt_CRT(const void *data)\n \treturn 0;\n }\n \n+static int\n+test_sm2_encryption(const void *data)\n+{\n+\tstruct rte_crypto_asym_xform xform = { 0 };\n+\tconst uint8_t dev_id = params->valid_devs[0];\n+\tconst struct crypto_testsuite_sm2_params *test_vector = data;\n+\tuint8_t result_C1_x1[TEST_DATA_SIZE] = { 0 };\n+\tuint8_t result_C1_y1[TEST_DATA_SIZE] = { 0 };\n+\tuint8_t result_kP_x1[TEST_DATA_SIZE] = { 0 };\n+\tuint8_t result_kP_y1[TEST_DATA_SIZE] = { 0 };\n+\n+\txform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2;\n+\txform.ec.curve_id = RTE_CRYPTO_EC_GROUP_SM2;\n+\txform.ec.q = test_vector->pubkey;\n+\tself->op->asym->sm2.op_type = RTE_CRYPTO_ASYM_OP_ENCRYPT;\n+\tself->op->asym->sm2.k = test_vector->k;\n+\tif (rte_cryptodev_asym_session_create(dev_id, &xform,\n+\t\t\tparams->session_mpool, &self->sess) < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"line %u FAILED: Session creation failed\",\n+\t\t\t__LINE__);\n+\t\treturn TEST_FAILED;\n+\t}\n+\trte_crypto_op_attach_asym_session(self->op, self->sess);\n+\n+\tself->op->asym->sm2.C1.x.data = result_C1_x1;\n+\tself->op->asym->sm2.C1.y.data = result_C1_y1;\n+\tself->op->asym->sm2.kP.x.data = result_kP_x1;\n+\tself->op->asym->sm2.kP.y.data = result_kP_y1;\n+\tTEST_ASSERT_SUCCESS(send_one(),\n+\t\t\"Failed to process crypto op\");\n+\n+\tdebug_hexdump(stdout, \"C1[x]\", self->op->asym->sm2.C1.x.data,\n+\t\tself->op->asym->sm2.C1.x.length);\n+\tdebug_hexdump(stdout, \"C1[y]\", self->op->asym->sm2.C1.y.data,\n+\t\tself->op->asym->sm2.C1.y.length);\n+\tdebug_hexdump(stdout, \"kP[x]\", self->op->asym->sm2.kP.x.data,\n+\t\tself->op->asym->sm2.kP.x.length);\n+\tdebug_hexdump(stdout, \"kP[y]\", self->op->asym->sm2.kP.y.data,\n+\t\tself->op->asym->sm2.kP.y.length);\n+\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->C1.x.data,\n+\t\tself->op->asym->sm2.C1.x.data,\n+\t\ttest_vector->C1.x.length,\n+\t\t\"Incorrect value of C1[x]\\n\");\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->C1.y.data,\n+\t\tself->op->asym->sm2.C1.y.data,\n+\t\ttest_vector->C1.y.length,\n+\t\t\"Incorrect value of C1[y]\\n\");\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.x.data,\n+\t\tself->op->asym->sm2.kP.x.data,\n+\t\ttest_vector->kP.x.length,\n+\t\t\"Incorrect value of kP[x]\\n\");\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.y.data,\n+\t\tself->op->asym->sm2.kP.y.data,\n+\t\ttest_vector->kP.y.length,\n+\t\t\"Incorrect value of kP[y]\\n\");\n+\n+\treturn TEST_SUCCESS;\n+}\n+\n+static int\n+test_sm2_decryption(const void *data)\n+{\n+\tstruct rte_crypto_asym_xform xform = {};\n+\tconst uint8_t dev_id = params->valid_devs[0];\n+\tconst struct crypto_testsuite_sm2_params *test_vector = data;\n+\tuint8_t result_kP_x1[TEST_DATA_SIZE] = { 0 };\n+\tuint8_t result_kP_y1[TEST_DATA_SIZE] = { 0 };\n+\n+\txform.xform_type = RTE_CRYPTO_ASYM_XFORM_SM2;\n+\txform.ec.pkey = test_vector->pkey;\n+\tself->op->asym->sm2.op_type = RTE_CRYPTO_ASYM_OP_DECRYPT;\n+\tself->op->asym->sm2.C1 = test_vector->C1;\n+\n+\tif (rte_cryptodev_asym_session_create(dev_id, &xform,\n+\t\t\tparams->session_mpool, &self->sess) < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"line %u FAILED: Session creation failed\",\n+\t\t\t__LINE__);\n+\t\treturn TEST_FAILED;\n+\t}\n+\trte_crypto_op_attach_asym_session(self->op, self->sess);\n+\n+\tself->op->asym->sm2.kP.x.data = result_kP_x1;\n+\tself->op->asym->sm2.kP.y.data = result_kP_y1;\n+\tTEST_ASSERT_SUCCESS(send_one(),\n+\t\t\"Failed to process crypto op\");\n+\n+\tdebug_hexdump(stdout, \"kP[x]\", self->op->asym->sm2.kP.x.data,\n+\t\tself->op->asym->sm2.C1.x.length);\n+\tdebug_hexdump(stdout, \"kP[y]\", self->op->asym->sm2.kP.y.data,\n+\t\tself->op->asym->sm2.C1.y.length);\n+\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.x.data,\n+\t\tself->op->asym->sm2.kP.x.data,\n+\t\ttest_vector->kP.x.length,\n+\t\t\"Incorrect value of kP[x]\\n\");\n+\tTEST_ASSERT_BUFFERS_ARE_EQUAL(test_vector->kP.y.data,\n+\t\tself->op->asym->sm2.kP.y.data,\n+\t\ttest_vector->kP.y.length,\n+\t\t\"Incorrect value of kP[y]\\n\");\n+\n+\treturn 0;\n+}\n+\n static struct unit_test_suite cryptodev_openssl_asym_testsuite  = {\n \t.suite_name = \"Crypto Device OPENSSL ASYM Unit Test Suite\",\n \t.setup = testsuite_setup,\n@@ -3522,6 +3628,14 @@ static struct unit_test_suite cryptodev_qat_asym_testsuite  = {\n \t.setup = testsuite_setup,\n \t.teardown = testsuite_teardown,\n \t.unit_test_cases = {\n+\t\tTEST_CASE_NAMED_WITH_DATA(\n+\t\t\t\"SM2 encryption - test case 1\",\n+\t\t\tut_setup_asym, ut_teardown_asym,\n+\t\t\ttest_sm2_encryption, &sm2_enc_hw_t1),\n+\t\tTEST_CASE_NAMED_WITH_DATA(\n+\t\t\t\"SM2 decryption - test case 1\",\n+\t\t\tut_setup_asym, ut_teardown_asym,\n+\t\t\ttest_sm2_decryption, &sm2_enc_hw_t1),\n \t\tTEST_CASE_NAMED_WITH_DATA(\n \t\t\t\"Modular Exponentiation (mod=128, base=20, exp=3, res=128)\",\n \t\t\tut_setup_asym, ut_teardown_asym,\ndiff --git a/app/test/test_cryptodev_sm2_test_vectors.h b/app/test/test_cryptodev_sm2_test_vectors.h\nindex 41f5f7074a..92f7e77671 100644\n--- a/app/test/test_cryptodev_sm2_test_vectors.h\n+++ b/app/test/test_cryptodev_sm2_test_vectors.h\n@@ -8,19 +8,125 @@\n #include \"rte_crypto_asym.h\"\n \n struct crypto_testsuite_sm2_params {\n-\trte_crypto_param pubkey_qx;\n-\trte_crypto_param pubkey_qy;\n+\tunion {\n+\t\tstruct {\n+\t\t\trte_crypto_param pubkey_qx;\n+\t\t\trte_crypto_param pubkey_qy;\n+\t\t};\n+\t\tstruct rte_crypto_ec_point pubkey;\n+\t};\n \trte_crypto_param pkey;\n \trte_crypto_param k;\n \trte_crypto_param sign_r;\n \trte_crypto_param sign_s;\n \trte_crypto_param id;\n-\trte_crypto_param cipher;\n+\tunion {\n+\t\trte_crypto_param cipher;\n+\t\tstruct {\n+\t\t\tstruct rte_crypto_ec_point C1;\n+\t\t\tstruct rte_crypto_ec_point kP;\n+\t\t};\n+\t};\n \trte_crypto_param message;\n \trte_crypto_param digest;\n \tint curve;\n };\n \n+uint8_t sm2_enc_pub_x_t1[] = {\n+\t0x26, 0xf1, 0xf3, 0xef, 0x12, 0x27, 0x85, 0xd1,\n+\t0x7d, 0x38, 0x70, 0xc2, 0x43, 0x46, 0x50, 0x36,\n+\t0x3f, 0xdf, 0x4b, 0x2f, 0x45, 0x0e, 0x8e, 0xd1,\n+\t0xb6, 0x0f, 0xdc, 0x1f, 0xc6, 0xf0, 0x19, 0xab\n+};\n+uint8_t sm2_enc_pub_y_t1[] = {\n+\t0xd9, 0x19, 0x8b, 0xdb, 0xef, 0xa5, 0x84, 0x76,\n+\t0xec, 0x82, 0x25, 0x12, 0x5b, 0x8c, 0xe3, 0xe1,\n+\t0x0a, 0x10, 0x0d, 0xc6, 0x97, 0x6c, 0xc1, 0x89,\n+\t0xd9, 0x6d, 0xa6, 0x88, 0x9e, 0xbc, 0xd3, 0x7a\n+};\n+uint8_t sm2_k_t1[] = {\n+\t0x12, 0x34, 0x56, 0x78, 0xB9, 0x6E, 0x5A, 0xF7,\n+\t0x0B, 0xD4, 0x80, 0xB4, 0x72, 0x40, 0x9A, 0x9A,\n+\t0x32, 0x72, 0x57, 0xF1, 0xEB, 0xB7, 0x3F, 0x5B,\n+\t0x07, 0x33, 0x54, 0xB2, 0x48, 0x66, 0x85, 0x63\n+};\n+\n+uint8_t sm2_C1_x_t1[] = {\n+\t0x15, 0xf6, 0xb7, 0x49, 0x00,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99, 0x6D, 0x3B, 0x8C, 0xCE, 0xED, 0xEE\n+};\n+\n+struct crypto_testsuite_sm2_params sm2_enc_hw_t1 = {\n+\t.k = {\n+\t\t.data = sm2_k_t1,\n+\t\t.length = sizeof(sm2_k_t1)\n+\t},\n+\t.pubkey = {\n+\t\t.x = {\n+\t\t\t.data = sm2_enc_pub_x_t1,\n+\t\t\t.length = sizeof(sm2_enc_pub_x_t1)\n+\t\t},\n+\t\t.y = {\n+\t\t\t.data = sm2_enc_pub_y_t1,\n+\t\t\t.length = sizeof(sm2_enc_pub_y_t1)\n+\t\t}\n+\t},\n+\t.C1 = {\n+\t\t.x = {\n+\t\t\t.data = sm2_C1_x_t1,\n+\t\t\t.length = sizeof(sm2_C1_x_t1)\n+\t\t},\n+\t\t.y = {\n+\t\t\t.data = sm2_C1_y_t1,\n+\t\t\t.length = sizeof(sm2_C1_y_t1)\n+\t\t}\n+\t},\n+\t.kP = {\n+\t\t.x = {\n+\t\t\t.data = sm2_kP_x_t1,\n+\t\t\t.length = sizeof(sm2_kP_x_t1)\n+\t\t},\n+\t\t.y = {\n+\t\t\t.data = sm2_kP_y_t1,\n+\t\t\t.length = sizeof(sm2_kP_y_t1)\n+\t\t}\n+\t},\n+\t.pkey = {\n+\t\t.data = sm2_kP_d_t1,\n+\t\t.length = sizeof(sm2_kP_d_t1)\n+\t}\n+};\n+\n static uint8_t fp256_pkey[] = {\n \t0x77, 0x84, 0x35, 0x65, 0x4c, 0x7a, 0x6d, 0xb1,\n \t0x1e, 0x63, 0x0b, 0x41, 0x97, 0x36, 0x04, 0xf4,\n",
    "prefixes": [
        "3/3"
    ]
}