get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 131625,
    "url": "https://patches.dpdk.org/api/patches/131625/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20230919130412.284-1-gmuthukrishn@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": "<20230919130412.284-1-gmuthukrishn@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230919130412.284-1-gmuthukrishn@marvell.com",
    "date": "2023-09-19T13:04:12",
    "name": "crypto/openssl: fix memory leaks in SM2 ops",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "9208d50be068d6db7bd9305e583daa8a725d10c4",
    "submitter": {
        "id": 2301,
        "url": "https://patches.dpdk.org/api/people/2301/?format=api",
        "name": "Gowrishankar Muthukrishnan",
        "email": "gmuthukrishn@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/20230919130412.284-1-gmuthukrishn@marvell.com/mbox/",
    "series": [
        {
            "id": 29552,
            "url": "https://patches.dpdk.org/api/series/29552/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=29552",
            "date": "2023-09-19T13:04:12",
            "name": "crypto/openssl: fix memory leaks in SM2 ops",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/29552/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/131625/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/131625/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 4FEE6425FF;\n\tTue, 19 Sep 2023 15:04:25 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id DABD640278;\n\tTue, 19 Sep 2023 15:04:24 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id CBBC340276\n for <dev@dpdk.org>; Tue, 19 Sep 2023 15:04:22 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 38J6mDKT022848; Tue, 19 Sep 2023 06:04:22 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3t5bvkrefd-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Tue, 19 Sep 2023 06:04:21 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Tue, 19 Sep 2023 06:04:19 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Tue, 19 Sep 2023 06:04:19 -0700",
            "from BG-LT91401.marvell.com (unknown [10.193.74.240])\n by maili.marvell.com (Postfix) with ESMTP id 40CA43F70A6;\n Tue, 19 Sep 2023 06:04:15 -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 : mime-version : content-transfer-encoding :\n content-type; s=pfpt0220; bh=aoHVvbQtz0Iii9Rfkrte2eM6AzX1+LYy+H169p7t8bs=;\n b=NkRDV8aCcA7HTj8VpGTncvg0Waw5HDf4DTVLQQE+fHmK5nPBoZgsgxkvnuRq6GQz7SE5\n YCHG1KYh1//uksXGMmTDiFtjGYhBrIa7KPtR+JrE/dZoUfpijzMdLAMoF4EWwQfbAB1v\n g6kUZ+Vv3fNtcMffnoCaOk9K++3RxgZC+iFUs71k0FBSz1OJvYy+p6/Iroj47xICX1TP\n Wllh0Xn+BSqpTXZos1ImdA7CJloMZH/EJ04b7YSzPjdgXLaI/W4DJe/xZsIBIFs+TYQV\n y3kHUxvrNqgiTRHdqD70skWOCTZy0fWzHF39EzUeT4G5M03oI42JGb3JRSkx1da3CkUx 4g==",
        "From": "Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<anoobj@marvell.com>, Akhil Goyal <gakhil@marvell.com>, Kai Ji\n <kai.ji@intel.com>, Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>",
        "Subject": "[PATCH] crypto/openssl: fix memory leaks in SM2 ops",
        "Date": "Tue, 19 Sep 2023 18:34:12 +0530",
        "Message-ID": "<20230919130412.284-1-gmuthukrishn@marvell.com>",
        "X-Mailer": "git-send-email 2.21.0",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "iUzHFUYdOXXYwg14GdEpubDQsNOFPZCm",
        "X-Proofpoint-ORIG-GUID": "iUzHFUYdOXXYwg14GdEpubDQsNOFPZCm",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26\n definitions=2023-09-19_06,2023-09-19_01,2023-05-22_02",
        "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": "Fix memory leaks in SM2 ops, as reported by valgrind.\n\nSigned-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>\n---\n drivers/crypto/openssl/rte_openssl_pmd.c | 45 ++++++++++++++----------\n 1 file changed, 26 insertions(+), 19 deletions(-)",
    "diff": "diff --git a/drivers/crypto/openssl/rte_openssl_pmd.c b/drivers/crypto/openssl/rte_openssl_pmd.c\nindex 5e8624cebe..c69889d522 100644\n--- a/drivers/crypto/openssl/rte_openssl_pmd.c\n+++ b/drivers/crypto/openssl/rte_openssl_pmd.c\n@@ -2674,10 +2674,13 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \tEVP_PKEY_CTX *kctx = NULL, *sctx = NULL, *cctx = NULL;\n \tstruct rte_crypto_asym_op *op = cop->asym;\n \tOSSL_PARAM_BLD *param_bld = NULL;\n+\tECDSA_SIG *ec_sign = NULL;\n+\tEVP_MD_CTX *md_ctx = NULL;\n \tOSSL_PARAM *params = NULL;\n+\tEVP_MD *check_md = NULL;\n \tEVP_PKEY *pkey = NULL;\n \tBIGNUM *pkey_bn = NULL;\n-\tuint8_t pubkey[64];\n+\tuint8_t pubkey[65];\n \tsize_t len = 0;\n \tint ret = -1;\n \n@@ -2787,10 +2790,7 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \t\t{\n \t\t\tunsigned char signbuf[128] = {0};\n \t\t\tconst unsigned char *signptr;\n-\t\t\tEVP_MD_CTX *md_ctx = NULL;\n \t\t\tconst BIGNUM *r, *s;\n-\t\t\tECDSA_SIG *ec_sign;\n-\t\t\tEVP_MD *check_md;\n \t\t\tsize_t signlen;\n \n \t\t\tkctx = EVP_PKEY_CTX_new_from_name(NULL, \"SM2\", NULL);\n@@ -2842,17 +2842,12 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \t\t\top->sm2.s.length = BN_num_bytes(s);\n \t\t\tBN_bn2bin(r, op->sm2.r.data);\n \t\t\tBN_bn2bin(s, op->sm2.s.data);\n-\n-\t\t\tECDSA_SIG_free(ec_sign);\n \t\t}\n \t\tbreak;\n \tcase RTE_CRYPTO_ASYM_OP_VERIFY:\n \t\t{\n-\t\t\tunsigned char signbuf[128] = {0};\n \t\t\tBIGNUM *r = NULL, *s = NULL;\n-\t\t\tEVP_MD_CTX *md_ctx = NULL;\n-\t\t\tECDSA_SIG *ec_sign;\n-\t\t\tEVP_MD *check_md;\n+\t\t\tunsigned char *signbuf;\n \t\t\tsize_t signlen;\n \n \t\t\tkctx = EVP_PKEY_CTX_new_from_name(NULL, \"SM2\", NULL);\n@@ -2902,19 +2897,16 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \t\t\t\tgoto err_sm2;\n \t\t\t}\n \n-\t\t\tr = NULL;\n-\t\t\ts = NULL;\n-\n-\t\t\tsignlen = i2d_ECDSA_SIG(ec_sign, (unsigned char **)&signbuf);\n-\t\t\tif (signlen <= 0)\n+\t\t\tsignlen = i2d_ECDSA_SIG(ec_sign, 0);\n+\t\t\tsignbuf = rte_malloc(NULL, signlen, 0);\n+\t\t\tsignlen = i2d_ECDSA_SIG(ec_sign, &signbuf);\n+\t\t\tif (signlen <= 0) {\n+\t\t\t\trte_free(signbuf);\n \t\t\t\tgoto err_sm2;\n+\t\t\t}\n \n \t\t\tif (!EVP_DigestVerifyFinal(md_ctx, signbuf, signlen))\n \t\t\t\tgoto err_sm2;\n-\n-\t\t\tBN_free(r);\n-\t\t\tBN_free(s);\n-\t\t\tECDSA_SIG_free(ec_sign);\n \t}\n \t\tbreak;\n \tdefault:\n@@ -2928,6 +2920,15 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \tret = 0;\n \tcop->status = RTE_CRYPTO_OP_STATUS_SUCCESS;\n err_sm2:\n+\tif (ec_sign)\n+\t\tECDSA_SIG_free(ec_sign);\n+\n+\tif (check_md)\n+\t\tEVP_MD_free(check_md);\n+\n+\tif (md_ctx)\n+\t\tEVP_MD_CTX_free(md_ctx);\n+\n \tif (kctx)\n \t\tEVP_PKEY_CTX_free(kctx);\n \n@@ -2943,6 +2944,12 @@ process_openssl_sm2_op_evp(struct rte_crypto_op *cop,\n \tif (param_bld)\n \t\tOSSL_PARAM_BLD_free(param_bld);\n \n+\tif (params)\n+\t\tOSSL_PARAM_free(params);\n+\n+\tif (pkey_bn)\n+\t\tBN_free(pkey_bn);\n+\n \treturn ret;\n }\n \n",
    "prefixes": []
}