get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 94833,
    "url": "https://patches.dpdk.org/api/patches/94833/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1624600591-29841-10-git-send-email-anoobj@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1624600591-29841-10-git-send-email-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1624600591-29841-10-git-send-email-anoobj@marvell.com",
    "date": "2021-06-25T05:56:20",
    "name": "[v2,09/20] crypto/cnxk: add auth operation in session",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "4c4a03c5d23670344d390d6007d3e5817d20cfc3",
    "submitter": {
        "id": 1205,
        "url": "https://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "https://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1624600591-29841-10-git-send-email-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 17483,
            "url": "https://patches.dpdk.org/api/series/17483/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=17483",
            "date": "2021-06-25T05:56:11",
            "name": "Add Marvell CNXK crypto PMDs",
            "version": 2,
            "mbox": "https://patches.dpdk.org/series/17483/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/94833/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/94833/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 CD4D9A0C40;\n\tFri, 25 Jun 2021 07:58:16 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 65EDE410E8;\n\tFri, 25 Jun 2021 07:57:50 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id DA31A410D8\n for <dev@dpdk.org>; Fri, 25 Jun 2021 07:57:48 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id\n 15P5nxkO007987; Thu, 24 Jun 2021 22:57:48 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com with ESMTP id 39d24dhk2m-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Thu, 24 Jun 2021 22:57:47 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18;\n Thu, 24 Jun 2021 22:57:46 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.18 via Frontend\n Transport; Thu, 24 Jun 2021 22:57:46 -0700",
            "from HY-LT1002.marvell.com (HY-LT1002.marvell.com [10.28.176.218])\n by maili.marvell.com (Postfix) with ESMTP id 260D73F7041;\n Thu, 24 Jun 2021 22:57:42 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=TOzjp1ZmTDqizeuvNVOw8H2UdQleCE1ubfZSMn69tXE=;\n b=C994bfZFfsvAvcVqoeztP9pByqyE1fhDq6dU2+ikZ4VPJh0bBGMTpG6PFQqfEEysBd4U\n fCGOvC2IN35bFt6JfBzbuAFJcP/RDnXZclHHx3+NCb8pXBGaFE1ms0OZjCr/RNIuURSC\n 3cLcFg4fYysG+n5kKhuS9/xOoYU2uIH4eSV+PHajUL8ASUwbfphrwvARFvbUoniTgLHF\n +1vGiSHByMx7bu9s6p5AIgsv2VEkIZ13YmNI8ESLGuXs4/Bq8wf0+87tTLqGnnWEL4yH\n 1w2KzIogN8lKrbFx04oQGufcFOmZfS8ngz3izjQRxa966WabppwscLZ0xuodAGgo3hZn zw==",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Akhil Goyal <gakhil@marvell.com>, Thomas Monjalon <thomas@monjalon.net>",
        "CC": "Anoob Joseph <anoobj@marvell.com>, Jerin Jacob <jerinj@marvell.com>,\n \"Ankur Dwivedi\" <adwivedi@marvell.com>, Tejasree Kondoj\n <ktejasree@marvell.com>, <dev@dpdk.org>, Archana Muniganti\n <marchana@marvell.com>",
        "Date": "Fri, 25 Jun 2021 11:26:20 +0530",
        "Message-ID": "<1624600591-29841-10-git-send-email-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1624600591-29841-1-git-send-email-anoobj@marvell.com>",
        "References": "\n <http://patches.dpdk.org/project/dpdk/cover/1622652221-22732-1-git-send-email-anoobj@marvell.com/>\n <1624600591-29841-1-git-send-email-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "N2tobQf8AQ5JYg9ScmORCj-kdK4lFxHa",
        "X-Proofpoint-ORIG-GUID": "N2tobQf8AQ5JYg9ScmORCj-kdK4lFxHa",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:6.0.391, 18.0.790\n definitions=2021-06-25_02:2021-06-24,\n 2021-06-25 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v2 09/20] crypto/cnxk: add auth operation in\n session",
        "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",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Add support for auth operations in session.\n\nSigned-off-by: Ankur Dwivedi <adwivedi@marvell.com>\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Archana Muniganti <marchana@marvell.com>\nSigned-off-by: Tejasree Kondoj <ktejasree@marvell.com>\n---\n drivers/crypto/cnxk/cnxk_cryptodev_ops.c |  13 +++\n drivers/crypto/cnxk/cnxk_se.h            | 194 +++++++++++++++++++++++++++++++\n 2 files changed, 207 insertions(+)",
    "diff": "diff --git a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c\nindex b6d3076..f2319df 100644\n--- a/drivers/crypto/cnxk/cnxk_cryptodev_ops.c\n+++ b/drivers/crypto/cnxk/cnxk_cryptodev_ops.c\n@@ -460,6 +460,12 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,\n \tcase CNXK_CPT_CIPHER:\n \t\tret = fill_sess_cipher(xform, sess_priv);\n \t\tbreak;\n+\tcase CNXK_CPT_AUTH:\n+\t\tif (xform->auth.algo == RTE_CRYPTO_AUTH_AES_GMAC)\n+\t\t\tret = fill_sess_gmac(xform, sess_priv);\n+\t\telse\n+\t\t\tret = fill_sess_auth(xform, sess_priv);\n+\t\tbreak;\n \tdefault:\n \t\tret = -1;\n \t}\n@@ -467,6 +473,13 @@ sym_session_configure(struct roc_cpt *roc_cpt, int driver_id,\n \tif (ret)\n \t\tgoto priv_put;\n \n+\tif ((sess_priv->roc_se_ctx.fc_type == ROC_SE_HASH_HMAC) &&\n+\t    cpt_mac_len_verify(&xform->auth)) {\n+\t\tplt_dp_err(\"MAC length is not supported\");\n+\t\tret = -ENOTSUP;\n+\t\tgoto priv_put;\n+\t}\n+\n \tsess_priv->cpt_inst_w7 = cnxk_cpt_inst_w7_get(sess_priv, roc_cpt);\n \n \tset_sym_session_private_data(sess, driver_id, sess_priv);\ndiff --git a/drivers/crypto/cnxk/cnxk_se.h b/drivers/crypto/cnxk/cnxk_se.h\nindex b5a16c4..6e4b032 100644\n--- a/drivers/crypto/cnxk/cnxk_se.h\n+++ b/drivers/crypto/cnxk/cnxk_se.h\n@@ -29,6 +29,48 @@ struct cnxk_se_sess {\n } __rte_cache_aligned;\n \n static __rte_always_inline int\n+cpt_mac_len_verify(struct rte_crypto_auth_xform *auth)\n+{\n+\tuint16_t mac_len = auth->digest_length;\n+\tint ret;\n+\n+\tswitch (auth->algo) {\n+\tcase RTE_CRYPTO_AUTH_MD5:\n+\tcase RTE_CRYPTO_AUTH_MD5_HMAC:\n+\t\tret = (mac_len == 16) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA1:\n+\tcase RTE_CRYPTO_AUTH_SHA1_HMAC:\n+\t\tret = (mac_len == 20) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA224:\n+\tcase RTE_CRYPTO_AUTH_SHA224_HMAC:\n+\t\tret = (mac_len == 28) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA256:\n+\tcase RTE_CRYPTO_AUTH_SHA256_HMAC:\n+\t\tret = (mac_len == 32) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA384:\n+\tcase RTE_CRYPTO_AUTH_SHA384_HMAC:\n+\t\tret = (mac_len == 48) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA512:\n+\tcase RTE_CRYPTO_AUTH_SHA512_HMAC:\n+\t\tret = (mac_len == 64) ? 0 : -1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_NULL:\n+\t\tret = 0;\n+\t\tbreak;\n+\tdefault:\n+\t\tret = -1;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+\n+static __rte_always_inline int\n fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)\n {\n \tstruct rte_crypto_cipher_xform *c_form;\n@@ -134,4 +176,156 @@ fill_sess_cipher(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)\n \n \treturn 0;\n }\n+\n+static __rte_always_inline int\n+fill_sess_auth(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)\n+{\n+\tstruct rte_crypto_auth_xform *a_form;\n+\troc_se_auth_type auth_type = 0; /* NULL Auth type */\n+\tuint8_t zsk_flag = 0, aes_gcm = 0, is_null = 0;\n+\n+\tif (xform->next != NULL &&\n+\t    xform->next->type == RTE_CRYPTO_SYM_XFORM_CIPHER &&\n+\t    xform->next->cipher.op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) {\n+\t\t/* Perform auth followed by encryption */\n+\t\tsess->roc_se_ctx.template_w4.s.opcode_minor =\n+\t\t\tROC_SE_FC_MINOR_OP_HMAC_FIRST;\n+\t}\n+\n+\ta_form = &xform->auth;\n+\n+\tif (a_form->op == RTE_CRYPTO_AUTH_OP_VERIFY)\n+\t\tsess->cpt_op |= ROC_SE_OP_AUTH_VERIFY;\n+\telse if (a_form->op == RTE_CRYPTO_AUTH_OP_GENERATE)\n+\t\tsess->cpt_op |= ROC_SE_OP_AUTH_GENERATE;\n+\telse {\n+\t\tplt_dp_err(\"Unknown auth operation\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (a_form->algo) {\n+\tcase RTE_CRYPTO_AUTH_SHA1_HMAC:\n+\t\t/* Fall through */\n+\tcase RTE_CRYPTO_AUTH_SHA1:\n+\t\tauth_type = ROC_SE_SHA1_TYPE;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA256_HMAC:\n+\tcase RTE_CRYPTO_AUTH_SHA256:\n+\t\tauth_type = ROC_SE_SHA2_SHA256;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA512_HMAC:\n+\tcase RTE_CRYPTO_AUTH_SHA512:\n+\t\tauth_type = ROC_SE_SHA2_SHA512;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_AES_GMAC:\n+\t\tauth_type = ROC_SE_GMAC_TYPE;\n+\t\taes_gcm = 1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA224_HMAC:\n+\tcase RTE_CRYPTO_AUTH_SHA224:\n+\t\tauth_type = ROC_SE_SHA2_SHA224;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA384_HMAC:\n+\tcase RTE_CRYPTO_AUTH_SHA384:\n+\t\tauth_type = ROC_SE_SHA2_SHA384;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_MD5_HMAC:\n+\tcase RTE_CRYPTO_AUTH_MD5:\n+\t\tauth_type = ROC_SE_MD5_TYPE;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_KASUMI_F9:\n+\t\tauth_type = ROC_SE_KASUMI_F9_ECB;\n+\t\t/*\n+\t\t * Indicate that direction needs to be taken out\n+\t\t * from end of src\n+\t\t */\n+\t\tzsk_flag = ROC_SE_K_F9;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SNOW3G_UIA2:\n+\t\tauth_type = ROC_SE_SNOW3G_UIA2;\n+\t\tzsk_flag = ROC_SE_ZS_IA;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_ZUC_EIA3:\n+\t\tauth_type = ROC_SE_ZUC_EIA3;\n+\t\tzsk_flag = ROC_SE_ZS_IA;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_NULL:\n+\t\tauth_type = 0;\n+\t\tis_null = 1;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_AES_XCBC_MAC:\n+\tcase RTE_CRYPTO_AUTH_AES_CMAC:\n+\tcase RTE_CRYPTO_AUTH_AES_CBC_MAC:\n+\t\tplt_dp_err(\"Crypto: Unsupported hash algo %u\", a_form->algo);\n+\t\treturn -1;\n+\tdefault:\n+\t\tplt_dp_err(\"Crypto: Undefined Hash algo %u specified\",\n+\t\t\t   a_form->algo);\n+\t\treturn -1;\n+\t}\n+\n+\tsess->zsk_flag = zsk_flag;\n+\tsess->aes_gcm = aes_gcm;\n+\tsess->mac_len = a_form->digest_length;\n+\tsess->is_null = is_null;\n+\tif (zsk_flag) {\n+\t\tsess->auth_iv_offset = a_form->iv.offset;\n+\t\tsess->auth_iv_length = a_form->iv.length;\n+\t}\n+\tif (unlikely(roc_se_auth_key_set(&sess->roc_se_ctx, auth_type,\n+\t\t\t\t\t a_form->key.data, a_form->key.length,\n+\t\t\t\t\t a_form->digest_length)))\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+static __rte_always_inline int\n+fill_sess_gmac(struct rte_crypto_sym_xform *xform, struct cnxk_se_sess *sess)\n+{\n+\tstruct rte_crypto_auth_xform *a_form;\n+\troc_se_cipher_type enc_type = 0; /* NULL Cipher type */\n+\troc_se_auth_type auth_type = 0;\t /* NULL Auth type */\n+\n+\ta_form = &xform->auth;\n+\n+\tif (a_form->op == RTE_CRYPTO_AUTH_OP_GENERATE)\n+\t\tsess->cpt_op |= ROC_SE_OP_ENCODE;\n+\telse if (a_form->op == RTE_CRYPTO_AUTH_OP_VERIFY)\n+\t\tsess->cpt_op |= ROC_SE_OP_DECODE;\n+\telse {\n+\t\tplt_dp_err(\"Unknown auth operation\");\n+\t\treturn -1;\n+\t}\n+\n+\tswitch (a_form->algo) {\n+\tcase RTE_CRYPTO_AUTH_AES_GMAC:\n+\t\tenc_type = ROC_SE_AES_GCM;\n+\t\tauth_type = ROC_SE_GMAC_TYPE;\n+\t\tbreak;\n+\tdefault:\n+\t\tplt_dp_err(\"Crypto: Undefined cipher algo %u specified\",\n+\t\t\t   a_form->algo);\n+\t\treturn -1;\n+\t}\n+\n+\tsess->zsk_flag = 0;\n+\tsess->aes_gcm = 0;\n+\tsess->is_gmac = 1;\n+\tsess->iv_offset = a_form->iv.offset;\n+\tsess->iv_length = a_form->iv.length;\n+\tsess->mac_len = a_form->digest_length;\n+\n+\tif (unlikely(roc_se_ciph_key_set(&sess->roc_se_ctx, enc_type,\n+\t\t\t\t\t a_form->key.data, a_form->key.length,\n+\t\t\t\t\t NULL)))\n+\t\treturn -1;\n+\n+\tif (unlikely(roc_se_auth_key_set(&sess->roc_se_ctx, auth_type, NULL, 0,\n+\t\t\t\t\t a_form->digest_length)))\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n #endif /*_CNXK_SE_H_ */\n",
    "prefixes": [
        "v2",
        "09/20"
    ]
}